JP3554651B2 - High-speed sequence control method and apparatus, program creation method - Google Patents

High-speed sequence control method and apparatus, program creation method Download PDF

Info

Publication number
JP3554651B2
JP3554651B2 JP10375997A JP10375997A JP3554651B2 JP 3554651 B2 JP3554651 B2 JP 3554651B2 JP 10375997 A JP10375997 A JP 10375997A JP 10375997 A JP10375997 A JP 10375997A JP 3554651 B2 JP3554651 B2 JP 3554651B2
Authority
JP
Japan
Prior art keywords
speed
sequence control
execution program
normal
sequence
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.)
Expired - Fee Related
Application number
JP10375997A
Other languages
Japanese (ja)
Other versions
JPH10293604A (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.)
Hitachi Ltd
Original Assignee
Hitachi 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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP10375997A priority Critical patent/JP3554651B2/en
Publication of JPH10293604A publication Critical patent/JPH10293604A/en
Application granted granted Critical
Publication of JP3554651B2 publication Critical patent/JP3554651B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、高速シーケンス制御方法とその装置、及びプログラム作成方法に係わり、特に、一連のシーケンス中で高速な応答を要するステップをマークで指定するだけで、高速シーケンス制御テーブルを自動的に生成し、この制御テーブルを用いて高速シーケンス制御を行うようにした高速シーケンス制御方法とその装置、及びそのためのプログラム作成方法に関する。
【0002】
【従来の技術】
従来のシーケンス制御方法に於て、多くの場合、プログラマブルコントローラと称される機器制御専用のコンピュータが用いられ、これに制御対象の動作仕様に応じた専用の制御プログラムを入力して、機器のシーケンス制御を行っていた。上記制御プログラムは、ラダー図やSFC(Seqential Function Chart)などによって記述されるが、特に高速応答を要する処理は、通常のプログラムとは別の割込みプログラムとして記述する必要があった。この割込みプログラムを用いたシーケンス制御方法に関する公知例としては、「日立プログラマブルコントローラ HIDIC Hシリーズ CPUモジュール取扱説明書(ソフトウェア編)NB323C」(日立製作所、1995年)のPP.15−30に記載されているシーケンス制御方法が挙げられる。以下、この割り込みプログラムを用いたときの動作例を説明する。
【0003】
図2は、プログラマブルコントローラにおけるスキャン処理のサイクルと入力信号の状態変化のサイクルの関係を示すタイミングチャートであり、入力信号の状態変化のサイクルが、スキャン処理の1サイクル、すなわちスキャンタイムに比べて長い場合を示す。ここで、スキャン処理202で処理されるプログラム中には、入力信号201がOFFからONになる事象、いわゆる立ち上がりを検出する処理が記述されており、1サイクルのスキャン処理中に、この処理が実行されるタイミング203を上向き矢印で示した。図2では、入力信号201の立ち上がりを完全に捕らえていることが分かる。
【0004】
一方、図3は、入力信号の状態変化のサイクルがスキャンタイムに比べて短い場合を示している。スキャン処理されるプログラムは、図2と同じとする。図3では、入力信号301の変化が高速なために、スキャン処理302がこれに追従できず、入力信号301の立ち上がりの検出もれ304が発生している。
【0005】
図4は、このようにスキャン処理では追従が困難となる高速な状態変化に対応するため、割込み処理を併用した場合を示す。割込み処理402は、一定周期で割込みを入れるタイマなどをきっかけに起動される処理であり、割込みの周期は入力信号401の変化に追従できるものとする。割込み処理402で処理されるプログラムの中には、入力信号401の立ち上がりを検出する処理が記述されており、この処理のタイミング403を上向き矢印で示した。図4では、入力信号401の立ち上がりをもれなく捕らえている。なお、割込み処理402の1サイクルは、割込み周期そのものよりも短いものとする。また、通常のスキャン処理404で処理されるプログラムには、割込み処理402で処理されるプログラムに記述される処理を除いた、その他の処理が記述される。ここで、スキャン処理404自体は、割込み処理402に割込まれるために、断続的となり、スキャンタイムは図2や図3のときよりも長くなるが、システムのトータル性能を考えると、入力信号401への応答性は向上する。
【0006】
【発明が解決しようとする課題】
上記した従来技術では、高速応答を要する処理を、通常シーケンスとは別の割込みプログラムとして記述しているが、このような高速応答を要する処理でも、他の通常シーケンスの処理と頻繁に同期をとる必要があり、一連のシーケンスとして見ると、高速応答を要する処理は、実質的に通常シーケンスの中に混在していることが多い。このため、従来のように通常シーケンスと高速応答を要する処理とを初めから分離して記述する方法では、プログラムの記述自体が複雑になり、その結果として、一連のシーケンスとしての見易さが損なわれ、シーケンスの変更も困難になるという問題があった。
【0007】
そこで、本発明では、一連のシーケンスを記述する際、特に高速応答を要するステップを高速処理を示すマークで指定しておき、通常シーケンスと高速シーケンスがステップのレベルで混在したシーケンス制御プログラムから、高速シーケンス制御テーブルを自動的に生成し、この高速シーケンス制御テーブルを用いて、高速シーケンスを制御するようにした高速シーケンス制御方法とその装置、及びそのためのプログラム作成方法を提供することを目的とする。
【0008】
【課題を解決するための手段】
上記の目的を達成するために、本発明は、シーケンス制御プログラムの各ステップのうち、高速処理を必要とするステップにマークを付加し、前記マークが付加された高速ステップと前記マークが付加されていない通常ステップを分離して高速及び通常中間コードを生成し、さらに前記各中間コードから高速実行プログラム及び通常実行プログラムを生成し、前記高速実行プログラムと通常実行プログラムとの間で実行中ステップの同期をとりながら前記高速実行プログラムを実行するようにしたことを特徴とする高速シーケンス制御方法を開示する。
【0009】
また、本発明は、前記高速実行プログラムが、前記高速ステップのコマンド列を格納するためのコマンドリストと、現在のステップの終了条件、次に実行するステップの番号、及び前記コマンドリストの次に実行されるコマンド列のエントリアドレスを格納するための制御テーブルと、各ステップの前記制御テーブルのエントリアドレスを格納するためのエントリテーブルとから構成された高速シーケンス制御テーブルであることを特徴とする高速シーケンス制御方法を開示する。
【0011】
さらに、本発明は、上記のシーケンス制御プログラムの作成方法により作成されたシーケンス制御プログラムを用いて高速シーケンス制御を行うための高速シーケンス制御装置であって、
前記マークが付加された高速ステップと前記マークが付加されていない通常ステップを分離して高速及び通常中間コードを生成するための中間コード生成手段と、
前記各中間コードから高速実行プログラム及び通常実行プログラムを生成するための実行プログラム生成手段と、
前記高速実行プログラムと通常実行プログラムとの間で実行中ステップの同期をとりながら前記高速実行プログラムを実行するためのプロセッサと、
を備えたことを特徴とする高速シーケンス制御装置を開示する。
【0012】
【発明の実施の形態】
以下、本発明の実施の形態を詳細に説明する。
図1は、本発明に係る、高速シーケンス制御方法に於ける処理の流れを模式的に示すブロック図である。まず、シーケンス制御プログラム編集手段101によって、一連のシーケンス制御プログラム102を作成するとともに、特に高速応答を要するステップには、高速処理を意味するマークをつけておく。こうして作成したシーケンス制御プログラム102は、シーケンス制御プログラム変換手段103によって、通常シーケンス制御内部コード104と、高速シーケンス制御テーブル105に分離、変換される。高速シーケンス制御テーブル105には、マークで指定した高速応答を要する処理、すなわち高速シーケンスを制御するためのデータが高速処理に適したテーブル形式で格納される。一方、通常シーケンス制御内部コード104には、高速シーケンス制御テーブル105に割り振られた高速シーケンス以外の処理、すなわち通常シーケンスの内部コード列(実行形式プログラム)が格納される。ここで、通常シーケンス制御内部コード実行手段106によって、通常シーケンス制御内部コード104は、解釈、実行される。さらに、これと並行して、高速シーケンス制御テーブル処理手段107によって、高速シーケンス制御テーブル105は処理される。このように、シーケンス制御プログラム102を作成する際、高速応答を要するステップをマークで指定しておくだけで、高速シーケンス制御テーブル105を自動的に生成することができるようにすることによって、高速応答を要する処理が混在したシーケンスを、一連のシーケンスとしての見易さを損なうことのない自然な形で、容易に記述できる。すなわち、従来よりもシーケンスの作成と変更が容易になるため、プログラムの開発効率と保守性が向上する。
【0013】
図5は、図1のシーケンス制御プログラム編集手段101によって記述されるシーケンス制御プログラム102の一例を示す。図5では、一連のシーケンスをペトリネットの形式で表現する、グラフィック型のプログラミング言語を用いており、このような言語に関する公知例としては、特開平7−72920号公報に記載されているセル制御言語が挙げられる。このセル制御言語では、ペトリネットのプレース(図中、○で表記する)を、FA(ファクトリー・オートメーション)システムのセルを構成する機器(以下、ユニットとする)の1ステップあたりの動作と定義して、各プレースをステップの整理番号であるステップNO.(例えば、S100)により区別する。また、トランジション(図中、 で表記する)を次ステップへの遷移条件と定義する。さらに、トークン(図中、表記せず)のあるプレースを実行中のステップとし、各プレースには高々一個のトークンしか入らない、いわゆるセーフペトリネットを考える。
【0014】
図5のプレース501のステップNO.はS102であり、そのステップでのユニットの動作は、図1のシーケンス制御プログラム編集手段101を用いて、コマンド列として記述される。また、プレース501の出力側のトランジション502、503、504は、それぞれステップS102の終了条件OK1、OK2、OK3を遷移条件とし、各終了条件OK1、OK2、OK3は、シーケンス制御プログラム編集手段101を用いて、入出力信号などに関する条件式として記述される。なお、図5は、シーケンス表記のみを示し、これらのコマンド列、条件式は表記されていない(コマンド列、条件式の例は後述する)。
【0015】
本発明では、上記のようなセル制御言語の使用を少し拡張し、高速処理を要するプレースにマークを付ける。例えばプレース505は、プレース501のような通常のプレース記号(図中、○で表記する)の右上に角型のマークを付けたものであり、このプレースの入力側のトランジション(プレース505の場合、トランジション503)の状態遷移に対し、高速に応答する必要があることを意味する。このマークをプレースの高速オプションと呼ぶことにする。このように、一連のシーケンスのうち、部分的に高速な応答が必要なところがある場合、この高速オプションをプレースに付けるだけで、そのステップは高速シーケンスとして処理されることになる。例えば上記プレース505では、その入力側トランジション503の遷移条件、すなわちステップS102の終了条件OK2が成立するかどうかの監視を、図4の割込み処理402の中で行い、もし終了条件OK2が成立していれば、ステップS105の動作を定義するコマンド列を実行するようになっており、状態変化に対する高速応答が可能となる。また、高速オプションの付かない通常のプレースのステップは、通常のスキャン処理の中で実行されることになる。
【0016】
このように一連のシーケンス中で、特に高速応答を要するステップにマークを付加して区別する表記方法は、SFCのような従来技術にも用意されていない。そこで、SFC表記に同様の拡張を行った例を図6に示す。図6では、SFCのステップ要素(図中、□で表記する)の右上の角を三角形状に塗りつぶすことにより、図5の高速オプションと同じ意味を持たせた。例えば、ステップ601(S105)は高速オプション付きであり、その入力側のトランジション(t1022)で記述された条件の監視は割込み処理の中で行う。なお、SFCはペトリネットを起源とする表記であり、以下のペトリネットを例とした説明は、SFCを用いた場合にも同様に成り立つものである。
【0017】
また、図5のようなペトリネットを記述する際、シーケンス制御プログラム編集手段101では、各ステップにおける動作をコマンド列で、各トランジションの遷移条件を条件式で記述することを前提としているが、仮にこれらを従来のラダー図、ファンクションブロックダイヤグラムなどで記述する場合でも、以下に述べる高速シーケンス制御方法は同様に実現可能である。
【0018】
図7は、図5のシーケンス制御プログラム102をコード化したものを示し、図5のペトリネット表記と一対一に対応した構造を持つ。図1のシーケンス制御プログラム編集手段101では、シーケンス制御プログラム102を図5のペトリネット形式で編集し、最終的には図7のようにコード形式で保存するものとする。ここで、ペトリネット形式からコード形式への変換は、シーケンス制御プログラム編集手段101の処理で自動的に行われる。さらに、シーケンス制御プログラム変換手段103では、図7のようなコード形式のシーケンス制御プログラム102を入力として処理するものとする。
【0019】
図7のシーケンス制御プログラムは、大きく分けると二つのブロックで構成される。一つは通常シーケンスブロック701で、もう一つは#INTERRUPT文703で始まる高速シーケンスブロック702である。高速シーケンスブロック702は、図5のペトリネットのプレースのうち、高速オプションの付いているプレースに関する記述を集めたものであり、通常シーケンスブロック701は、それ以外のプレースに関する記述を集めたものである。さらに、通常シーケンスブロック701と高速シーケンスブロック702は、それぞれ”cell”文706で始まるcellブロック704と、”def” 文707で始まるdefブロック705で構成される。cellブロック704には、プレースとトランジションの接続関係、すなわちペトリネットの構造と、各プレースでの処理が含まれている。cellラベル708には、各プレースのステップNO.(S101)と、そのステップの動作主体のユニットNO.(UNIT1)が記述される。遷移条件式709には、そのプレースの入力側のトランジションに入力として接続されるプレースのステップNO.(S100)と終了条件名称(OK1)が記述される。なお、図5のS108のように、入力側のトランジションが複数ある場合、そのトランジションに入力として接続されるプレースのステップNO.と終了条件名称が、ORを意味する記号 ”|”の後に記述される。コマンド列710には、1ステップあたりの処理を定義するコマンドが記述される。defブロック705には、各プレースのステップの終了条件を定義する条件式が含まれている。defラベル711には、各プレースのステップNO.(S101)が記述される。終了条件式712には、各ステップの終了条件名称(OK1)と、それを定義する条件式が記述される。また、図5のS102のように、終了条件が何通りかあるステップの場合、複数の終了条件名称と条件式が記述されることになる。なお、高速シーケンスブロック702の記述も、以上に述べた通常シーケンスブロック701と同様である。
【0020】
また、図7(すなわち図5)のシーケンス制御プログラムは、そのシーケンスの動作主体であるユニット毎にモジュール化されている。例えば、図7はUNIT1のモジュールを示す。このようにシーケンス制御プログラム102の各モジュールは、ユニットNO.により区別される。
【0021】
図8は、図1のシーケンス制御プログラム変換手段103の処理を示すフローチャートである。シーケンス制御プログラム変換手段103では、まず、入力されたシーケンス制御プログラム102を解析し(処理801)、この解析で得られた情報に基づいて、シーケンス制御中間コードを生成する(処理802)。次に、このシーケンス制御中間コードから、通常シーケンス制御内部コード104と、高速シーケンス制御テーブル105を生成する(処理803、804)。
【0022】
図9は、シーケンス制御プログラム解析の処理801の詳細なフローチャートである。今、図7のシーケンス制御プログラムが入力されたとすると、まず、通常シーケンスブロック701のペトリネット構造、コマンド列、終了条件を格納するデータ領域を確保する(処理901)。次に、通常シーケンスブロック701のcellブロック704、defブロック705を順に解析する。cellブロック704の解析では、未処理のプレースを1つ取り出し(処理909)、そのプレースのペトリネット構造を解析し(処理902)、さらにコマンド列710等を解析する(処理903)。このような解析を次のプレースの記述がなくなるまで繰り返す(処理904)。次のdefブロック705の解析では、未処理のプレースを1つ取り出し(処理910)、そのプレースの終了条件式712等を解析し(処理905)、これを次のプレースの記述がなくなるまで繰り返す(処理906)。以上の処理で、通常シーケンスブロック701の解析は終了するが、続いて#INTERRUPT文703が記述されていれば(処理907)、高速シーケンスブロック702があることが分かるので、その解析のためのデータ領域を確保し(処理908)、以下、通常シーケンスブロック701と同様の処理を行う。
【0023】
図10は、図9に於ける1プレース毎のネット構造解析の処理902の詳細なフローチャートである。このネット構造解析は、cellラベル708等と遷移条件式709等の解析を行う。cellラベル708等の解析では、現在処理中のプレース(以下、現プレース)のステップNO.を抽出し(処理1001)、さらに現プレースのユニットNO.を抽出する(処理1002)。遷移条件式709の解析では、未処理の遷移条件式を1つ取り出し(処理1006)、現プレースの入力側のトランジションに、入力として接続されるプレース、すなわち一つ前のプレース(以下、前プレース)のステップNO.を抽出し(処理1003)、さらに前プレースの終了条件名称を抽出する(処理1004)。さらに現プレースに他の遷移条件式709があれば、処理1003、1004を繰り返す(処理1005)。なお、現プレースに遷移条件式709が複数あるということは、現プレースの入力側のトランジションが複数あるということに相当する。
【0024】
図11は、図9に於ける1プレース毎のコマンド列解析の処理903の詳細なフローチャートである。このコマンド列解析では、現プレースのコマンド列710等から、コマンドを一つずつ抽出し(処理1101)、これを次のコマンドがなくなるまで繰り返す(処理1102)。
【0025】
図12は、図9に於ける1プレース毎の終了条件解析の処理905の詳細なフローチャートである。この終了条件解析では、defラベル711等から現プレースのステップNO.を抽出し(処理1201)、未処理のOK条件を1つ取り出し(処理1206)、さらに終了条件式712等の抽出を行う(処理1202)。この処理を当該プレースのOK条件がなくなるまで繰り返す(処理1203)。なお、終了条件式712等は、正常終了を示すOKnの終了条件を定義する条件式(以下、OK条件式)だけでなく、異常終了を示すNGnの終了条件を定義する条件式(以下、NG条件式)の場合もあり、この場合が処理1207、1204、1205で同様に解析される。
なお、以上のシーケンス制御プログラム解析処理801で抽出された各データは、ステップNO.及び終了条件名称で検索できる構造化されたデータとして記憶されるものとする。
【0026】
図13は、図8のシーケンス制御中間コード生成処理802の詳細を示すフローチャートである。シーケンス制御中間コード生成では、まず未処理のユニットを1つ取り出し(処理1311)、通常シーケンスと高速シーケンスのネット構造、コマンド列、終了条件のデータをロードする(処理1301、1302)。次に当該ユニットの中のステップNO.の小さいプレースのデータを1つ取り出し(処理1312)、これが高速オプション付きのプレースであれば(処理1303)、高速シーケンス中間コードバッファを選択し(処理1305)、高速オプションなしであれば(処理1303)、通常シーケンス中間コードバッファを選択する(処理1304)。ここで、中間コードバッファは、ユニット毎に通常シーケンスと高速シーケンスの二つ分用意されるものとする。次に、1プレース毎の中間コードを生成し、これをバッファに出力する(処理1306)。さらに、現プレースよりもステップNO.の大きいプレースがあれば、処理1312に戻り、同様の処理を繰り返す(処理1307)。次のプレースがないとき、現ユニットよりもユニットNO.の大きいユニットのモジュールがあれば、処理1311に戻り、同様の処理を繰り返す(処理1308)。以上のように、すべてのユニットのモジュールについて中間コードを生成した後、まず、通常シーケンスの中間コードバッファを結合し、保存する(処理1309)。さらに、高速シーケンスの中間コードバッファを結合し、保存する(処理1310)。
【0027】
図14は、図13に於ける1プレース毎の中間コードの生成処理1306の詳細を示すフローチャートである。この処理では、まず1つの前プレースを取り出し(処理1406)、ネット構造データから現プレースのステップNO.(=i)を獲得する(処理1401)。次に、ネット構造データから前プレースのステップNO.と終了条件を獲得し、さらに、終了条件データから前プレースの終了条件の条件式を獲得する(処理1402)。つづいてこれらのデータから、まず、中間コードの基本形であるIF文の前半部を生成し、バッファに出力する(処理1403)。ここで、”IF Sj == Executing & 条件式 −>”は、「ステップjを実行後、その終了条件の条件式が成立すれば」を意味する。また、コマンド”TERM Sj” は「ステップSjを終了する」、”EXEC Si” は「ステップSiを実行する」を意味する。次に、現プレースSiのコマンド列を、バッファに続けて出力する(処理1404)。これで前プレース1つについての処理を終わり、他にも前プレースがあれば、すなわち、ステップSiの入力側のトランジションが他にもあれば、処理1406に戻り、同様の処理を繰り返す(処理1405)。
【0028】
図15は、図7のシーケンス制御プログラム102を中間コード化したものを示す。図7と同様に、中間コードも通常シーケンスブロック1501と高速シーケンスブロック1502の二つのブロックで構成される。ここで、中間コードはIF文1503に示したようなIF文を基本形とし、これを集めたものがブロックとなる。
【0029】
図16は、通常シーケンス中間コードのIF文から、通常シーケンス制御内部コード104を生成した例を示す。内部コードは実際はバイナリ形式であるが、図16ではニーモニック形式で表記した。IF文1601の条件部1602から内部コード1606が、コマンド列1603から内部コード1607が生成される。このようにIF文1601の内部コードは ”STT i”内部コード1605から始まるブロック1604となる。なお、この ”STT i”内部コード1605は、内部コードを実行する際に利用される。
【0030】
図17は、図16に示したような通常シーケンス制御内部コード104を生成するための、図8の処理803の詳細を示すフローチャートである。まず、通常シーケンスの中間コードをロードし(処理1701)、次に、中間コードの未処理のIF文を一つずつ取り出して(処理1709)、条件部”IF Si == ...”からステップNO.(=i)を抽出する(処理1702)。このステップNO.iが前のIF文の条件部と同じでなければ(処理1703)、”STT i” 内部コードを生成する(処理1704)。次に、条件式から内部コードを生成し(処理1705)、さらにコマンド列から内部コードを生成する(処理1706)。その後、次のIF文があれば、処理1709に戻り、同様の処理を繰り返す(処理1707)。全てのIF文を処理した後、それぞれの”STT” 内部コードが通常シーケンス制御内部コード104の中のどこにあるかを示すアドレステーブルを生成する(処理1708)。
図18は、図15の通常シーケンスブロック1501を内部コード化したものを示す。IF文1503を内部コード化したものがブロック1801である。
【0031】
図19は、高速シーケンス中間コードのIF文から、高速シーケンス制御テーブル105を生成した例を示す。図19のように、高速シーケンス制御テーブル105は、エントリテーブル1906、制御テーブル1907、コマンドリスト1908の三つのデータで構成されている。エントリテーブル1906は、IF文の内容を制御テーブル1907に登録する際、制御テーブル1907におけるエントリアドレスを記憶するためのテーブルである。エントリテーブル1906は、ステップNO.を添字とする1次元配列であり、現在のステップNO.から一意に制御テーブル1907のエントリアドレスを特定できる。高速シーケンス中間コードに関係のないステップNO.の場合、エントリテーブル1906には未登録を意味する値(16進表記でFFFF)が格納されている。制御テーブル1907には、IF文の条件部とステップNO.更新に関する処理が格納されており、出力側のトランジション数(以下、分岐数)を格納するフィールド、条件式を格納するフィールド、次ステップNO.を格納するフィールド、コマンドリスト1908へのエントリアドレスを格納するフィールドで構成される。コマンドリスト1908は、IF文のコマンド列を内部コード化して格納するエリアである。各コマンド列の終わりが分かるように、終了コード(CmdListEndCode)を付加する。以上のような構成の高速シーケンス制御テーブル105を用いることで、現在のステップNO.に応じた処理を効率良く呼び分けることができ、処理時間を短縮することができる。前に述べたように、高速シーケンス制御テーブル105は、割込み処理によって実行されるが、この割込み処理に要する時間、すなわち割込み処理時間は、高速シーケンス制御テーブル105を処理する時間によって決定する。システムの応答性を良くするためには、割込み処理時間を短くし、さらに割込み周期を短くする必要がある。このため、本実施例では、以上に述べたような高速シーケンス制御テーブル105を用いた。
【0032】
図20は、図19に示したような高速シーケンス制御テーブル105を生成するための、図8の処理804の詳細を示すフローチャートである。以下、図19を参照しながら、フローチャートの説明を行う。まず、高速シーケンス中間コードをロードし(処理2001)、未処理のIF文を1つ取り出す(処理2011)。次に、IF文の条件部の”IF Sj == ...”1902等(図19)から前プレースのステップNO.(=j)を抽出し(処理2002)、そのステップNO.jが前に処理したIF文と同じ値でなければ(処理2003)、エントリテーブル1906のj番目に、新しくデータを登録する制御テーブル1907のエントリアドレスを格納する(処理2004)。ここで、プレース1個あたりに割り当てられる制御テーブル1907のフィールドの大きさは固定されており、既に登録されているプレースの数からエントリアドレスを一意に算出することができるものとする。次に、制御テーブル1907の分岐数をカウントアップする(処理2005)。分岐数は新規登録時には0となっており、ある有限個数まで登録可能なものとする。前述のように、分岐数とは、前プレースの出力側のトランジションのうちで、高速オプション付きのプレースに入力として接続されるものの個数である。次に、IF文のその他の条件式1903から制御テーブル1907の条件部を生成する(処理2006)。制御テーブル1907の条件部は、単純なマッチング処理を用いて高速処理できるように、簡略化したデータ形式(以下、略式コード)にする。このような略式コード化を可能とするため、IF文の条件式にある程度の記述上の制約を設けることもある。例えば、条件式の各辺を単項式に限るなどの制約が考えられる。次に、IF文のコマンド”EXEC Si” 1904等のステップNO.iを抽出して、次ステップNO.のフィールドに格納する(処理2007)。さらに、残りのコマンド列1905を格納するためのコマンドリスト1908のエントリアドレスを算出し、これを制御テーブル1907のコマンドエントリのフィールドに格納する(処理2008)。次に、このコマンド列を内部コード化し、コマンドリスト1908に格納する(処理2009)。なお、各コマンド列の内部コードは固定長ではないため、コマンド列の終わりが分かるように、CmdListEndCodeを付加する。さらに、次のIF文があれば、処理2011に戻り、同様の処理を繰り返す(処理2010)。
【0033】
図21は、図15の高速シーケンスブロック1502から生成したテーブルを示す。ここで、エントリテーブル2101に示す通り、制御テーブル2102に登録されるプレースは3個であり、その中のプレースS102の分岐数は2個となる。これは、図5のS102の3個の出力トランジションのうち、2個が高速オプション付きのプレースに入力として接続されていることに相当する。
【0034】
図22は、図1の通常シーケンス制御内部コード実行手段106の処理を示すフローチャートである。この通常シーケンス制御内部コード実行手段106は、コントローラのファームウェアとして提供されるタスクの一つであり、コントローラ内にダウンロードされる通常シーケンス内部コード104を解釈、実行することによって、コントローラに接続される機器を制御する。
【0035】
図22に於いてまず、通常シーケンス制御内部コード実行手段106では、ユニット毎に内部コードのスキャンを行うために、現在のユニットNO.(=n)を初期化(n=0)する(処理2201)。次に、nの値を1増加し、次のユニットNO.とする(処理2202)。なお、ユニット毎に実行中のプレースを示す現ステップNO.が管理されており、この情報を通常シーケンス制御内部コード実行手段106から参照できる。そこで、UNITnの現ステップNO.(=i)を取得し(処理2203)、”STT i” 内部コードにジャンプする(処理2204)。このとき、通常シーケンス制御内部コード104に付随する”STT i” 内部コードのアドレステーブルによりジャンプ先のアドレスを求める。ジャンプ後は次の”STT” 内部コードが現れるまで、内部コードを順次フェッチし、実行する(処理2205)。さらに、nが所定の最大値でなく、次のユニットがあれば、処理2202に戻り、同様の処理を繰り返す(処理2206)。nが最大値、すなわち登録ユニット数に到達し、次のユニットがなければ、処理2201に戻る(処理2206)。以上のように、通常シーケンス制御内部コード104の、ユニット毎の実行中ステップのブロックのみを選択的にスキャンすることにより、スキャンタイムを短縮することができる。
【0036】
図23、24は、図1の高速シーケンス制御テーブル処理手段107の処理を示すフローチャートである。この2つの図は1つのフローチャートを構成し、図中▲1▼▲2▼▲3▼が2つの図の接続関係を示している。高速シーケンス制御テーブル処理手段107は、コントローラのファームウェアとして提供される割込みタスクであり、コントローラ内にダウンロードされる高速シーケンス制御テーブル105を処理することで、コントローラに接続される機器を制御する。なお、割込みタスクとは、一定周期で割込みを入れるタイマや外部入力信号をきっかけとして起動されるタスクであり、通常シーケンス制御内部コード実行手段106のタスクが実行中に優先的に割込んで実行される。図23、24に於いて、高速シーケンス制御テーブル処理手段107でも、ユニット毎にテーブルの処理を行うため、まず、現在のユニットNO.(=n)を初期化する(処理2301)。次に、nの値を1増加し(処理2302)、UNITnの現ステップNO.(=i)を取得する(処理2303)。さらに、エントリテーブル2101のi番目のデータから制御テーブル2102のエントリアドレスを取得する(処理2304)。次に、制御テーブル2102の該当アドレスのフィールドから分岐数を取得する(処理2305)。各分岐毎にテーブルを処理するために、現在の分岐NO.(=m)を初期化(m=0)する(処理2306)。mの値を1増加し、次の分岐NO.とする(処理2307)。制御テーブル2102の該当フィールドにあるm番目の分岐の条件部の略式コードを評価し(処理2308)、条件成立ならば(処理2309)、制御テーブル2102からコマンドリスト2103のエントリアドレスを取得する(処理2401)。さらに、コマンドリスト2103の該当アドレスの内部コードを、CmdListEndCodeが現れるまで順次フェッチし、実行する(処理2402)。次に、制御テーブル2102から次ステップNO.を取得し(処理2403)、UNITnのステップNO.を次ステップNO.に更新する(処理2404)。なお、各ユニットの現在のステップNO.は、通常シーケンス制御内部コード実行手段106と、高速シーケンス制御テーブル処理手段107の両方で、参照、書き換えができる共有データとする。このように、通常シーケンス制御内部コード実行手段106と、高速シーケンス制御テーブル処理手段107が、現在実行中のステップNO.を共有することによって、両者の間で互いにステップのレベルで同期をとることが可能となる。また、条件不成立ならば(処理2309)、分岐NO.が分岐数に達しているかどうか、すなわち次の分岐があるかどうかをチェックし、次の分岐があれば、処理2307に戻って同様の処理を繰り返し、次の分岐がなければ、次のユニットの処理に移る(処理2310)。最後に、nが最大値でなく、次のユニットがあれば、処理2302に戻って同様の処理を繰り返し、次のユニットがなければ、ここで割込み処理の1サイクルを完了する(処理2405)。
【0037】
なお、以上の実施の形態では、本実施例では、高速シーケンス制御テーブル処理手段107を割込みで実行される処理として説明したが、高速シーケンス制御用の別のコントローラに設けて、割込み以外の方法で処理する場合でも、本発明のシーケンス制御方法が同様な効果を有することは明らかである。また、高速シーケンス制御テーブルに代わって、通常シーケンス制御内部コード104と同じ形式の高速シーケンス制御内部コードを生成し、これを十分な処理速度を持ったコントローラで処理するという方法でも、本発明の方法を実現できる。
【0038】
【発明の効果】
本発明によれば、一連のシーケンスを記述する際、高速応答を要するステップをマークで指定するだけで、高速シーケンス制御テーブルを自動的に生成できるので、高速応答を要する処理が混在したシーケンスを、一連のシーケンスとしての見易さを損なうことなく、容易に記述することができ、その結果、プログラム開発効率と保守性を向上することができる効果がある。
【図面の簡単な説明】
【図1】本発明になる高速シーケンス制御方法の処理の流れを模式的に示すブロック図である。
【図2】プログラマブルコントローラにおけるスキャン処理のサイクルと、入力信号の状態変化のサイクルの関係を示すタイミングチャートである。
【図3】図2の入力信号の状態変化のサイクルがスキャンタイムに比べて短い場合を示すタイミングチャートである。
【図4】図3の入力信号の状態変化を捕らえるために割込み処理を併用した場合を示すタイミングチャートである。
【図5】ペトリネット表記によるシーケンス制御プログラムの一例を示す図である。
【図6】SFC表記によるシーケンス制御プログラムの一例を示す図である
【図7】図5のシーケンス制御プログラムをコード化したものを示す図である。
【図8】シーケンス制御プログラム変換手段の処理を示すフローチャートである。
【図9】図8のシーケンス制御プログラム解析の処理を示すフローチャートである。
【図10】図9の1プレース毎のネット構造解析の処理を示すフローチャートである。
【図11】図9の1プレース毎のコマンド列解析の処理を示すフローチャートである。
【図12】図9の1プレース毎の終了条件解析の処理を示すフローチャートである。
【図13】図8のシーケンス制御中間コード生成の処理を示すフローチャートである。
【図14】図13の1プレース毎の中間コード生成の処理を示すフローチャートである。
【図15】図7のシーケンス制御プログラムから生成した中間コードを示す図である。
【図16】通常シーケンス中間コードから通常シーケンス制御内部コードを生成した例を示す図である。
【図17】図8の通常シーケンス制御内部コード生成の処理を示すフローチャートである。
【図18】図15の通常シーケンスブロックから生成した内部コードを示す図である。
【図19】高速シーケンス中間コードから高速シーケンス制御テーブルを生成した例を示す図である。
【図20】図8の高速シーケンス制御テーブル生成の処理を示すフローチャートである。
【図21】図15の高速シーケンスブロックから生成したテーブルを示す図である。
【図22】通常シーケンス制御内部コード実行手段の処理を示すフローチャートである。
【図23】高速シーケンス制御テーブル処理手段の処理を示すフローチャートである。
【図24】図23のフローチャートの続きである。
【符号の説明】
101 シーケンス制御プログラム編集手段
102 シーケンス制御プログラム
103 シーケンス制御プログラム変換手段
104 通常シーケンス制御内部コード
105 高速シーケンス制御テーブル
106 通常シーケンス制御内部コード実行手段
107 高速シーケンス制御テーブル処理手段
501 プレース
502、503、504 トランジション
505 高速オプション付きのプレース
601 SFCにおける高速オプション付きのステップ要素
701 通常シーケンスブロック
702 高速シーケンスブロック
703 #INTERRUPT文
704 cellブロック
705 defブロック
706 ”cell”文
707 ”def”文
708 cellラベル
709 遷移条件式
710 コマンド列
711 defラベル
712 終了条件式
1501 通常シーケンスブロック
1502 高速シーケンスブロック
1503 中間コードのIF文
1601 中間コードのIF文
1602 条件部
1603 コマンド列
1604 内部コードのブロック
1605、1606、1607 内部コード
1801 内部コードのブロック
1901 中間コードのIF文
1902、1903 条件部
1904、1905 コマンド列
1906 エントリテーブル
1907 制御テーブル
1908 コマンドリスト
2101 エントリテーブル
2102 制御テーブル
2103 コマンドリスト
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a high-speed sequence control method, a high-speed sequence control method, a program, and a program creation method. The present invention relates to a high-speed sequence control method and apparatus for performing high-speed sequence control using this control table, and a program creation method therefor.
[0002]
[Prior art]
In the conventional sequence control method, in many cases, a dedicated computer for device control called a programmable controller is used, and a dedicated control program corresponding to an operation specification of a control target is input to the computer, and the sequence of the device is controlled. Control. The control program is described by a ladder diagram, an SFC (Sequential Function Chart), or the like. In particular, a process requiring a high-speed response needs to be described as an interrupt program different from a normal program. A well-known example of a sequence control method using this interrupt program is described in “Hitachi Programmable Controller HIDIC H Series CPU Module Operation Manual (Software) NB323C” (Hitachi, 1995). 15-30. Hereinafter, an operation example when this interrupt program is used will be described.
[0003]
FIG. 2 is a timing chart showing the relationship between the cycle of the scan processing and the cycle of the state change of the input signal in the programmable controller. The cycle of the state change of the input signal is longer than one cycle of the scan processing, that is, the scan time. Show the case. Here, in the program processed in the scan process 202, a process of detecting an event that the input signal 201 changes from OFF to ON, that is, a process of detecting a rising edge, is described. This process is executed during one cycle of the scan process. The timing 203 is indicated by an upward arrow. FIG. 2 shows that the rising edge of the input signal 201 is completely captured.
[0004]
On the other hand, FIG. 3 shows a case where the cycle of the state change of the input signal is shorter than the scan time. The program to be scanned is the same as in FIG. In FIG. 3, since the change of the input signal 301 is fast, the scan processing 302 cannot follow the change, and a missing detection 304 of the rising edge of the input signal 301 occurs.
[0005]
FIG. 4 shows a case in which an interrupt process is used together to cope with such a high-speed state change that makes it difficult to follow the scan process. The interrupt process 402 is a process that is started by a timer or the like that interrupts at a fixed cycle, and the interrupt cycle can follow a change in the input signal 401. In the program processed in the interrupt processing 402, processing for detecting the rise of the input signal 401 is described, and the timing 403 of this processing is indicated by an upward arrow. In FIG. 4, the rising of the input signal 401 is completely captured. It is assumed that one cycle of the interrupt processing 402 is shorter than the interrupt cycle itself. Further, in the program processed in the normal scan process 404, other processes except for the process described in the program processed in the interrupt process 402 are described. Here, the scan process 404 itself is intermittent because it is interrupted by the interrupt process 402, and the scan time is longer than in FIGS. 2 and 3, but in consideration of the total performance of the system, the input signal 401 Responsiveness to is improved.
[0006]
[Problems to be solved by the invention]
In the above-described conventional technology, a process requiring a high-speed response is described as an interrupt program separate from the normal sequence. However, even in a process requiring such a high-speed response, the process frequently synchronizes with other normal sequence processes. When viewed as a series of sequences that need to be performed, a process that requires a high-speed response is often substantially mixed in a normal sequence. For this reason, in the conventional method in which the normal sequence and the processing requiring a high-speed response are described separately from the beginning, the description of the program itself becomes complicated, and as a result, the visibility of a series of sequences is impaired. This makes it difficult to change the sequence.
[0007]
Therefore, in the present invention, when describing a series of sequences, particularly steps that require a high-speed response are designated by marks indicating high-speed processing, and a high-speed sequence control program in which a normal sequence and a high-speed sequence are mixed at the step level is used. It is an object of the present invention to provide a high-speed sequence control method and apparatus for automatically generating a sequence control table and controlling a high-speed sequence using the high-speed sequence control table, and a program creation method therefor.
[0008]
[Means for Solving the Problems]
In order to achieve the above object, according to the present invention, among the steps of the sequence control program, a mark is added to a step requiring high-speed processing, and the high-speed step to which the mark is added and the mark are added. Generating a high-speed and normal intermediate code by separating no normal steps, further generating a high-speed execution program and a normal execution program from each of the intermediate codes, and synchronizing the steps being executed between the high-speed execution program and the normal execution program A high-speed sequence control method characterized in that the high-speed execution program is executed while taking into account.
[0009]
Also, the present invention provides the high-speed execution program, wherein a command list for storing a command sequence of the high-speed step, an end condition of a current step, a step number to be executed next, and A high-speed sequence control table comprising a control table for storing an entry address of a command sequence to be executed and an entry table for storing an entry address of the control table in each step. A control method is disclosed.
[0011]
Further, the present invention is a high-speed sequence control device for performing high-speed sequence control using the sequence control program created by the method for creating a sequence control program described above,
Intermediate code generating means for generating a high-speed and normal intermediate code by separating the high-speed step to which the mark is added and the normal step to which the mark is not added,
Execution program generation means for generating a high-speed execution program and a normal execution program from each of the intermediate codes;
A processor for executing the high-speed execution program while synchronizing steps during execution between the high-speed execution program and the normal execution program,
A high-speed sequence control device characterized by comprising:
[0012]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described in detail.
FIG. 1 is a block diagram schematically showing a processing flow in the high-speed sequence control method according to the present invention. First, a series of sequence control programs 102 are created by the sequence control program editing means 101, and steps requiring high-speed response are marked with high-speed processing. The sequence control program 102 created in this way is separated and converted into a normal sequence control internal code 104 and a high-speed sequence control table 105 by the sequence control program conversion means 103. In the high-speed sequence control table 105, processing that requires a high-speed response specified by a mark, that is, data for controlling a high-speed sequence is stored in a table format suitable for high-speed processing. On the other hand, in the normal sequence control internal code 104, processing other than the high-speed sequence allocated to the high-speed sequence control table 105, that is, an internal code sequence (executable program) of the normal sequence is stored. Here, the normal sequence control internal code 104 is interpreted and executed by the normal sequence control internal code execution means 106. Further, in parallel with this, the high-speed sequence control table 105 is processed by the high-speed sequence control table processing means 107. As described above, when the sequence control program 102 is created, the high-speed sequence control table 105 can be automatically generated only by designating the steps that require the high-speed response by the mark. Can be easily described in a natural form without impairing the visibility as a series of sequences. That is, since the sequence can be created and changed more easily than before, the program development efficiency and maintainability are improved.
[0013]
FIG. 5 shows an example of the sequence control program 102 described by the sequence control program editing means 101 in FIG. In FIG. 5, a graphic programming language that expresses a series of sequences in a Petri net format is used. A known example of such a language is disclosed in Japanese Patent Application Laid-Open No. 7-72920. Language. In this cell control language, a place of a Petri net (denoted by a circle in the figure) is defined as an operation per step of a device (hereinafter, referred to as a unit) constituting a cell of a factory automation (FA) system. Then, each place is assigned a step number, which is the reference number of the step. (For example, S100). A transition (denoted by in the figure) is defined as a transition condition to the next step. Further, a so-called safe Petri net in which a place having a token (not shown in the figure) is set as a step being executed and each place includes at most one token at a time is considered.
[0014]
Step No. of place 501 in FIG. Is S102, and the operation of the unit in that step is described as a command sequence using the sequence control program editing means 101 in FIG. The transitions 502, 503, and 504 on the output side of the place 501 use the end conditions OK1, OK2, and OK3 of step S102 as transition conditions, respectively, and use the sequence control program editing means 101 for each of the end conditions OK1, OK2, and OK3. Are described as conditional expressions relating to input / output signals. FIG. 5 shows only the sequence notation, and does not show these command strings and conditional expressions (examples of command strings and conditional expressions will be described later).
[0015]
In the present invention, the use of the cell control language as described above is slightly extended to mark places requiring high-speed processing. For example, the place 505 has a square mark at the upper right of a normal place symbol (denoted by a circle in the figure) such as the place 501, and a transition on the input side of the place (in the case of the place 505, This means that it is necessary to respond at high speed to the state transition of transition 503). Let's call this mark the fast option for the place. As described above, when a part of the sequence requires a high-speed response, simply adding the high-speed option to the place will cause the step to be processed as a high-speed sequence. For example, in the place 505, whether or not the transition condition of the input transition 503, that is, the end condition OK2 in step S102 is satisfied is performed in the interrupt processing 402 of FIG. 4, and if the end condition OK2 is satisfied. Then, a command sequence that defines the operation of step S105 is executed, and a high-speed response to a state change is possible. Further, a normal place step without the high-speed option is executed in a normal scan process.
[0016]
Such a notation method in which a mark is added to a step requiring a high-speed response in a series of sequences to distinguish the steps from each other is not prepared even in the related art such as the SFC. Thus, FIG. 6 shows an example in which a similar extension is made to the SFC notation. In FIG. 6, the upper right corner of the step element of the SFC (denoted by □ in the figure) is painted in a triangular shape to give the same meaning as the high-speed option in FIG. For example, step 601 (S105) has the high-speed option, and the monitoring of the condition described in the transition (t1022) on the input side is performed in the interrupt processing. It should be noted that SFC is a notation that originates from Petri nets, and the following description using Petri nets as an example is also valid when SFC is used.
[0017]
Also, when describing a Petri net as shown in FIG. 5, the sequence control program editing means 101 presupposes that the operation in each step is described by a command sequence and the transition condition of each transition is described by a conditional expression. Even when these are described in a conventional ladder diagram, function block diagram, or the like, the high-speed sequence control method described below can be similarly realized.
[0018]
FIG. 7 shows a coded version of the sequence control program 102 of FIG. 5 and has a structure corresponding to the Petri net notation of FIG. The sequence control program editing means 101 shown in FIG. 1 edits the sequence control program 102 in the Petri net format shown in FIG. 5 and finally saves it in a code format as shown in FIG. Here, the conversion from the Petri net format to the code format is automatically performed by the processing of the sequence control program editing means 101. Further, it is assumed that the sequence control program conversion means 103 processes the sequence control program 102 in a code format as shown in FIG. 7 as an input.
[0019]
The sequence control program in FIG. 7 is roughly composed of two blocks. One is a normal sequence block 701, and the other is a high-speed sequence block 702 that starts with a #INTERRUPT statement 703. The high-speed sequence block 702 is a collection of descriptions of places with the high-speed option among the places of the Petri net in FIG. 5, and the normal sequence block 701 is a collection of descriptions of other places. . Further, the normal sequence block 701 and the high-speed sequence block 702 are respectively composed of a cell block 704 starting with a “cell” statement 706 and a def block 705 starting with a “def” statement 707. The cell block 704 includes the connection relationship between places and transitions, that is, the structure of the Petri net, and the processing in each place. The cell label 708 includes the step number of each place. (S101) and the unit NO. (UNIT1) is described. The transition condition expression 709 includes the step number of the place connected as an input to the transition on the input side of the place. (S100) and an end condition name (OK1) are described. When there are a plurality of transitions on the input side as in S108 of FIG. 5, step NO. Of the place connected as an input to the transition is performed. And the end condition name are described after the symbol "|" meaning OR. In the command column 710, a command that defines processing per step is described. The def block 705 includes a conditional expression that defines the end condition of the step of each place. The def label 711 includes the step number of each place. (S101) is described. The end condition expression 712 describes an end condition name (OK1) of each step and a conditional expression that defines it. In the case of a step having several termination conditions as in S102 in FIG. 5, a plurality of termination condition names and conditional expressions are described. The description of the high-speed sequence block 702 is the same as that of the normal sequence block 701 described above.
[0020]
Further, the sequence control program of FIG. 7 (that is, FIG. 5) is modularized for each unit that is an operation main body of the sequence. For example, FIG. 7 shows a module of UNIT1. As described above, each module of the sequence control program 102 has the unit No. Are distinguished by
[0021]
FIG. 8 is a flowchart showing the processing of the sequence control program conversion means 103 of FIG. The sequence control program conversion means 103 first analyzes the input sequence control program 102 (process 801), and generates a sequence control intermediate code based on the information obtained by this analysis (process 802). Next, the normal sequence control internal code 104 and the high-speed sequence control table 105 are generated from the sequence control intermediate code (steps 803 and 804).
[0022]
FIG. 9 is a detailed flowchart of the sequence control program analysis processing 801. Assuming that the sequence control program of FIG. 7 has been input, first, a data area for storing the Petri net structure, the command string, and the end condition of the normal sequence block 701 is secured (process 901). Next, the cell block 704 and the def block 705 of the normal sequence block 701 are sequentially analyzed. In the analysis of the cell block 704, one unprocessed place is extracted (process 909), the Petri net structure of the place is analyzed (process 902), and the command string 710 and the like are further analyzed (process 903). Such an analysis is repeated until there is no description of the next place (process 904). In the analysis of the next def block 705, one unprocessed place is taken out (process 910), the end condition expression 712 of the place is analyzed (process 905), and this is repeated until there is no description of the next place (process 905). Process 906). With the above processing, the analysis of the normal sequence block 701 is completed. However, if the #INTERRUPT statement 703 is described subsequently (processing 907), it is known that the high-speed sequence block 702 exists, and the data for the analysis is obtained. An area is secured (process 908), and thereafter, the same process as in the normal sequence block 701 is performed.
[0023]
FIG. 10 is a detailed flowchart of the net structure analysis process 902 for each place in FIG. In this net structure analysis, the cell label 708 and the like and the transition condition expression 709 and the like are analyzed. In the analysis of the cell label 708 and the like, the step NO. Is extracted (process 1001), and the unit No. of the current place is further extracted. Is extracted (process 1002). In the analysis of the transition condition expression 709, one unprocessed transition condition expression is extracted (process 1006), and the transition connected as an input to the transition on the input side of the current place, that is, the immediately preceding place (hereinafter, the previous place) Step NO.) Is extracted (step 1003), and the end condition name of the previous place is extracted (step 1004). If there is another transition condition expression 709 in the current place, the processes 1003 and 1004 are repeated (process 1005). Note that the presence of a plurality of transition condition expressions 709 in the current place corresponds to the presence of a plurality of transitions on the input side of the current place.
[0024]
FIG. 11 is a detailed flowchart of the command line analysis process 903 for each place in FIG. In this command string analysis, commands are extracted one by one from the command string 710 or the like of the current place (step 1101), and this is repeated until there is no next command (step 1102).
[0025]
FIG. 12 is a detailed flowchart of the processing 905 of the end condition analysis for each place in FIG. In this end condition analysis, the step NO. Is extracted (process 1201), one unprocessed OK condition is extracted (process 1206), and the end condition expression 712 and the like are extracted (process 1202). This process is repeated until the OK condition for the place is removed (process 1203). Note that the end condition expression 712 and the like include not only a conditional expression (hereinafter, an OK conditional expression) defining an OKn end condition indicating a normal end, but also a conditional expression (hereinafter, NG) defining an NGn end condition indicating an abnormal end. Conditional expression), and this case is similarly analyzed in processing 1207, 1204, and 1205.
Each data extracted in the sequence control program analysis processing 801 described above is stored in step NO. And stored as structured data that can be searched by the end condition name.
[0026]
FIG. 13 is a flowchart showing details of the sequence control intermediate code generation processing 802 in FIG. In the sequence control intermediate code generation, one unprocessed unit is first extracted (process 1311), and the data of the net structure, command sequence, and end condition of the normal sequence and the high-speed sequence are loaded (processes 1301, 1302). Next, step NO. One of the data of the place having the smaller size is fetched (processing 1312). If this is the place with the high-speed option (processing 1303), the high-speed sequence intermediate code buffer is selected (processing 1305). ), A normal sequence intermediate code buffer is selected (process 1304). Here, it is assumed that two intermediate code buffers are prepared for each unit: a normal sequence and a high-speed sequence. Next, an intermediate code for each place is generated and output to a buffer (process 1306). Further, step NO. If there is a place with a larger value, the process returns to the process 1312 and the same process is repeated (process 1307). When there is no next place, the unit number is higher than the current unit. If there is a module of a larger unit, the process returns to the process 1311 to repeat the same process (process 1308). As described above, after generating the intermediate codes for the modules of all the units, first, the intermediate code buffers of the normal sequence are combined and stored (processing 1309). Further, the intermediate code buffers of the high-speed sequence are combined and stored (process 1310).
[0027]
FIG. 14 is a flowchart showing details of the intermediate code generation processing 1306 for each place in FIG. In this process, first, one previous place is taken out (process 1406), and the step NO. (= I) is obtained (process 1401). Next, the step NO. And an end condition, and a conditional expression of the end condition of the previous place is obtained from the end condition data (process 1402). Next, the first half of the IF statement, which is the basic form of the intermediate code, is generated from these data and output to the buffer (process 1403). Here, "IF Sj == Executing & conditional expression->" means "if the conditional expression of the end condition is satisfied after execution of step j". The command “TERM Sj” means “end step Sj”, and “EXEC Si” means “execute step Si”. Next, the command string of the current place Si is output to the buffer continuously (process 1404). This completes the processing for one previous place. If there is another previous place, that is, if there is another transition on the input side of step Si, the process returns to step 1406 and the same processing is repeated (step 1405). ).
[0028]
FIG. 15 shows the sequence control program 102 of FIG. 7 converted into an intermediate code. Similarly to FIG. 7, the intermediate code is also composed of two blocks, a normal sequence block 1501 and a high-speed sequence block 1502. Here, the intermediate code has an IF sentence as shown in the IF sentence 1503 as a basic form, and a collection of these becomes a block.
[0029]
FIG. 16 shows an example in which the normal sequence control internal code 104 is generated from the IF sentence of the normal sequence intermediate code. The internal code is actually in a binary format, but is shown in a mnemonic format in FIG. An internal code 1606 is generated from the condition part 1602 of the IF statement 1601, and an internal code 1607 is generated from the command sequence 1603. Thus, the internal code of the IF statement 1601 is a block 1604 starting from the “STTi” internal code 1605. The "STTi" internal code 1605 is used when executing the internal code.
[0030]
FIG. 17 is a flowchart showing details of the process 803 in FIG. 8 for generating the normal sequence control internal code 104 as shown in FIG. First, the intermediate code of the normal sequence is loaded (processing 1701). Next, the unprocessed IF statements of the intermediate code are fetched one by one (processing 1709), and the steps from the conditional part “IF Si ==. NO. (= I) is extracted (processing 1702). In this step NO. If i is not the same as the condition part of the previous IF statement (step 1703), the internal code “STTi” is generated (step 1704). Next, an internal code is generated from the conditional expression (processing 1705), and an internal code is generated from the command sequence (processing 1706). Thereafter, if there is a next IF statement, the process returns to step 1709, and the same processing is repeated (step 1707). After processing all IF statements, an address table indicating where each "STT" internal code is located in the normal sequence control internal code 104 is generated (process 1708).
FIG. 18 shows the internal sequence block of the normal sequence block 1501 of FIG. A block 1801 is obtained by internally coding the IF statement 1503.
[0031]
FIG. 19 shows an example in which the high-speed sequence control table 105 is generated from the IF statement of the high-speed sequence intermediate code. As shown in FIG. 19, the high-speed sequence control table 105 includes three pieces of data: an entry table 1906, a control table 1907, and a command list 1908. The entry table 1906 is a table for storing an entry address in the control table 1907 when registering the content of the IF statement in the control table 1907. The entry table 1906 contains the step NO. Is a one-dimensional array subscripted with the current step NO. , The entry address of the control table 1907 can be uniquely specified. Step No. irrelevant to the high-speed sequence intermediate code In the case of, the entry table 1906 stores a value (FFFF in hexadecimal notation) which means that it is not registered. In the control table 1907, the condition part of the IF statement and the step NO. A field for updating is stored, a field for storing the number of transitions on the output side (hereinafter, the number of branches), a field for storing a conditional expression, and a next step NO. And a field for storing an entry address to the command list 1908. The command list 1908 is an area in which a command string of an IF statement is internally coded and stored. An end code (CmdListEndCode) is added so that the end of each command sequence can be recognized. By using the high-speed sequence control table 105 having the above configuration, the current step NO. Can be called efficiently, and the processing time can be shortened. As described above, the high-speed sequence control table 105 is executed by interrupt processing. The time required for the interrupt processing, that is, the interrupt processing time, is determined by the time for processing the high-speed sequence control table 105. In order to improve the responsiveness of the system, it is necessary to shorten the interrupt processing time and further shorten the interrupt cycle. Therefore, in the present embodiment, the high-speed sequence control table 105 as described above is used.
[0032]
FIG. 20 is a flowchart showing details of the processing 804 in FIG. 8 for generating the high-speed sequence control table 105 as shown in FIG. Hereinafter, the flowchart will be described with reference to FIG. First, the high-speed sequence intermediate code is loaded (process 2001), and one unprocessed IF statement is extracted (process 2011). Next, from the condition part of the IF statement, such as “IF Sj ==...” 1902 (FIG. 19), the step NO. (= J) is extracted (process 2002), and step NO. If j is not the same value as the previously processed IF statement (Process 2003), the entry address of the control table 1907 for registering new data is stored in the j-th entry table 1906 (Process 2004). Here, it is assumed that the size of the field of the control table 1907 assigned per place is fixed, and the entry address can be uniquely calculated from the number of places already registered. Next, the number of branches in the control table 1907 is counted up (process 2005). The number of branches is 0 at the time of new registration, and it is assumed that a certain finite number can be registered. As described above, the number of branches is the number of transitions on the output side of the previous place that are connected as inputs to the place with the high-speed option. Next, a condition part of the control table 1907 is generated from other conditional expressions 1903 of the IF statement (processing 2006). The condition part of the control table 1907 is in a simplified data format (hereinafter, abbreviated code) so that high-speed processing can be performed using a simple matching process. In order to enable such a simplified coding, a conditional description of the IF statement may be restricted to some extent. For example, there may be restrictions such as limiting each side of the conditional expression to a monomial expression. Next, the step number of the IF statement command “EXEC Si” 1904 or the like is used. i, and the next step NO. (Process 2007). Further, the entry address of the command list 1908 for storing the remaining command sequence 1905 is calculated, and this is stored in the command entry field of the control table 1907 (process 2008). Next, the command sequence is internally coded and stored in the command list 1908 (process 2009). Since the internal code of each command sequence is not of a fixed length, CmdListEndCode is added so that the end of the command sequence can be recognized. Further, if there is the next IF statement, the process returns to the process 2011, and the same process is repeated (process 2010).
[0033]
FIG. 21 shows a table generated from the high-speed sequence block 1502 in FIG. Here, as shown in the entry table 2101, the number of places registered in the control table 2102 is three, and the number of branches of the place S102 in the places is two. This corresponds to two of the three output transitions of S102 in FIG. 5 being connected as inputs to the place with the high-speed option.
[0034]
FIG. 22 is a flowchart showing the processing of the normal sequence control internal code execution means 106 of FIG. The normal sequence control internal code execution means 106 is one of the tasks provided as firmware of the controller, and interprets and executes the normal sequence internal code 104 downloaded into the controller to execute a device connected to the controller. Control.
[0035]
In FIG. 22, first, the normal sequence control internal code executing means 106 scans the internal code for each unit. (= N) is initialized (n = 0) (processing 2201). Next, the value of n is increased by 1, and the next unit NO. (Process 2202). Note that the current step No. indicating the place being executed for each unit. This information can be referred to from the normal sequence control internal code executing means 106. Therefore, the current step NO. (= I) is acquired (process 2203), and the process jumps to the “STTi” internal code (process 2204). At this time, the jump destination address is obtained from the address table of the "STTi" internal code accompanying the normal sequence control internal code 104. After the jump, the internal codes are sequentially fetched and executed until the next "STT" internal code appears (process 2205). Further, if n is not the predetermined maximum value and there is a next unit, the process returns to the process 2202, and the same process is repeated (process 2206). If n reaches the maximum value, that is, the number of registered units, and there is no next unit, the process returns to step 2201 (step 2206). As described above, the scan time can be reduced by selectively scanning only the block of the currently executing step of each unit of the normal sequence control internal code 104.
[0036]
FIGS. 23 and 24 are flowcharts showing the processing of the high-speed sequence control table processing means 107 of FIG. These two figures constitute one flowchart, and in the figures, (1), (2), and (3) show the connection relationship between the two figures. The high-speed sequence control table processing unit 107 is an interrupt task provided as firmware of the controller, and controls devices connected to the controller by processing the high-speed sequence control table 105 downloaded in the controller. Note that the interrupt task is a task that is started by a timer for inputting an interrupt at a fixed cycle or an external input signal, and is normally executed by the task of the sequence control internal code execution unit 106 with priority interrupted during execution. You. In FIGS. 23 and 24, the high-speed sequence control table processing means 107 also performs table processing for each unit. (= N) is initialized (step 2301). Next, the value of n is increased by 1 (process 2302), and the current step NO. (= I) is acquired (process 2303). Further, the entry address of the control table 2102 is obtained from the i-th data of the entry table 2101 (process 2304). Next, the number of branches is obtained from the field of the corresponding address of the control table 2102 (step 2305). To process the table for each branch, the current branch NO. (= M) is initialized (m = 0) (processing 2306). m is incremented by 1 and the next branch NO. (Step 2307). The simplified expression code of the condition part of the m-th branch in the corresponding field of the control table 2102 is evaluated (processing 2308). If the condition is satisfied (processing 2309), the entry address of the command list 2103 is obtained from the control table 2102 (processing 2401). Further, the internal code of the corresponding address in the command list 2103 is sequentially fetched and executed until CmdListEndCode appears (processing 2402). Next, the next step NO. Is acquired (processing 2403), and step NO. In the next step NO. (Step 2404). In addition, the current step No. of each unit is used. Is shared data that can be referred to and rewritten by both the normal sequence control internal code execution means 106 and the high-speed sequence control table processing means 107. As described above, the normal sequence control internal code execution means 106 and the high-speed sequence control table processing means 107 execute step NO. , It is possible to synchronize with each other at the step level. If the condition is not satisfied (step 2309), the branch NO. Is checked to see if it has reached the number of branches, that is, whether there is a next branch. If there is a next branch, the process returns to step 2307 to repeat the same processing. If there is no next branch, the next unit Processing shifts to processing (processing 2310). Finally, if n is not the maximum value and there is a next unit, the flow returns to step 2302 to repeat the same processing. If there is no next unit, one cycle of interrupt processing is completed here (step 2405).
[0037]
In the above embodiment, in the present embodiment, the high-speed sequence control table processing unit 107 has been described as a process executed by an interrupt. It is clear that the sequence control method of the present invention has the same effect in the case of processing. Also, in place of the high-speed sequence control table, a method of generating a high-speed sequence control internal code having the same format as that of the normal sequence control internal code 104 and processing this with a controller having a sufficient processing speed may be used. Can be realized.
[0038]
【The invention's effect】
According to the present invention, when describing a series of sequences, a high-speed sequence control table can be automatically generated simply by designating a step requiring a high-speed response with a mark. The description can be easily made without impairing the visibility as a series of sequences, and as a result, there is an effect that the program development efficiency and the maintainability can be improved.
[Brief description of the drawings]
FIG. 1 is a block diagram schematically showing a processing flow of a high-speed sequence control method according to the present invention.
FIG. 2 is a timing chart showing a relationship between a scan processing cycle and a cycle of a state change of an input signal in the programmable controller.
FIG. 3 is a timing chart showing a case where a cycle of a state change of an input signal in FIG. 2 is shorter than a scan time.
FIG. 4 is a timing chart showing a case where interrupt processing is used in combination to capture a change in the state of the input signal of FIG. 3;
FIG. 5 is a diagram showing an example of a sequence control program in Petri net notation.
FIG. 6 is a diagram showing an example of a sequence control program in SFC notation.
FIG. 7 is a diagram showing a code obtained by coding the sequence control program of FIG. 5;
FIG. 8 is a flowchart showing processing of a sequence control program conversion means.
FIG. 9 is a flowchart showing a process of analyzing a sequence control program of FIG. 8;
FIG. 10 is a flowchart showing a net structure analysis process for each place in FIG. 9;
FIG. 11 is a flowchart showing a command sequence analysis process for each place in FIG. 9;
FIG. 12 is a flowchart showing a process of end condition analysis for each place in FIG. 9;
FIG. 13 is a flowchart showing a sequence control intermediate code generation process of FIG. 8;
14 is a flowchart showing a process of generating an intermediate code for each place in FIG.
FIG. 15 is a diagram showing an intermediate code generated from the sequence control program of FIG. 7;
FIG. 16 is a diagram illustrating an example in which a normal sequence control internal code is generated from a normal sequence intermediate code.
FIG. 17 is a flowchart showing a process of generating a normal sequence control internal code in FIG. 8;
FIG. 18 is a diagram showing an internal code generated from the normal sequence block of FIG.
FIG. 19 is a diagram illustrating an example in which a high-speed sequence control table is generated from high-speed sequence intermediate codes.
FIG. 20 is a flowchart showing processing for generating a high-speed sequence control table in FIG. 8;
FIG. 21 is a diagram showing a table generated from the high-speed sequence block in FIG.
FIG. 22 is a flowchart showing processing of a normal sequence control internal code execution means.
FIG. 23 is a flowchart showing processing of a high-speed sequence control table processing means.
FIG. 24 is a continuation of the flowchart in FIG. 23;
[Explanation of symbols]
101 Sequence control program editing means
102 Sequence control program
103 Sequence control program conversion means
104 Normal sequence control internal code
105 High-speed sequence control table
106 Normal sequence control internal code execution means
107 High-speed sequence control table processing means
501 place
502, 503, 504 transition
505 Place with fast option
Step element with high-speed option in 601 SFC
701 Normal sequence block
702 High-speed sequence block
703 #INTERRUPT statement
704 cell block
705 def block
706 "cell" statement
707 "def" statement
708 cell label
709 Transition conditional expression
710 Command string
711 def label
712 End condition expression
1501 Normal sequence block
1502 High-speed sequence block
1503 IF statement of intermediate code
1601 IF statement of intermediate code
1602 Condition part
1603 Command string
1604 Block of internal code
1605, 1606, 1607 Internal code
1801 Internal code block
1901 IF statement of intermediate code
1902, 1903 Condition part
1904, 1905 Command string
1906 Entry table
1907 control table
1908 Command list
2101 Entry table
2102 control table
2103 Command list

Claims (6)

シーケンス制御プログラムの各ステップのうち、高速処理を必要とするステップにマークを付加し、前記マークが付加された高速ステップと前記マークが付加されていない通常ステップを分離して高速及び通常中間コードを生成し、さらに前記各中間コードから高速実行プログラム及び通常実行プログラムを生成し、前記高速実行プログラムと通常実行プログラムとの間で実行中ステップの同期をとりながら前記高速実行プログラムを実行するようにしたことを特徴とする高速シーケンス制御方法。Among the steps of the sequence control program, a mark is added to a step that requires high-speed processing, and the high-speed step with the mark and the normal step without the mark are separated to form a high-speed and normal intermediate code. Generating a high-speed execution program and a normal execution program from each of the intermediate codes, and executing the high-speed execution program while synchronizing the steps being executed between the high-speed execution program and the normal execution program. A high-speed sequence control method characterized by the above-mentioned. 前記高速実行プログラムは、前記高速ステップのコマンド列を格納するためのコマンドリストと、現在のステップの終了条件、次に実行するステップの番号、及び前記コマンドリストの次に実行されるコマンド列のエントリアドレスを格納するための制御テーブルと、各ステップの前記制御テーブルのエントリアドレスを格納するためのエントリテーブルとから構成された高速シーケンス制御テーブルであることを特徴とする請求項1に記載の高速シーケンス制御方法。The high-speed execution program includes a command list for storing a command sequence of the high-speed step, an end condition of a current step, a number of a next step to be executed, and an entry of a command sequence to be executed next to the command list. 2. The high-speed sequence control table according to claim 1, wherein the high-speed sequence control table includes a control table for storing an address and an entry table for storing an entry address of the control table in each step. Control method. 前記高速実行プログラムと通常実行プログラムを同一のプロセッサにより処理するとともに、前記高速実行プログラムは前記プロセッサへの割り込みにより実行されることを特徴とする請求項1に記載の高速シーケンス制御方法。2. The high-speed sequence control method according to claim 1, wherein the high-speed execution program and the normal execution program are processed by the same processor, and the high-speed execution program is executed by interruption to the processor. 各ステップのうち、高速処理を必要とするステップにマークを付したシーケンス制御プログラムを用いて高速シーケンス制御を行うための高速シーケンス制御装置であって、
前記マークが付加された高速ステップと前記マークが付加されていない通常ステップを分離して高速及び通常中間コードを生成するための中間コード生成手段と、
前記各中間コードから高速実行プログラム及び通常実行プログラムを生成するための実行プログラム生成手段と、
前記高速実行プログラムと通常実行プログラムとの間で実行中ステップの同期をとりながら前記高速実行プログラムを実行するためのプロセッサと、
を備えたことを特徴とする高速シーケンス制御装置。
A high-speed sequence control device for performing high-speed sequence control using a sequence control program in which a step requiring high-speed processing is marked among steps ,
Intermediate code generating means for generating a high-speed and normal intermediate code by separating the high-speed step to which the mark is added and the normal step to which the mark is not added,
Execution program generation means for generating a high-speed execution program and a normal execution program from each of the intermediate codes;
A processor for executing the high-speed execution program while synchronizing steps during execution between the high-speed execution program and the normal execution program,
A high-speed sequence control device comprising:
前記プロセッサは前記高速実行プログラムと合わせて前記通常実行部を実行するとともに、前記高速実行プログラムを前記プロセッサへの割り込みにより起動するための割り込み手段を備えたことを特徴とする請求項4に記載の高速シーケンス制御装置。5. The processor according to claim 4, wherein the processor executes the normal execution unit together with the high-speed execution program, and further includes an interrupt unit for activating the high-speed execution program by interrupting the processor. High-speed sequence controller. 前記高速実行プログラムと通常実行プログラムが実行中ステップの番号を共有するための記憶手段を設けたことを特徴とする請求項5に記載の高速シーケンス制御装置。6. The high-speed sequence control device according to claim 5, further comprising storage means for sharing the number of the step being executed by the high-speed execution program and the normal execution program.
JP10375997A 1997-04-22 1997-04-22 High-speed sequence control method and apparatus, program creation method Expired - Fee Related JP3554651B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10375997A JP3554651B2 (en) 1997-04-22 1997-04-22 High-speed sequence control method and apparatus, program creation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10375997A JP3554651B2 (en) 1997-04-22 1997-04-22 High-speed sequence control method and apparatus, program creation method

Publications (2)

Publication Number Publication Date
JPH10293604A JPH10293604A (en) 1998-11-04
JP3554651B2 true JP3554651B2 (en) 2004-08-18

Family

ID=14362459

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10375997A Expired - Fee Related JP3554651B2 (en) 1997-04-22 1997-04-22 High-speed sequence control method and apparatus, program creation method

Country Status (1)

Country Link
JP (1) JP3554651B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007058447A (en) * 2005-08-23 2007-03-08 Kimura Unity Co Ltd Modeling method of control target system based on extended petri net and controller based on extended petri net
US8229578B2 (en) * 2009-09-21 2012-07-24 Fisher-Rosemount Systems, Inc. Methods and apparatus to manage module run sequences in a process control environment

Also Published As

Publication number Publication date
JPH10293604A (en) 1998-11-04

Similar Documents

Publication Publication Date Title
JP3620860B2 (en) Simulation device
CN1099074C (en) Program translating apparatus and processor which achieve high-speed excution of subroutine branch instructions
JP2004341671A (en) Information processing system, control method, control program and recording medium
JP3554651B2 (en) High-speed sequence control method and apparatus, program creation method
JP4257553B2 (en) Motion controller program creation and execution method
US6086624A (en) Simulator and simulation method in each of which simulation can be carried out at a high-speed
JP7338922B2 (en) Method and apparatus for processing and executing heterogeneous embedded tabularized motion processes
JP2009134445A (en) Software component extraction support device
JPH10187461A (en) Language processing system
JPH0210429A (en) Program structure processing system
JP2001255912A (en) Method for executing motion program
JPH04248624A (en) Program conversion processor
Galinec et al. A mixed synchronous-asynchronous approach for digital signal processing
JP2765911B2 (en) Data driven control method and compiling device
JP2001125793A (en) Compiler system, compile method and recording medium
JPH09160611A (en) Programmable controller
JPH1078866A (en) System for automatically preparing program project book
JPH05158706A (en) Optimization processing system for intermediate language
US20050120339A1 (en) Method for operating a computer system
JPH06314221A (en) Compiling system
JPH07129384A (en) Conversion system of operation procedure into natural language format file
JPH09204206A (en) Programmable controller
JPH05100891A (en) Program debugging device
JPH0575841U (en) Program converter
JPH01194053A (en) Processing system for command procedure

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20031225

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040210

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040323

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: 20040427

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040510

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080514

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees