JP2012043216A - Program automatic generation device - Google Patents

Program automatic generation device Download PDF

Info

Publication number
JP2012043216A
JP2012043216A JP2010184260A JP2010184260A JP2012043216A JP 2012043216 A JP2012043216 A JP 2012043216A JP 2010184260 A JP2010184260 A JP 2010184260A JP 2010184260 A JP2010184260 A JP 2010184260A JP 2012043216 A JP2012043216 A JP 2012043216A
Authority
JP
Japan
Prior art keywords
test
input
output
pattern
code
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
JP2010184260A
Other languages
Japanese (ja)
Other versions
JP5521889B2 (en
Inventor
Masatoshi Tsuyuki
正年 露木
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric 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 Fuji Electric Co Ltd filed Critical Fuji Electric Co Ltd
Priority to JP2010184260A priority Critical patent/JP5521889B2/en
Publication of JP2012043216A publication Critical patent/JP2012043216A/en
Application granted granted Critical
Publication of JP5521889B2 publication Critical patent/JP5521889B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

PROBLEM TO BE SOLVED: To perform a unit test using a generated control program in a shorter time in an arithmetic unit in which the generated control program is to be incorporated.SOLUTION: A template of a test driver depending on operation environment of an arithmetic unit in which a control program is to be incorporated is generated in advance. A variable input terminal of a control block diagram and a test pattern input element associated with each other when generating the control program by the control block diagram, a test pattern input code performing processing according to association of a variable output terminal with a output pattern storage element, and an output pattern storage code are generated (steps S13 to S16). From source codes of the test pattern input code, the output pattern storage code, and the control program, and the template test driver, a source code of the test driver performing a prescribed verification operation to the control program in an operating environment appropriate to operating environment specifications which are input is generated (steps S17, S18).

Description

本発明は、開発者や利用者などが作成した図形式のプログラム仕様にしたがったプログラムソースコードを自動生成するプログラム自動生成装置に関する。   The present invention relates to an automatic program generation apparatus that automatically generates a program source code according to a diagrammatic program specification created by a developer or a user.

制御ブロック図の形式で記述されたプログラム仕様をもとに、プログラムソースコード(以下、ソースコードともいう。)を自動生成する技術は、従来から一般的に、ビジュアルプログラミング技術として制御分野などのプログラム開発に利用されている。
また、このようなビジュアルプログラミング技術を利用することによって、制御ブロック図で表現された仕様からソースコードを自動的に得ることができるため、実装工程の短縮や、実装レベルでのバグ発生の抑制などの効果を期待することができる。
The technology for automatically generating program source code (hereinafter also referred to as source code) based on the program specifications described in the form of a control block diagram has conventionally been a program in the control field as a visual programming technology. Used for development.
In addition, by using such visual programming technology, the source code can be automatically obtained from the specifications expressed in the control block diagram, which shortens the mounting process and suppresses the occurrence of bugs at the mounting level. Can be expected.

しかしながら、制御ブロック図の記述レベルで誤りが発生する可能性もあるため、自動生成されたソースコードが開発者の要求通りに正しく動作するかどうかについては、ビジュアルプログラミング技術で保証することはできない。
一方、開発者が、ブロックどうしがリンクされてなる「モデル」を作成し、コード生成ツールを用いてこのモデルからソースコードを自動生成し、テスト入力パターンを用いて、モデルやソースコードによって表現された機能をパーソナルコンピュータ上で仮想的に実行し、その品質評価を行うものも提案されている(例えば、特許文献1参照)。
However, since an error may occur at the description level of the control block diagram, it cannot be guaranteed by the visual programming technique whether the automatically generated source code operates correctly as requested by the developer.
On the other hand, a developer creates a “model” in which blocks are linked, automatically generates source code from this model using a code generation tool, and is expressed by the model and source code using a test input pattern. A function has been proposed in which the function is virtually executed on a personal computer and its quality is evaluated (see, for example, Patent Document 1).

特開2005−301568号公報JP 2005-301568 A

上述のように、テスト入力パターンを用いてモデルやソースコードの実行シミュレーションを行うことにより、モデルやソースコードに対する動作検証を行うことができる。
しかしながら、モデルやソースコードに対してテスト入力パターンを利用してシミュレーションを行う際には、モデルやソースコードによって表現された機能を、パーソナルコンピュータ上で仮想的に実行している。そのため、モデルやソースコード自体の動作は保証することはできるものの、シミュレーションを行う動作環境は任意に設定されているため、このソースコードが実際に組み込まれる、組み込み対象の演算装置の動作環境と一致していない場合には、組み込み対象の演算装置の動作環境下での動作検証を行うことができないことになる。
そのため、モデルやソースコード自体の動作は保証することはできるものの、ソースコードを演算装置に組み込んで動作させた場合の動作保証を行うことはできず、実際に、組み込み対象の演算装置に組み込んで動作させた時点で、開発者の要求する仕様通りの動作を行うことができないということが判明する可能性がある。
As described above, by performing an execution simulation of a model or source code using a test input pattern, it is possible to perform operation verification on the model or source code.
However, when a simulation is performed on a model or source code using a test input pattern, the function expressed by the model or source code is virtually executed on a personal computer. Therefore, although the operation of the model and the source code itself can be guaranteed, the operating environment for performing the simulation is arbitrarily set. Therefore, the operating environment of the computing device to be embedded in which the source code is actually incorporated is identical. Otherwise, the operation verification under the operating environment of the arithmetic device to be incorporated cannot be performed.
Therefore, although the operation of the model and the source code itself can be guaranteed, the operation cannot be guaranteed when the source code is incorporated into an arithmetic device and operated. At the time of operation, it may be found that the operation as specified by the developer cannot be performed.

このため、このソースコードが搭載される装置全体を稼働させる前に、生成されたソースコードを組み込み対象の演算装置に組み込み、演算装置単体で動作させて動作検証を行う(以後、単体テストともいう。)必要があるが、この動作検証を行うためには、組み込み対象の演算装置の実際の動作環境に則して動作するテストドライバを改めて作成する等、単体テストを行うための動作環境を別途整える必要があり、その分、単体テストの所要時間が長くなるため、単体テストの工程をより短縮することの可能な方法が望まれていた。
そこで、この発明は、上記従来の未解決の問題点に着目してなされたものであり、作成された制御プログラムの組み込み対象の演算装置での、前記制御プログラムを用いた単体テストをより短時間で行うことの可能な、前記制御プログラムのソースコードを生成するプログラム自動生成装置を提供することを目的としている。
For this reason, before operating the entire apparatus on which this source code is mounted, the generated source code is incorporated into an arithmetic device to be embedded, and the operation is verified by operating the arithmetic device alone (hereinafter also referred to as a unit test). However, in order to perform this operation verification, it is necessary to prepare a separate operating environment for unit testing, such as creating a new test driver that operates in accordance with the actual operating environment of the target computing device. As a result, the time required for the unit test becomes longer, so a method capable of further shortening the unit test process has been desired.
Therefore, the present invention has been made paying attention to the above-mentioned conventional unsolved problems, and the unit test using the control program can be performed in a shorter time in the arithmetic device to be incorporated into the created control program. An object of the present invention is to provide an automatic program generation device that can generate a source code of the control program.

上記目的を達成するために、本発明の請求項1にかかるプログラム自動生成装置は、変数入力端子要素、変数出力端子要素及び演算要素間を接続することで一の制御プログラムによる制御処理の流れを表現する制御ブロック図からコンパイル可能なソースコードを生成するプログラム自動生成装置において、前記制御ブロック図の変数入力端子要素と当該変数入力端子要素に入力するテストパターンとの対応付けを行うテストパターン入力対応付け手段と、前記制御ブロック図の変数出力端子要素と当該変数出力端子要素から出力される出力パターンの保存先との対応付けを行う出力パターン対応付け手段と、対応付けられた前記変数入力端子要素及び前記テストパターンに基づき、前記制御ブロック図の前記変数入力端子要素に前記対応付けられた前記テストパターンを入力するソースコードをテストパターン入力コードとして生成するテストパターン入力コード自動生成手段と、対応付けられた前記変数出力端子要素及び前記出力パターンの保存先に基づき、前記制御ブロック図の前記変数出力端子要素の出力を読み出して当該出力を前記対応付けられた前記出力パターンの保存先に保存するソースコードを出力パターン保存コードとして生成する出力パターン保存コード自動生成手段と、予め記憶領域に格納された、前記一の制御プログラムを組み込む演算装置による当該制御プログラムの単体テストに用いるテストドライバの雛形と、前記一の制御プログラムの動作環境を特定する動作環境諸元を入力する動作環境諸元入力手段と、前記テストドライバの雛形と、前記動作環境諸元入力手段で入力された動作環境諸元と、前記テストパターン入力コード及び前記出力パターン保存コードと、前記一の制御プログラムのソースコードとから、前記単体テストのテストドライバのソースコードを生成するテストドライバコード自動生成手段と、を備えることを特徴としている。   In order to achieve the above object, an automatic program generation device according to claim 1 of the present invention connects a variable input terminal element, a variable output terminal element, and an arithmetic element, thereby reducing the flow of control processing by a single control program. In a program automatic generation apparatus that generates compilable source code from a control block diagram to be expressed, test pattern input support for associating a variable input terminal element of the control block diagram with a test pattern input to the variable input terminal element Attaching means, output pattern associating means for associating the variable output terminal element of the control block diagram with the storage destination of the output pattern output from the variable output terminal element, and the associated variable input terminal element And the correspondence to the variable input terminal element of the control block diagram based on the test pattern. The control block diagram based on the test pattern input code automatic generation means for generating the source code for inputting the test pattern as a test pattern input code, the associated variable output terminal element, and the storage destination of the output pattern Output pattern storage code automatic generation means for reading out the output of the variable output terminal element and generating the source code for storing the output in the storage destination of the associated output pattern as an output pattern storage code; Operating environment specifications for inputting a test driver model used for a unit test of the control program and an operating environment specification for specifying the operating environment of the one control program stored in the computer Input means, template of the test driver, and the operation The unit test test driver source code is generated from the operating environment specifications input by the boundary specification input means, the test pattern input code and the output pattern storage code, and the source code of the one control program. And a test driver code automatic generation means.

また、請求項2に係るプログラム自動生成装置は、前記テストドライバの雛形は、複数の種類の異なる前記演算装置それぞれに対応して生成され、前記テストドライバコード自動生成手段は、前記複数のテストドライバの雛形のうち、指定されたテストドライバの雛形を用いて前記テストドライバのソースコードを生成することを特徴としている。
さらに、請求項3に係るプログラム自動生成装置は、前記テストパターン入力対応付け手段は、前記制御ブロック図の変数入力端子要素に前記テストパターンを与える機能を表現するテストパターン入力要素を記述する手段を有し、当該テストパターン入力要素が有する接続端子と前記変数入力端子要素とを表示することにより前記対応付けを利用者に促し、前記出力パターン対応付け手段は、前記制御ブロック図の前記変数出力端子要素の数値を保存する機能を表現する出力パターン保存要素を記述する手段を有し、当該出力パターン保存要素が有する接続端子と前記変数出力端子要素とを表示することにより前記対応付けを利用者に促すことを特徴としている。
Further, in the program automatic generation device according to claim 2, the test driver template is generated corresponding to each of a plurality of different types of arithmetic devices, and the test driver code automatic generation means includes the plurality of test drivers. The test driver source code is generated using a specified test driver template among the template.
Further, in the automatic program generation device according to claim 3, the test pattern input associating means includes means for describing a test pattern input element expressing a function for giving the test pattern to the variable input terminal element of the control block diagram. And displaying the connection terminal of the test pattern input element and the variable input terminal element to prompt the user for the association, and the output pattern associating means includes the variable output terminal of the control block diagram. Means for describing an output pattern storage element expressing a function for storing the numerical value of the element, and displaying the association by displaying the connection terminal of the output pattern storage element and the variable output terminal element to the user It is characterized by prompting.

本発明によれば、一の制御プログラムを作成する際に、当該制御プログラムの組み込み対象の演算装置の動作環境に依存する予め生成しておいたテストドライバの雛形と、入力した動作環境諸元とに応じた動作環境を実現するテストドライバが、一の制御プログラムの組み込み対象の演算装置の単体テスト用のテストドライバとして生成され、このテストドライバを含んで一の制御プログラムのソースコードが生成されるため、利用者は、一の制御プログラムを生成する際に動作環境諸元を入力することにより一の制御プログラムの単体テスト用のテストドライバを容易に作成することができる。そのため、一の制御プログラムを用いた単体テストを行う段階で、単体テスト用のテストドライバを新たに作成する必要はなく、その分、単体テストに要する所要時間の短縮を図ることができる。
また、テストドライバを作成する際には、利用者はテストドライバ自体を作成する必要はなく動作環境諸元の入力を行うだけでよいため、容易に作成することができる。
According to the present invention, when creating one control program, a test driver template that has been generated in advance depending on the operating environment of the arithmetic device to be incorporated into the control program, the input operating environment specifications, and Because the test driver that realizes the operating environment according to is generated as a test driver for unit testing of the arithmetic device to be embedded in one control program, the source code of one control program is generated including this test driver The user can easily create a test driver for unit testing of one control program by inputting operating environment specifications when generating one control program. Therefore, it is not necessary to create a new test driver for unit testing at the stage of performing unit testing using one control program, and the time required for unit testing can be reduced accordingly.
In addition, when creating a test driver, the user does not need to create the test driver itself, but only needs to input the operating environment specifications, so that the test driver can be created easily.

本発明を適用したプログラム自動生成装置の一例を示すブロック図である。It is a block diagram which shows an example of the program automatic generation apparatus to which this invention is applied. 制御ブロック図で記述された制御処理の一例である。It is an example of the control process described by the control block diagram. 制御ブロック図で記述された制御処理から自動生成されたソースコードの一例である。It is an example of the source code automatically generated from the control processing described in the control block diagram. テストパターン入力要素の記述例である。It is a description example of a test pattern input element. 図4のテストパターン入力要素の記述例から自動生成されたテストパターン入力処理のソースコード例である。FIG. 5 is a source code example of a test pattern input process automatically generated from a description example of the test pattern input element of FIG. 4. 出力パターン保存要素の記述例である。It is a description example of an output pattern storage element. 図6の出力パターン保存要素の記述例から自動生成された出力パターン保存処理のソースコード例である。FIG. 7 is a source code example of output pattern storage processing automatically generated from the description example of the output pattern storage element of FIG. 6. FIG. テストパターン入力対応付け手段、出力パターン対応付け手段のその他の例である。It is the other example of a test pattern input matching means and an output pattern matching means. 本発明の動作説明に供する説明図である。It is explanatory drawing with which it uses for operation | movement description of this invention. 動作環境諸元の一例である。It is an example of operating environment specifications. 自動生成されたテストドライバのソースコード例を示すフローチャートである。It is a flowchart which shows the source code example of the test driver generated automatically. プログラム自動生成装置の処理手順の一例を示すフローチャートである。It is a flowchart which shows an example of the process sequence of a program automatic generation apparatus.

以下、本発明の実施の形態を説明する。
図1は、本発明におけるプログラム自動生成装置の一例を示す機能ブロック図である。
図1において、1は利用者が操作するための入力装置、2はプログラム自動生成装置本体である。入力装置1は、表示装置とキーボードやマウス等の入力手段とを備えて構成される。
プログラム自動生成装置2は、制御ブロック図仕様記述手段21と、制御処理コード自動生成手段22とを備える。さらに制御ブロック図仕様記述手段21は、テストパターン入力要素記述手段21a及び出力パターン保存要素記述手段21bを有し、制御処理コード自動生成手段22は、テストパターン入力コード自動生成手段22a、出力パターン保存コード自動生成手段22b、テストドライバコード自動生成手段22c及び雛形テストドライバ23を備えている。
Embodiments of the present invention will be described below.
FIG. 1 is a functional block diagram showing an example of an automatic program generation device according to the present invention.
In FIG. 1, 1 is an input device for a user to operate, and 2 is an automatic program generation device body. The input device 1 includes a display device and input means such as a keyboard and a mouse.
The automatic program generation apparatus 2 includes a control block diagram specification description unit 21 and a control processing code automatic generation unit 22. Further, the control block diagram specification description means 21 has a test pattern input element description means 21a and an output pattern storage element description means 21b, and the control processing code automatic generation means 22 has a test pattern input code automatic generation means 22a, an output pattern storage. An automatic code generation unit 22b, a test driver code automatic generation unit 22c, and a template test driver 23 are provided.

制御ブロック図仕様記述手段21は、入力装置1から入力される指示に応じて、作成したい制御プログラムの仕様を制御ブロック図で記述する。ここでいうブロック図とは、例えば、図2に示すように、変数入力端子要素から出発して、いくつかの演算要素を経て変数出力端子要素に至るまでの処理の流れを、各要素を表すシンボルどうしを線で接続することで表現するものである。図2中、101〜104は変数入力端子要素、105は加算要素、106は乗算要素、107は比較要素、108、109は変数出力端子要素を表す。図2では、変数入力端子要素101及び102への入力値が加算要素105で加算され、その加算結果と変数入力端子要素103への入力値とが乗算要素106で乗算され、その乗算結果が変数出力端子要素108に出力されると共に、比較要素107の反転入力端子に入力されることを表す。さらに、比較要素107は、非反転入力端子に入力される変数入力端子要素104への入力値と反転入力端子への入力値との差分値が正値であるとき“TRUE”を表す例えばHIGHレベルの信号、差分値が零又は負値であるとき“FALSE”を表すLOWレベルの信号を変数出力端子要素109に出力することを表す。   The control block diagram specification description means 21 describes the specification of the control program to be created in the control block diagram in accordance with an instruction input from the input device 1. Here, for example, as shown in FIG. 2, each block represents a flow of processing from a variable input terminal element to a variable output terminal element through several arithmetic elements. It is expressed by connecting symbols with lines. In FIG. 2, 101 to 104 are variable input terminal elements, 105 is an addition element, 106 is a multiplication element, 107 is a comparison element, and 108 and 109 are variable output terminal elements. In FIG. 2, the input values to the variable input terminal elements 101 and 102 are added by the addition element 105, the addition result and the input value to the variable input terminal element 103 are multiplied by the multiplication element 106, and the multiplication result is the variable. This indicates that the signal is output to the output terminal element 108 and input to the inverting input terminal of the comparison element 107. Further, the comparison element 107 is, for example, a HIGH level representing “TRUE” when the difference value between the input value to the variable input terminal element 104 input to the non-inverting input terminal and the input value to the inverting input terminal is a positive value. , When the difference value is zero or a negative value, it indicates that a LOW level signal indicating “FALSE” is output to the variable output terminal element 109.

制御ブロック図仕様記述手段21は、図2の構成要素である端子要素や演算要素などのシンボルを入力装置1の表示装置の画面上に表示する記述手段を備えており、入力装置1の表示装置の画面上に表示される各端子要素や演算要素のシンボルに対し、入力装置1の利用者がその入力手段を操作して画面上でシンボルの配置位置の調整や、シンボル間を線で接続することによって、作成したい制御プログラムの仕様を制御ブロック図で記述するようになっている。   The control block diagram specification description means 21 includes a description means for displaying symbols such as terminal elements and arithmetic elements, which are constituent elements of FIG. 2, on the screen of the display device of the input device 1. The user of the input device 1 operates the input means for the symbol of each terminal element or arithmetic element displayed on the screen, and adjusts the symbol arrangement position on the screen or connects the symbols with lines. Thus, the specification of the control program to be created is described in a control block diagram.

制御ブロック図仕様記述手段21により生成された図2に示す制御ブロック図は、制御処理コード自動生成手段22により処理され、変数入力端子要素で表現される変数の参照を出発点として、シンボルどうしの接続関係にしたがって演算要素の演算を順次実行していった結果を、変数出力端子要素で表現される変数に代入するまでの一連の処理を、一般的な高級プログラミング言語でいうところの関数またはサブルーチンとしてまとめた形のソースコードとして出力される。   The control block diagram shown in FIG. 2 generated by the control block diagram specification description unit 21 is processed by the control processing code automatic generation unit 22, and the reference of variables represented by variable input terminal elements is used as a starting point. A function or subroutine in the general high-level programming language, which is a series of processing until the result of executing the operation of the operation element sequentially according to the connection relation is assigned to the variable represented by the variable output terminal element Is output as a source code.

出力されるソースコードは、例えば高級プログラミング言語としてC言語を用いた場合、図2の制御ブロック図は、図3に示すソースコードとして表される。
これらの、制御ブロック図をソースコードに変換する手順は、従来のビジュアルプログラミング技術で一般的に用いられており、本実施形態においてもこの方法を適用することができる。
For example, when the output source code uses C language as a high-level programming language, the control block diagram of FIG. 2 is represented as the source code shown in FIG.
These procedures for converting the control block diagram into the source code are generally used in the conventional visual programming technique, and this method can also be applied to this embodiment.

図1に戻って、制御ブロック図仕様記述手段21のテストパターン入力要素記述手段21aは、制御ブロック図仕様記述手段21により生成された制御ブロック図における変数入力端子要素に対応する出力端子要素とテストパターン入力要素とを入力装置1の表示画面に表示し、入力装置1から入力される指示に応じて、出力端子要素とテストパターン入力要素とを接続することによって、制御処理コード自動生成手段22で生成された制御プログラムを表す制御ブロック図のソースコードに対する、単体テスト用データ入力処理の仕様を記述する。図4は、図2の制御ブロック図から生成されるソースコードに対する、単体テスト用データ入力処理の仕様を記述した例である。   Returning to FIG. 1, the test pattern input element description means 21 a of the control block diagram specification description means 21 includes an output terminal element corresponding to the variable input terminal element in the control block diagram generated by the control block diagram specification description means 21 and the test. By displaying the pattern input element on the display screen of the input device 1 and connecting the output terminal element and the test pattern input element in accordance with an instruction input from the input device 1, the control processing code automatic generation means 22 Describes the specifications of unit test data input processing for the source code of the control block diagram representing the generated control program. FIG. 4 is an example in which the specifications of unit test data input processing are described for the source code generated from the control block diagram of FIG.

図4中の201はテストパターン入力要素を表現したものである。また、出力端子要素101から104は、図2の制御ブロック図における変数入力端子要素101から104に対応する出力端子要素を表現したものである。図4のテストパターン入力要素201の場合、4つの出力端子を備えている。なお、この出力端子の数は、テストパターン入力要素201の属性として設定できるようになっている。   201 in FIG. 4 represents a test pattern input element. Output terminal elements 101 to 104 represent output terminal elements corresponding to the variable input terminal elements 101 to 104 in the control block diagram of FIG. In the case of the test pattern input element 201 of FIG. 4, four output terminals are provided. Note that the number of output terminals can be set as an attribute of the test pattern input element 201.

そして、利用者が入力装置1を操作することにより、テストパターン入力要素201の各出力端子out1〜out4のそれぞれと、図2の制御ブロック図における各変数入力端子要素101〜104に対応するこれらと同名の出力端子要素101〜104との接続操作を行うことにより、テストパターン入力要素201の各出力端子out1〜out4と図2の制御ブロック図における各変数入力端子要素101〜104とを、出力端子要素101〜104を介して対応付けている。   Then, when the user operates the input device 1, each of the output terminals out1 to out4 of the test pattern input element 201 and those corresponding to the variable input terminal elements 101 to 104 in the control block diagram of FIG. By performing the connection operation with the output terminal elements 101 to 104 having the same name, the output terminals out1 to out4 of the test pattern input element 201 and the variable input terminal elements 101 to 104 in the control block diagram of FIG. Correspondence is made via elements 101-104.

図1に戻って、制御処理コード自動生成手段22のテストパターン入力コード自動生成手段22aは、テストパターン入力要素記述手段21aにより対応付けられた図4に示す、テストパターン入力要素201と出力端子要素101〜104との接続関係を、単体テスト用データ入力関数に変換する。
図5は、図4の接続関係をもとに生成された単体テスト用データ入力関数の例である。この例では、予めテスト用パターンが格納されている配列test_pattern[]のデータを、制御ブロック図の変数入力端子要素101〜104に相当する変数に代入するコードを、関数test_input()として生成している。
Returning to FIG. 1, the test pattern input code automatic generation means 22a of the control processing code automatic generation means 22 includes the test pattern input element 201 and the output terminal element shown in FIG. 4 associated with each other by the test pattern input element description means 21a. The connection relationship with 101 to 104 is converted into a unit test data input function.
FIG. 5 is an example of a unit test data input function generated based on the connection relationship of FIG. In this example, a code for substituting the data of the array test_pattern [] in which test patterns are stored in advance into variables corresponding to the variable input terminal elements 101 to 104 in the control block diagram is generated as a function test_input (). Yes.

図1に戻って、制御ブロック図仕様記述手段21の出力パターン保存要素記述手段21bは、制御ブロック図仕様記述手段21により生成された制御ブロック図における変数出力端子要素に対応する入力端子要素とテストパターン出力要素とを入力装置1の表示画面に表示し、入力装置1から入力される指示に応じて、入力端子要素とテストパターン出力要素とを接続することによって、制御処理コード自動生成手段22で生成された制御プログラムを表す制御ブロック図のソースコードに対する、単体テスト用データ出力処理の仕様を記述する。   Returning to FIG. 1, the output pattern storage element description unit 21 b of the control block diagram specification description unit 21 performs an input terminal element corresponding to the variable output terminal element in the control block diagram generated by the control block diagram specification description unit 21 and the test. By displaying the pattern output element on the display screen of the input device 1 and connecting the input terminal element and the test pattern output element in accordance with an instruction input from the input device 1, the control processing code automatic generation means 22 Describes the specifications of the unit test data output process for the source code of the control block diagram representing the generated control program.

図6は、図2の制御ブロック図から生成されるソースコードに対する、単体テスト用データ出力処理を記述した例である。図6中の301はテストパターン保存要素を表現したものである。また、入力端子要素108、109は、図2の制御ブロック図における変数出力端子要素108、109に対応する入力端子要素を表現したものである。図6のテストパターン保存要素301の場合、2つの入力端子を備えている。なお、この入力端子の数は、テストパターン保存要素301の属性として設定できるようになっている。   FIG. 6 is an example in which unit test data output processing is described for the source code generated from the control block diagram of FIG. Reference numeral 301 in FIG. 6 represents a test pattern storage element. The input terminal elements 108 and 109 represent input terminal elements corresponding to the variable output terminal elements 108 and 109 in the control block diagram of FIG. In the case of the test pattern storage element 301 of FIG. 6, two input terminals are provided. Note that the number of input terminals can be set as an attribute of the test pattern storage element 301.

そして、利用者が入力装置1を操作し、テストパターン保存要素301の各入力端子in1及びin2のそれぞれと、図2の制御ブロック図における各変数出力端子要素108、109に対応するこれらと同名の入力端子要素108、109とを接続する操作を行うことにより、図2の制御ブロック図における各変数出力端子要素108、109と、テストパターン保存要素301の各入力端子in1、in2とを、図6中の入力端子要素108、109を介して対応付けている。   Then, when the user operates the input device 1, each of the input terminals in1 and in2 of the test pattern storage element 301 has the same name as those corresponding to the variable output terminal elements 108 and 109 in the control block diagram of FIG. By performing an operation of connecting the input terminal elements 108 and 109, the variable output terminal elements 108 and 109 in the control block diagram of FIG. 2 and the input terminals in1 and in2 of the test pattern storage element 301 are changed to FIG. The input terminal elements 108 and 109 are associated with each other.

図1に戻って、制御処理コード自動生成手段22の出力パターン保存コード自動生成手段22bは、出力パターン保存要素記述手段21bにより生成された図6に示す、テストパターン出力要素301と入力端子要素108、109との接続関係を、単体テスト用データ出力関数に変換する。図7は、図6の接続関係をもとに生成された単体テスト用データ出力関数の例である。この例では、配列out_pattern[]に、変数出力端子要素108、109に相当する変数の値を格納するコードを、関数test_output()として生成している。   Returning to FIG. 1, the output pattern storage code automatic generation means 22b of the control processing code automatic generation means 22 includes the test pattern output element 301 and the input terminal element 108 shown in FIG. 6 generated by the output pattern storage element description means 21b. , 109 is converted into a unit test data output function. FIG. 7 is an example of a unit test data output function generated based on the connection relationship of FIG. In this example, a code for storing values of variables corresponding to the variable output terminal elements 108 and 109 in the array out_pattern [] is generated as a function test_output ().

以上により、利用者は、制御ブロック図仕様記述手段21によって所望の制御仕様を制御ブロック図として記述すると同時に、単体テスト用のデータ入出力を実現するための処理も記述することにより、作成したい制御プログラムのソースコードと共に、作成した制御プログラムに対する単体テスト用のデータ入出力を実現するための処理を行う入出力処理プログラムのソースコードを自動生成することができことになる。
なお、この例のようにデータ入出力の処理をブロック図で記述するテストパターン入力要素記述手段21aおよび出力パターン保存要素記述手段21bは一例である。例えば、テストパターン入力および出力に対応付けする端子名を図8に示すような設定画面で設定する構成としてもよい。
As described above, the user can write a desired control specification as a control block diagram by the control block diagram specification description means 21 and at the same time describe a process for realizing data input / output for unit testing, thereby creating a control program to be created. The source code of the input / output processing program that performs processing for realizing data input / output for unit testing with respect to the created control program can be automatically generated.
Note that, as in this example, the test pattern input element description unit 21a and the output pattern storage element description unit 21b that describe data input / output processing in a block diagram are merely examples. For example, the terminal name associated with the test pattern input and output may be set on a setting screen as shown in FIG.

つまり、図8に示すような、“テストの設定”画面を入力装置1の表示画面に表示し、利用者が“テストの設定”画面において操作することにより、図4及び図6の接続関係を記述できるようにしてもよい。すなわち、図8に示すように、テストパターンの入力端子及び出力端子として任意数の端子を用意する。これら各入力端子及び出力端子は、前記図4のテストパターン入力要素201の出力端子の数として設定された数及び図6のテストパターン保存要素301の入力端子の数として設定された数に対応してそれぞれ設定可能になっている。
図4の場合、テストパターン入力要素201の出力端子数は“4”、図6の場合、テストパターン保存要素301の入力端子数は“2”であるため、図8に示すテストの設定画面では、テストパターンの入力端子は1から4までが設定可能となり、テストパターンの出力端子は1から2までが設定可能となっている。
That is, as shown in FIG. 8, a “test setting” screen is displayed on the display screen of the input device 1, and the user operates the “test setting” screen to change the connection relationship of FIGS. 4 and 6. It may be possible to describe. That is, as shown in FIG. 8, an arbitrary number of terminals are prepared as input terminals and output terminals of the test pattern. Each of these input terminals and output terminals corresponds to the number set as the number of output terminals of the test pattern input element 201 in FIG. 4 and the number set as the number of input terminals of the test pattern storage element 301 in FIG. Can be set individually.
In the case of FIG. 4, the number of output terminals of the test pattern input element 201 is “4”, and in the case of FIG. 6, the number of input terminals of the test pattern storage element 301 is “2”. The input terminal of the test pattern can be set from 1 to 4, and the output terminal of the test pattern can be set from 1 to 2.

そして、図8の“テストの設定”画面において、テストパターンの入力端子1〜4のそれぞれにおいて、図2の入力端子要素101〜104に対応する各信号in_x〜in_wの何れかを選択可能に構成する。そして、利用者が“テストの設定”画面において、各テストパターンの入力端子1〜4のそれぞれについて、図2の入力端子要素101〜104に対応する各信号in_x〜in_wの何れかを選択することによりテストパターンの入力端子1〜4のそれぞれと、図2の入力端子要素101〜104に対応する各信号in_x〜in_wとがそれぞれ対応付けられるようになっている。   Then, on the “test setting” screen of FIG. 8, each of the input terminals 1 to 4 of the test pattern can select any of the signals in_x to in_w corresponding to the input terminal elements 101 to 104 of FIG. To do. The user selects one of the signals in_x to in_w corresponding to the input terminal elements 101 to 104 in FIG. 2 for each of the input terminals 1 to 4 of each test pattern on the “test setting” screen. Thus, each of the test pattern input terminals 1 to 4 is associated with each of the signals in_x to in_w corresponding to the input terminal elements 101 to 104 of FIG.

同様に、“テストの設定”画面のテストパターンの出力端子1及び2において、図2の出力端子要素108、109に対応する各信号out_a、out_bの何れかを選択可能に構成する。そして、利用者が、“テストの設定”画面において、各テストパターンの出力端子1、2のそれぞれについて、図2の出力端子要素108、109に対応する各信号out_a、out_bの何れかを選択することによりテストパターンの出力端子1、2のそれぞれと、図2の出力端子要素108、109に対応する各信号out_a、out_bとが対応付けられるようになっている。   Similarly, either one of the signals out_a and out_b corresponding to the output terminal elements 108 and 109 in FIG. 2 can be selected at the test pattern output terminals 1 and 2 on the “test setting” screen. Then, the user selects one of the signals out_a and out_b corresponding to the output terminal elements 108 and 109 in FIG. 2 for each of the output terminals 1 and 2 of each test pattern on the “test setting” screen. Thus, each of the output terminals 1 and 2 of the test pattern is associated with the signals out_a and out_b corresponding to the output terminal elements 108 and 109 in FIG.

そして、“テストの設定”画面において、設定完了を指示する“OK”が指示されたとき、図4のテストパターン入力要素の出力端子out1と入力端子1に割りつけられた信号in_xとが対応付けられたと判断し、同様に、出力端子out2〜out4のそれぞれと入力端子2〜4のそれぞれに割りつけられた信号in_y〜in_wとがそれぞれ対応付けられたと判断する。同様に、図6の出力パターン保存要素301の入力端子in1と出力端子1に割りつけられたout_aとが対応付けられ、入力端子in2と出力端子2に割りつけられたout_bとが対応付けられたと判断する。   When “OK” instructing the completion of setting is instructed on the “test setting” screen, the output terminal out1 of the test pattern input element in FIG. 4 and the signal in_x assigned to the input terminal 1 are associated with each other. Similarly, it is determined that each of the output terminals out2 to out4 and the signals in_y to in_w assigned to the input terminals 2 to 4 are associated with each other. Similarly, the input terminal in1 of the output pattern storage element 301 in FIG. 6 is associated with the out_a assigned to the output terminal 1, and the input terminal in2 and the out_b assigned to the output terminal 2 are associated with each other. to decide.

このように、図8の“テストの設定”画面において、接続関係を設定することによっても、図4及び図6と同等の接続関係が設定されることになる。
図1に戻って、制御処理コード自動生成手段22のテストドライバコード自動生成手段22cは、予め設定されたテストドライバの雛形(以下、雛形テストドライバという。)23を表すソースコードと、動作検証対象の制御プログラムのソースコードと、そのテストを行うためのテスト入出力用プログラムのソースコードと、入力装置1により設定される動作環境諸元とに基づきテストドライバのソースコードを生成する。
In this way, by setting the connection relationship on the “test setting” screen in FIG. 8, the same connection relationship as in FIGS. 4 and 6 is set.
Returning to FIG. 1, the test driver code automatic generation means 22c of the control processing code automatic generation means 22 includes a source code representing a preset test driver template (hereinafter referred to as a template test driver) 23, and an operation verification target. The test driver source code is generated based on the source code of the control program, the source code of the test input / output program for performing the test, and the operating environment specifications set by the input device 1.

例えば、作成した制御プログラムを、図9(a)に示す、商用電源を所定の電源電圧に変換する電源装置50に適用するものとする。この電源装置50は、AC−DC変換などを行うスイッチング素子を含んで構成される変換器51とこの変換器51のスイッチング素子をオンオフ制御する演算装置52とから構成される。制御プログラムは演算装置52に組み込まれ、各種センサ信号等をもとに所定の処理を行って、変換器51を構成するスイッチング素子をオンオフ制御するためのオンオフ信号等を生成しこれを出力する。   For example, it is assumed that the created control program is applied to a power supply apparatus 50 that converts a commercial power supply into a predetermined power supply voltage shown in FIG. The power supply device 50 includes a converter 51 that includes a switching element that performs AC-DC conversion and the like, and an arithmetic unit 52 that controls on / off of the switching element of the converter 51. The control program is incorporated in the arithmetic unit 52, performs predetermined processing based on various sensor signals and the like, generates an on / off signal for on / off control of the switching elements constituting the converter 51, and outputs this.

この演算装置52に組み込まれる、変換器51をオンオフ制御するための制御プログラムのテストプログラムの場合、例えば、図9(b)に示すように、動作検証対象の制御プログラムに対して、この制御プログラムが実際に組み込まれるマイクロコンピュータ等の演算装置の動作環境でテストパターンを入力させ、その結果を出力パターンとして取り出し、比較等を行うテストドライバのソースコードを生成する。つまり、テストドライバは、制御プログラムに対しテストパターンを入力すると共にテストパターンに対する処理結果を取り出し、処理結果と予め設定した期待値とを比較すること等により、制御プログラムが開発者の要求する仕様通りに動作しているかを判定し、その判定結果を出力する。   In the case of a test program of a control program for on / off control of the converter 51 incorporated in the arithmetic device 52, for example, as shown in FIG. A test pattern is input in the operating environment of a computing device such as a microcomputer that is actually incorporated, and the result is taken out as an output pattern to generate a source code of a test driver that performs comparison and the like. In other words, the test driver inputs a test pattern to the control program, retrieves the processing result for the test pattern, compares the processing result with a preset expected value, etc., so that the control program conforms to the specifications required by the developer. It is determined whether it is operating, and the determination result is output.

前記雛形テストドライバ23は、動作検証対象の制御プログラムが組み込まれる演算装置に依存する動作環境に則して生成される。また、雛形テストドライバ23は、演算装置の種類や、動作検証内容等に応じて予め複数設定されて、所定の記憶領域に記憶されている。
前記動作環境諸元は、例えば、図9(a)の電源装置50の場合、演算装置52と、この演算装置52により駆動制御される変換器51とからなる電源装置50全体に依存して決定される演算装置52の動作環境のパラメータであって、例えば図10に示すようなパラメータがある。
The template test driver 23 is generated in accordance with the operating environment depending on the arithmetic device in which the operation verification target control program is incorporated. In addition, a plurality of model test drivers 23 are set in advance according to the type of arithmetic device, the contents of operation verification, and the like, and are stored in a predetermined storage area.
For example, in the case of the power supply device 50 in FIG. 9A, the operating environment specifications are determined depending on the entire power supply device 50 including the arithmetic device 52 and the converter 51 that is driven and controlled by the arithmetic device 52. For example, there are parameters as shown in FIG.

すなわち、前記制御プログラムが実際に組み込まれる演算装置の動作環境を模擬するための実行環境構築に必要な情報(実行環境構築(OS/モニタプログラム))、テストパターンの格納場所に関する情報(テストパターン格納場所割り付け)、繰り返し実行する際の方法(繰り返し実行手段選択)、テストパターンに対する期待値の格納場所に関する情報(期待値パターン格納場所割り付け)、テストパターンに対する応答値と期待値とに基づく判定結果の通知に関する情報(判定結果通知手段選択)等が大項目としてある。   That is, information (execution environment construction (OS / monitor program)) necessary for constructing an execution environment for simulating the operating environment of the arithmetic device in which the control program is actually incorporated, information on the test pattern storage location (test pattern storage) Location assignment), method for repeated execution (repeated execution means selection), information on the storage location of the expected value for the test pattern (expected value pattern storage location allocation), and the determination result based on the response value and the expected value for the test pattern Information relating to notification (selection of determination result notification means) and the like are major items.

前記“実行環境構築(OS/モニタプログラム)”は、中項目として、“ハードウェアコンフィグレーション”及び“OSコンフィグレーション”がある。“ハードウェアコンフィグレーション”としては、“定周期タイマ設定”として、「使用する/しない、カウント周期、カウントクロック周波数、等」があり、“I/Oポート設定”として「使用する/しない、入力/出力」等があり、“通信設定”として「使用する/しない、通信方式、通信速度、等」があり、“割り込み設定”として「使用する/しない、発生時の呼出ハンドラ、等」がある。また、“OSコンフィグレーション”としては、タスク定義があり「周期動作タスク、アイドルタスク、割り込みタスク、等」がある。   The “execution environment construction (OS / monitor program)” includes “hardware configuration” and “OS configuration” as intermediate items. “Hardware configuration” includes “Use / do not use, count cycle, count clock frequency, etc.” as “Fixed cycle timer setting”, and “Use / do not use, input” as “I / O port setting” "Communication settings" includes "Use / Do not use, communication method, communication speed, etc.", and "Interrupt settings" include "Use / do not use, call handler when generated, etc." . “OS configuration” includes task definition and “periodic operation task, idle task, interrupt task, etc.”.

また、“テストパターン格納場所割付”は、中項目として例えば“メモリマッピング”であるか否かが設定されるようになっている。
また、“繰り返し実行手段選択”としては、中項目として“連続実行タスク上でループ”、“定周期タスク上で実行”、割り込みタスク上で実行”の何れかが選択されるようになっており、“定周期タスク上で実行”する場合には、その「実行周期」が設定されるようになっている。
In addition, “test pattern storage location allocation” is set as an intermediate item, for example, whether it is “memory mapping” or not.
In addition, as the “repeated execution means selection”, one of “loop on continuous execution task”, “execution on fixed-cycle task”, and “execution on interrupt task” is selected as the middle item. In the case of “execution on a fixed-cycle task”, the “execution cycle” is set.

また、“期待値パターン格納場所割付”としては、中項目として例えば“メモリマッピング”であるか否かが設定されるようになっている。
また、“判定結果通知手段選択”としては、中項目として“I/Oポート”、“通信”、“表示(液晶、ドットマトリクス等)”があり、これらの何れかを選択するようになっており、“通信”の場合には「通信プロトコル設定(実行コマンド内容の定義)」、“表示(液晶、ドットマトリクス等)”の場合には「表示デバイスとのI/F設定(デバイスとの間のデータ授受方式、データフォーマット)」等が設定されるようになっている。
In addition, as “expected value pattern storage location allocation”, for example, “memory mapping” is set as an intermediate item.
In addition, as the “determination result notification means selection”, there are “I / O port”, “communication”, “display (liquid crystal, dot matrix, etc.)” as intermediate items, and any one of these can be selected. In the case of “communication”, “communication protocol setting (definition of execution command contents)”, and in the case of “display (liquid crystal, dot matrix, etc.)” “I / F setting with display device (between devices) Data transmission / reception system, data format) ", and the like.

そして、テストドライバコード自動生成手段22cは、利用者が入力装置1を操作することにより、作成した制御プログラムの組み込み対象の演算装置に対応した雛形テストドライバを選択し、さらに動作環境諸元の各パラメータを入力すると、入力された動作環境諸元と、選択された雛形テストドライバとから、入力された動作環境諸元に応じた動作環境を実現するテストドライバを生成する。   Then, the test driver code automatic generation means 22c selects a template test driver corresponding to the arithmetic device to be incorporated into the created control program by operating the input device 1 by the user, and each of the operating environment specifications. When the parameters are input, a test driver that realizes an operating environment according to the input operating environment specifications is generated from the input operating environment specifications and the selected template test driver.

さらに、例えば、雛形テストドライバが、図11に示すように、制御処理関数(図3の場合、関数function())と、単体テスト用データ入出力関数(図5、図7の場合、関数test_input()およびtest_output())とを順次呼び出して、予め定められたテストパターンを入力として与えた場合の出力結果を期待値と比較し、制御処理関数の動作を検証するという内容の動作検証を行うように設定されている場合には、制御処理コード自動生成手段22で生成された制御プログラムのソースコードの格納先及び、テストパターン入力コード自動生成手段22a、出力パターン保存コード自動生成手段22bで生成された、単体テスト用データ入出力関数を表すテストパターン入力コード及び出力パターン保存コードの格納先、を雛形テストドライに組み込み、図11に示す動作検証処理を、指定された雛形テストドライバ及び入力された動作環境諸元下で実現するテストドライバのソースコードを生成する。   Further, for example, as shown in FIG. 11, the template test driver has a control processing function (function function () in the case of FIG. 3) and unit test data input / output function (in the case of FIGS. 5 and 7, the function test_input ( ) And test_output ()) are called in sequence, the output result when a predetermined test pattern is given as an input is compared with the expected value, and the operation verification is performed to verify the operation of the control processing function. Is set by the control processing code automatic generation means 22, the test pattern input code automatic generation means 22a, and the output pattern storage code automatic generation means 22b are generated. In addition, the test pattern input code representing the unit test data input / output function and the storage location of the output pattern storage code are incorporated in the template test dry. Operation verification processing shown, for generating a source code of the test driver to implement under the given template test driver and the input operating environment specifications.

図11のテストドライバのソースコードの処理フローにおいて、単体テストでは、動作を検証するためのテストパターンを複数組与えるのが通常であるので、テストドライバは保存領域からテストパターンを1組ずつ読出して与えることを、パターンがなくなるまで繰り返す構造になっている。なお、図11における入力パターン保存領域に格納されている入力パターンは、定数テーブル定義の形で予めテストドライバのソースコードに埋め込まれる形態でもいいし、ファイル形式でハードディスクなどの記憶媒体に記録されているものを実行時に読み出すような形態でもいい。比較のための期待値パターンの形態についても同様である。   In the processing flow of the source code of the test driver of FIG. 11, in the unit test, it is normal to provide a plurality of test patterns for verifying the operation. Therefore, the test driver reads and provides the test patterns one by one from the storage area. This structure is repeated until the pattern disappears. Note that the input pattern stored in the input pattern storage area in FIG. 11 may be embedded in the test driver source code in the form of a constant table definition in advance, or may be recorded in a storage medium such as a hard disk in a file format. It is also possible to read what is being read at runtime. The same applies to the form of the expected value pattern for comparison.

図11に示すテストドライバコードの処理フローでは、まず、ステップS1で入力パターン保存領域から入力パターンを読み出し、読み出した入力パターンを、入力変数として単体テスト用データ入力関数test_input()(ステップS2)、制御処理関数function()(ステップS3)、単体テスト用データ出力関数test_output()(ステップS4)を順次読み出して実行する。これにより、読み出した入力パターンが、制御処理関数function()で実行され、その実行結果が出力パターンとして、所定の記憶領域に保存される。   In the process flow of the test driver code shown in FIG. 11, first, an input pattern is read from the input pattern storage area in step S1, and the read input pattern is used as a unit test data input function test_input () (step S2) and control. The processing function function () (step S3) and the unit test data output function test_output () (step S4) are sequentially read and executed. As a result, the read input pattern is executed by the control processing function function (), and the execution result is saved as an output pattern in a predetermined storage area.

そして、この所定の記憶領域に保存された出力パターンを、予め設定された出力パターン領域に書き出す(ステップS5)。これによって、一の入力パターンに対する出力パターンが得られることになる。
そして、設定された入力パターンがなくまるまで、ステップS1からステップS5までの処理を繰り返し行うことにより、各入力パターンそれぞれについて制御処理関数function()による処理が実行され、その演算結果が出力パターンとして出力パターン領域に記憶される。
Then, the output pattern stored in the predetermined storage area is written in a preset output pattern area (step S5). As a result, an output pattern for one input pattern is obtained.
Then, by repeating the processing from step S1 to step S5 until the set input pattern is eliminated, the processing by the control processing function function () is executed for each input pattern, and the calculation result is output as the output pattern. Stored in the output pattern area.

全ての入力パターンに対する処理が終了した後、ステップS6からステップS7に移行し、出力パターン領域に記憶された出力パターンと、予め設定された期待値パターンとを比較して、その比較結果から、制御処理プログラムの合否判定を行う。そして、合否判定結果を、テストドライバ作成諸元で指定された手段により外部に通知する。
図12は、プログラム自動生成装置2の処理手順の一例を示すフローチャートである。
プログラム自動生成装置2は、入力装置1での利用者の仕様記述に応じて制御ブロック図を表示画面上に記述する処理を行い(ステップS11)、利用者による制御ブロック図の生成が終了すると、生成された制御ブロック図に応じた制御処理コードを作成する(ステップS12)。
After the processing for all the input patterns is completed, the process proceeds from step S6 to step S7, the output pattern stored in the output pattern area is compared with a preset expected value pattern, and the control is performed based on the comparison result. The pass / fail judgment of the processing program is performed. Then, the pass / fail judgment result is notified to the outside by means designated by the test driver creation specifications.
FIG. 12 is a flowchart illustrating an example of a processing procedure of the automatic program generation device 2.
The automatic program generation device 2 performs a process of describing the control block diagram on the display screen according to the specification description of the user in the input device 1 (step S11), and when the generation of the control block diagram by the user is completed, A control processing code corresponding to the generated control block diagram is created (step S12).

次に、テストパターン入力要素と制御ブロック図の入力端子とを表示画面に表示して、これらの対応付けを利用者に促すための表示を行うと共に、入力装置1による利用者の対応付け操作に応じた表示を行い(ステップS13)、利用者により行われた対応付けに応じたテストパターン入力コードを生成する(ステップS14)。
次に、出力パターン依存要素と制御ブロック図の出力端子とを表示画面に表示して、これらの対応付けを利用者に促すための表示を行うと共に、入力装置1による利用者の対応付け操作に応じた表示を行い(ステップS15)、利用者により行われた対応付けに応じた出力パターン保存コードを生成する(ステップS15)。
次に、利用者が入力装置1を操作することにより選択された雛形テストドライバと、動作環境諸元とを読み込み、選択された雛形テストドライバと、動作環境諸元と、制御ブロック図に応じた制御プログラムのソースコード、テストパターン入力コード、出力パターン保存コードに基づき、テストドライバのソースコードを生成する。
Next, the test pattern input element and the input terminal of the control block diagram are displayed on the display screen, and a display for prompting the user to associate them is performed. A corresponding display is performed (step S13), and a test pattern input code corresponding to the association performed by the user is generated (step S14).
Next, the output pattern dependent element and the output terminal of the control block diagram are displayed on the display screen, and a display for prompting the user to associate them is performed. A corresponding display is performed (step S15), and an output pattern storage code corresponding to the association performed by the user is generated (step S15).
Next, the template test driver selected by the user operating the input device 1 and the operating environment specifications are read, and the selected template test driver, the operating environment specifications, and the control block diagram are used. The test driver source code is generated based on the control program source code, test pattern input code, and output pattern storage code.

このようにして生成されたテストドライバのソースコードを利用して、制御プログラムの単体テストを行う場合には、テストドライバのソースコード、すなわち、テストドライバを含む制御プログラムのソースコードを、この制御プログラムの組み込み対象の演算装置に組み込み、演算装置単体でこのソースコードを実行させる。すなわち、図9(a)の電源装置50の場合には、テストドライバを含む制御プログラムのソースコードを演算装置52に組み込む。これによって、演算装置52では、図11のフローチャートに示す手順でテスト用入力パターンを順次読み出して動作検証対象の制御プログラムを実行し、その結果と、予め設定された期待値とから単体テストにおける合否判定を行い、その結果を通知する。   When performing a unit test of a control program using the test driver source code generated in this way, the test driver source code, that is, the source code of the control program including the test driver, is stored in the control program. The source code is executed by the arithmetic device alone by incorporating it into the arithmetic device to be incorporated. That is, in the case of the power supply device 50 of FIG. 9A, the source code of the control program including the test driver is incorporated into the arithmetic device 52. As a result, the arithmetic unit 52 sequentially reads out the test input patterns in accordance with the procedure shown in the flowchart of FIG. 11 and executes the control program to be verified for operation, and determines pass / fail in the unit test from the result and the preset expected value. And notify the result.

利用者は、通知された結果を参照することによって、制御プログラムが要求する仕様通りの動作を行うかどうかを確認することができる。
なお、テストドライバを含む制御プログラムは、電源装置50全体を稼働させる場合には、例えば、テストドライバとして動作するための処理を行う機能部分を制御プログラムから切り離した状態となるように構成され、制御プログラム単体として動作するように構成されている。
また、図10に示す動作環境諸元を設定することにより、この動作環境諸元で特定される動作環境を実現するテストドライバを作成することができるため、制御プログラムの実際の動作環境と同等の動作環境下で制御プログラムの単体テストを行うことができる。
By referring to the notified result, the user can confirm whether or not the operation according to the specification requested by the control program is performed.
Note that the control program including the test driver is configured so that, for example, the functional part that performs processing for operating as the test driver is separated from the control program when the entire power supply device 50 is operated. It is configured to operate as a single program.
In addition, by setting the operating environment specifications shown in FIG. 10, it is possible to create a test driver that realizes the operating environment specified by the operating environment specifications, so that it is equivalent to the actual operating environment of the control program. A unit test of the control program can be performed under the operating environment.

また、このとき、利用者は、単に例えば図10に示す動作環境諸元を設定するだけで、組み込み対象の演算装置52及び電源装置50に依存する動作環境を実現するテストドライバのソースコードを生成することができるため、このソースコードを、組み込み対象の演算装置に組み込むだけで、実際の動作環境と同等の動作環境下において、演算装置単体での、制御プログラムの単体テストを行うことができる。
そのため、単体テストを行う段階で、テストドライバを作成する等の作業を行う必要はなく、その分単体テストを行う際の所要時間の短縮を図ることができると共に、テストドライバを作成する必要がないため、テストドライバを作成するための知識を持たない人であっても、動作環境諸元を設定するだけで、単体テストを容易に行うことができる。
At this time, the user simply generates the operating environment specifications shown in FIG. 10, for example, and generates the test driver source code that realizes the operating environment depending on the arithmetic device 52 and the power supply device 50 to be incorporated. Therefore, only by incorporating this source code into the computing device to be incorporated, a unit test of the control program can be performed on the computing device alone in an operating environment equivalent to the actual operating environment.
Therefore, it is not necessary to create a test driver at the stage of unit testing, and it is possible to shorten the time required for unit testing, and it is not necessary to create a test driver. Even those who do not have the knowledge to create test drivers can easily perform unit tests simply by setting operating environment specifications.

また、雛形テストドライバ23を、組み込み対象の演算装置に応じて複数設定し、且つ雛形テストドライバ23は演算装置のみに依存する動作環境を考慮して生成し、さらに、組み込み対象の演算装置を含む電源装置50に依存する動作環境諸元については、制御プログラム作成時に利用者が設定するようになっている。そのため、組み込み対象の演算装置として想定される、複数の種類の異なる演算装置に応じて雛形テストドライバを予め作成しておくことによって、例えば、雛形テストドライバに対応する演算装置を組み込み対象とする制御プログラムであれば、この制御プログラムを作成する際に、この制御プログラムが組み込まれる演算装置に対応する雛形テストドライバを選択し、且つこの演算装置を含む電源装置などの制御装置に依存する動作環境諸元を利用者が入力設定することによって、テストドライバを含んだ制御プログラムのソースコードを容易に作成することができる。   Also, a plurality of template test drivers 23 are set according to the computing device to be incorporated, and the template test driver 23 is generated in consideration of an operating environment that depends only on the computing device, and further includes the computing device to be incorporated. The operating environment specifications depending on the power supply device 50 are set by the user when the control program is created. Therefore, by creating a template test driver in advance according to a plurality of different types of computing devices that are assumed to be incorporated, for example, control that incorporates the computing device corresponding to the template test driver. If it is a program, when the control program is created, a model test driver corresponding to the arithmetic device in which the control program is incorporated is selected, and various operating environment dependent on the control device such as a power supply device including the arithmetic device are selected. When the user inputs and sets the source, the source code of the control program including the test driver can be easily created.

なお、上記実施の形態においては、電源装置の制御プログラムに適用した場合について説明したが、これに限るものではなく、制御対象装置を駆動制御するための演算装置に組み込まれる制御対象装置駆動制御用のプログラムであって、制御対象装置及び演算装置に依存する動作環境下で動作する制御プログラムであれば適用することができる。
また、上記実施の形態においては、図11に示すように、制御処理関数(図3の場合、関数function())と、単体テスト用データ入出力関数(図5、図7の場合、関数test_input()およびtest_output())とを順次呼び出して、あらかじめ定められたテストパターンを入力として与えた場合の出力結果を期待値と比較し、制御処理関数の動作を検証するという内容の動作検証を行うためのテストドライバを作成する場合について説明したが、これに限るものではなく、他の動作により動作検証を行うテストドライバを作成することも可能である。
In the above-described embodiment, the case where the present invention is applied to the control program for the power supply device has been described. However, the present invention is not limited to this, and for the control target device drive control incorporated in the arithmetic device for driving and controlling the control target device. Any control program that operates under an operating environment that depends on the device to be controlled and the arithmetic device can be applied.
In the above embodiment, as shown in FIG. 11, the control processing function (function function () in the case of FIG. 3) and the unit test data input / output function (in the case of FIGS. 5 and 7, the function test_input ( ) And test_output ()) are called in order to compare the output result when given a predetermined test pattern as an input with the expected value and verify the operation of the control processing function. However, the present invention is not limited to this, and it is also possible to create a test driver that performs operation verification by other operations.

また、上記実施の形態においては、テストドライバにおいて、期待値と比較し制御プログラムの動作検証結果の合否を判定する場合について説明したが、これに限るものではなく、単に、テストパターン入力に対する制御プログラムの出力データを例えば、画面表示したり外部に通信回線を介して送信したりすることにより、利用者に出力データを通知し、利用者が出力データをもとに合否判断を行うように構成してもよい。   In the above-described embodiment, the case has been described in which the test driver determines whether or not the operation verification result of the control program is acceptable by comparing with the expected value. However, the present invention is not limited to this. The output data is displayed on the screen or sent to the outside via a communication line, for example, so that the user is notified of the output data, and the user makes a pass / fail decision based on the output data. May be.

また、上記実施の形態においては、雛形テストドライバを複数備える場合について説明したが、これに限るものではなく、一の演算装置に対応する雛形テストドライバのみを備えた場合であっても適用することができ、ある演算装置専用のテストドライバのソースコードを作成するようにすることも可能である。
また、上記実施の形態においては、制御プログラムを作成する際に、テストドライバを作成する場合について説明したが、これに限るものではない。例えば、制御プログラムの制御ブロック図を予め作成しておく場合であっても適用することができる。この場合には、制御ブロック図を読み出した後、この制御ブロック図に対して、テストパターン入力要素及び出力パターン保存要素による対応付けを行い、以後、上記と同様の処理を行う構成とすればよい。
In the above embodiment, the case where a plurality of template test drivers are provided has been described. However, the present invention is not limited to this, and the present invention is applicable even when only a template test driver corresponding to one arithmetic device is provided. It is also possible to create a test driver source code dedicated to a certain arithmetic unit.
In the above embodiment, the case where the test driver is created when creating the control program has been described. However, the present invention is not limited to this. For example, the present invention can be applied even when a control block diagram of a control program is created in advance. In this case, after the control block diagram is read, the control block diagram is associated with the test pattern input element and the output pattern storage element, and thereafter, the same processing as described above may be performed. .

ここで、上記実施の形態において、図12のステップS13の処理がテストパターン入力対応付け手段に対応し、ステップS15の処理が出力パターン対応付け手段に対応し、ステップS14の処理がテストパターン入力コード自動生成手段に対応し、ステップS16の処理が出力パターン保存コード自動生成手段に対応し、雛形テストドライバ23がテストドライバの雛形に対応し、ステップS17の処理で入力装置1により入力された動作環境諸元を読み込む処理が動作環境諸元入力手段に対応している。   Here, in the above embodiment, the process of step S13 in FIG. 12 corresponds to the test pattern input association means, the process of step S15 corresponds to the output pattern association means, and the process of step S14 is the test pattern input code. Corresponding to the automatic generation means, the processing in step S16 corresponds to the output pattern storage code automatic generation means, the template test driver 23 corresponds to the test driver template, and the operating environment input by the input device 1 in the processing in step S17. The process of reading the specifications corresponds to the operating environment specification input means.

1 入力装置
2 プログラム自動生成装置
21 制御ブロック図仕様記述手段
21a テストパターン入力要素記述手段
21b 出力パターン保存要素記述手段
22 制御処理コード自動生成手段
22a テストパターン入力コード自動生成手段
22b 出力パターン保存コード自動生成手段
22c テストドライバコード自動生成手段
23 雛形テストドライバ
101〜104 変数入力端子要素
105〜107 演算要素
108、109 変数出力端子要素
201 テストパターン入力要素
301 出力パターン保存要素
DESCRIPTION OF SYMBOLS 1 Input device 2 Program automatic generation apparatus 21 Control block diagram specification description means 21a Test pattern input element description means 21b Output pattern storage element description means 22 Control processing code automatic generation means 22a Test pattern input code automatic generation means 22b Output pattern storage code automatic Generating means 22c Test driver code automatic generating means 23 Template test drivers 101 to 104 Variable input terminal elements 105 to 107 Arithmetic elements 108 and 109 Variable output terminal elements 201 Test pattern input element 301 Output pattern storage element

Claims (3)

変数入力端子要素、変数出力端子要素及び演算要素間を接続することで一の制御プログラムによる制御処理の流れを表現する制御ブロック図からコンパイル可能なソースコードを生成するプログラム自動生成装置において、
前記制御ブロック図の変数入力端子要素と当該変数入力端子要素に入力するテストパターンとの対応付けを行うテストパターン入力対応付け手段と、
前記制御ブロック図の変数出力端子要素と当該変数出力端子要素から出力される出力パターンの保存先との対応付けを行う出力パターン対応付け手段と、
対応付けられた前記変数入力端子要素及び前記テストパターンに基づき、前記制御ブロック図の前記変数入力端子要素に前記対応付けられた前記テストパターンを入力するソースコードをテストパターン入力コードとして生成するテストパターン入力コード自動生成手段と、
対応付けられた前記変数出力端子要素及び前記出力パターンの保存先に基づき、前記制御ブロック図の前記変数出力端子要素の出力を読み出して当該出力を前記対応付けられた前記出力パターンの保存先に保存するソースコードを出力パターン保存コードとして生成する出力パターン保存コード自動生成手段と、
予め記憶領域に格納された、前記一の制御プログラムを組み込む演算装置による当該制御プログラムの単体テストに用いるテストドライバの雛形と、
前記一の制御プログラムの動作環境を特定する動作環境諸元を入力する動作環境諸元入力手段と、
前記テストドライバの雛形と、前記動作環境諸元入力手段で入力された動作環境諸元と、前記テストパターン入力コード及び前記出力パターン保存コードと、前記一の制御プログラムのソースコードとから、前記単体テストのテストドライバのソースコードを生成するテストドライバコード自動生成手段と、
を備えることを特徴とするプログラム自動生成装置。
In an automatic program generation device that generates a compilable source code from a control block diagram that represents a flow of control processing by a single control program by connecting variable input terminal elements, variable output terminal elements, and arithmetic elements,
Test pattern input associating means for associating the variable input terminal element of the control block diagram with the test pattern input to the variable input terminal element;
Output pattern associating means for associating the variable output terminal element of the control block diagram with the storage destination of the output pattern output from the variable output terminal element;
A test pattern that generates, as a test pattern input code, source code for inputting the associated test pattern to the variable input terminal element of the control block diagram based on the associated variable input terminal element and the test pattern An input code automatic generation means;
Based on the associated variable output terminal element and the storage destination of the output pattern, the output of the variable output terminal element in the control block diagram is read and the output is stored in the storage destination of the associated output pattern Output pattern storage code automatic generation means for generating source code to be output as output pattern storage code
A test driver model stored in advance in a storage area and used for unit testing of the control program by an arithmetic unit incorporating the one control program;
Operating environment specification input means for inputting operating environment specifications for specifying the operating environment of the one control program;
From the test driver template, the operating environment specifications input by the operating environment specification input means, the test pattern input code and the output pattern storage code, and the source code of the one control program, the unit test Test driver code automatic generation means for generating the source code of the test driver,
An automatic program generation device comprising:
前記テストドライバの雛形は、複数の種類の異なる前記演算装置それぞれに対応して生成され、
前記テストドライバコード自動生成手段は、前記複数のテストドライバの雛形のうち、指定されたテストドライバの雛形を用いて前記テストドライバのソースコードを生成することを特徴とする請求項1記載のプログラム自動生成装置。
The test driver template is generated corresponding to each of a plurality of different types of arithmetic devices,
2. The program automatic generation according to claim 1, wherein the test driver code automatic generation unit generates a source code of the test driver using a specified test driver template among the plurality of test driver templates. Generator.
前記テストパターン入力対応付け手段は、前記制御ブロック図の変数入力端子要素に前記テストパターンを与える機能を表現するテストパターン入力要素を記述する手段を有し、当該テストパターン入力要素が有する接続端子と前記変数入力端子要素とを表示することにより前記対応付けを利用者に促し、
前記出力パターン対応付け手段は、前記制御ブロック図の前記変数出力端子要素の数値を保存する機能を表現する出力パターン保存要素を記述する手段を有し、当該出力パターン保存要素が有する接続端子と前記変数出力端子要素とを表示することにより前記対応付けを利用者に促すことを特徴とする請求項1又は請求項2記載のプログラム自動生成装置。
The test pattern input associating means includes means for describing a test pattern input element that expresses a function of giving the test pattern to the variable input terminal element of the control block diagram, and a connection terminal included in the test pattern input element; By prompting the user for the association by displaying the variable input terminal element,
The output pattern association means includes means for describing an output pattern storage element that expresses a function of storing the numerical value of the variable output terminal element of the control block diagram, and the connection terminal included in the output pattern storage element and the 3. The automatic program generation apparatus according to claim 1, wherein the association is prompted to the user by displaying a variable output terminal element.
JP2010184260A 2010-08-19 2010-08-19 Automatic program generator Expired - Fee Related JP5521889B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010184260A JP5521889B2 (en) 2010-08-19 2010-08-19 Automatic program generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010184260A JP5521889B2 (en) 2010-08-19 2010-08-19 Automatic program generator

Publications (2)

Publication Number Publication Date
JP2012043216A true JP2012043216A (en) 2012-03-01
JP5521889B2 JP5521889B2 (en) 2014-06-18

Family

ID=45899434

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010184260A Expired - Fee Related JP5521889B2 (en) 2010-08-19 2010-08-19 Automatic program generator

Country Status (1)

Country Link
JP (1) JP5521889B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015001825A (en) * 2013-06-14 2015-01-05 富士電機株式会社 Testing schedule determination device, and program
CN106933566A (en) * 2017-01-24 2017-07-07 北京广利核系统工程有限公司 Graphic configuration language transfer method and device
JP2018500642A (en) * 2014-11-05 2018-01-11 アビニシオ テクノロジー エルエルシー Debug graph
CN110546605A (en) * 2017-05-31 2019-12-06 欧姆龙株式会社 Program development support device, program development support method, and program development support program

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015001825A (en) * 2013-06-14 2015-01-05 富士電機株式会社 Testing schedule determination device, and program
JP2018500642A (en) * 2014-11-05 2018-01-11 アビニシオ テクノロジー エルエルシー Debug graph
CN106933566A (en) * 2017-01-24 2017-07-07 北京广利核系统工程有限公司 Graphic configuration language transfer method and device
CN110546605A (en) * 2017-05-31 2019-12-06 欧姆龙株式会社 Program development support device, program development support method, and program development support program
CN110546605B (en) * 2017-05-31 2022-11-11 欧姆龙株式会社 Program development support device, program development support method, and storage medium

Also Published As

Publication number Publication date
JP5521889B2 (en) 2014-06-18

Similar Documents

Publication Publication Date Title
US11175895B2 (en) Code generation and simulation for graphical programming
US8788239B2 (en) Methods, apparatus and articles of manufacture to test batch configurations
KR100808257B1 (en) Apparatus and Method for prototype development of embedded system
JP2011040059A5 (en)
JP2003532168A (en) Automatic test equipment for easy programming
JP5521889B2 (en) Automatic program generator
JP6457586B2 (en) Amplifier selection device, amplifier selection method, and amplifier selection program that have the function of clearly indicating the error location at the time of incorrect selection
JP2021096637A (en) Engineering unit and development support method
WO2020039900A1 (en) Information processing apparatus and program
KR102258103B1 (en) Method for generating control program automatically and computing device for performing the method
JP6945766B1 (en) Data analysis program creation support device, data analysis program creation support method, and data analysis program creation support program
JP2018156214A (en) SFC program creation support apparatus, SFC program creation support program, and SFC program creation method
JP7404298B2 (en) Design processing method
JP7241982B1 (en) Image generation program, image generation device, programmable controller system and image generation method
JP5076785B2 (en) Plant operation planning device and program thereof
US9032365B2 (en) Script description separation reconstructing device, script description separation reconstructing method, and non-transitory computer readable medium storing script description separation reconstructing program
JP6407481B1 (en) Program creation device
JP2014103705A (en) Control logic verification device and control logic verification method
JP2007293771A (en) Simulator
JP6085264B2 (en) Controller development tool
EP2148274A1 (en) Controller development tool and motor drive system developed by the tool
JP2023084567A (en) Visualization device, visualization method and visualization program
JP2021068285A (en) Automatic code generation method, coding program, electronic control device, automatic code generation program, and automatic code generation device
KR20220118105A (en) Wireless teaching device providing interface and fucntion for intreactive teaching by operator in a collaborative robot and method thereof
JPH11306049A (en) Operation control system for computer system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20130614

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140228

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140311

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140324

R150 Certificate of patent or registration of utility model

Ref document number: 5521889

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees