JP4901775B2 - Programmable controller - Google Patents
Programmable controller Download PDFInfo
- Publication number
- JP4901775B2 JP4901775B2 JP2008024249A JP2008024249A JP4901775B2 JP 4901775 B2 JP4901775 B2 JP 4901775B2 JP 2008024249 A JP2008024249 A JP 2008024249A JP 2008024249 A JP2008024249 A JP 2008024249A JP 4901775 B2 JP4901775 B2 JP 4901775B2
- Authority
- JP
- Japan
- Prior art keywords
- scan
- function
- unit
- time
- new function
- 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
Links
Images
Landscapes
- Programmable Controllers (AREA)
Description
本発明は、END処理のスケジューリングを行なうプログラマブルコントローラに関するものである。 The present invention relates to a programmable controller that performs scheduling of END processing.
プログラマブルコントローラ(シーケンサ)では、シーケンサCPU(Central Processing Unit)がシーケンスプログラム実行処理(制御処理)やEND処理(情報処理)のスキャンを行ないながら種々のシーケンス制御を行なっている。このようなシーケンス制御では、近年のネットワークやインタネットの普及に伴い、情報処理に対するユーザ要求が多くなり、END処理が増える傾向にある。 In a programmable controller (sequencer), a sequencer CPU (Central Processing Unit) performs various sequence controls while scanning sequence program execution processing (control processing) and END processing (information processing). In such sequence control, with the recent spread of networks and the Internet, user requests for information processing increase, and END processing tends to increase.
従来、シーケンサCPUでは、END処理を行なう際に、毎スキャン実行する必要がない処理であっても、毎スキャン実行していた。このため、シーケンサCPUのEND処理に新機能を追加した場合、新たに追加した機能の処理分だけスキャンタイムが遅延してしまう。 Conventionally, the sequencer CPU executes each scan even when it is a process that does not need to be executed every scan when performing the END process. For this reason, when a new function is added to the END processing of the sequencer CPU, the scan time is delayed by the amount of processing of the newly added function.
このようなスキャンタイムの遅延は、スループットを悪化させる要因となるので、スキャンタイムを遅延させないための技術の開発が進められている。例えば、特許文献1に記載のジョブスケジュール制御方法は、ジョブクラスの実行本数や実行優先順位を定めたジョブ実行スケジュールに従って複数のイニシエータを作動させるシステムにおいて、実行中のジョブを開始してからの経過時間が基準の実行時間を越えた場合に、実行中のジョブが属するジョブクラスにイニシエータの増設と割当てを行なっている。 Such a delay in the scan time becomes a factor that deteriorates the throughput. Therefore, a technique for preventing the delay in the scan time is being developed. For example, in the job schedule control method described in Patent Document 1, the process after starting a job being executed in a system in which a plurality of initiators are operated according to a job execution schedule in which the number of job classes to be executed and the execution priority order are determined. When the time exceeds the reference execution time, an initiator is added and assigned to the job class to which the job being executed belongs.
しかしながら、上記従来の技術では、イニシエータ本数の加減やジョブの優先順位が必要となるので、ジョブスケジュールの制御が複雑になる。このため、装置構成が複雑になるとともに、ジョブスケジュールを制御する際の負荷が大きくなるという問題があった。 However, in the above conventional technique, since the number of initiators and job priority are required, the control of the job schedule becomes complicated. For this reason, there has been a problem that the apparatus configuration becomes complicated and the load when controlling the job schedule becomes large.
また、一部のジョブクラスにイニシエータの増設と割当てを行なっているので、ジョブ毎にイニシエータ本数のばらつきが生じる。このため、被制御装置の動作が不安定になるという問題があった。 In addition, since initiators are added and assigned to some job classes, the number of initiators varies for each job. For this reason, there existed a problem that operation | movement of a to-be-controlled device became unstable.
本発明は、上記に鑑みてなされたものであって、簡易な構成で、END処理に対するスキャンタイムの遅延を防止するとともに被制御装置を安定して動作させることができるプログラマブルコントローラを得ることを目的とする。 The present invention has been made in view of the above, and an object of the present invention is to obtain a programmable controller that can prevent a scan time delay with respect to an END process and can stably operate a controlled device with a simple configuration. And
上述した課題を解決し、目的を達成するために、本発明は、シーケンスプログラムの実行処理およびEND処理を実行しながらシーケンス制御を行なうプログラマブルコントローラにおいて、前記END処理を行なう際に所定回数のスキャン毎に1回の割合で実行すればよい所定回限定スキャン機能を何回目のスキャンで実行するかをスケジューリングして、各スキャン毎の所定回限定スキャン機能をスキャン手順情報として設定するスケジューリング部と、各スキャンを実行する際に、前記END処理として毎回実行する必要のある機能と、前記スキャン手順情報に従って、各回のスキャンに設定されている前記所定回限定スキャン機能と、を実行するEND処理部と、前記各スキャンの実行時間を測定する実行時間測定部と、を備え、前記スケジューリング部は、前記実行時間測定部が測定した各スキャンの実行時間に基づいて、各回のスキャンに設定される前記所定回限定スキャン機能の実行に要する合計時間がそれぞれ所定の範囲内に入るようスキャン手順情報を設定し、前記実行時間測定部は、前記スケジューリング部において設定された前記スキャン手順情報に従って前記END処理部がEND処理を行なっている間に、前記各スキャンの実行時間を再測定し、前記スケジューリング部は、前記実行時間測定部が再測定した各スキャンの実行時間に基づいて前記スキャン手順情報を再設定することを特徴とする。 In order to solve the above-described problems and achieve the object, the present invention provides a programmable controller that performs sequence control while executing sequence program execution processing and END processing, and performs a predetermined number of scans when performing the END processing. A scheduling unit that schedules how many times the predetermined limited scan function only needs to be executed once at a time, and sets the predetermined limited scan function for each scan as scan procedure information; in performing a scan, the functions that must be performed each time as the END processing, according to the scanning procedure information, and END processing unit for executing said a predetermined time limit scan function that is set in each round of scanning, and and a running time measuring unit for measuring the execution time of each scan, before Scheduling part, based on the execution time execution time of each scan measurement unit was measured, the total time required for execution of the set each time the scan predetermined times limited scan function scans so that each falls within a predetermined range The procedure information is set, and the execution time measurement unit remeasures the execution time of each scan while the END processing unit is performing END processing according to the scan procedure information set in the scheduling unit, The scheduling unit resets the scan procedure information based on an execution time of each scan remeasured by the execution time measurement unit .
設定されたスキャン手順情報に従ってEND処理を行なっている間に、各スキャンの実行時間を再測定し、再測定した各スキャンの実行時間に基づいてスキャン手順情報を再設定するので、簡易な構成で、END処理に対するスキャンタイムの遅延を防止するとともに被制御装置を安定して動作させることができるという効果を奏する。 While performing the END process according to the set scan procedure information, the execution time of each scan is re-measured, and the scan procedure information is reset based on the re-measured execution time of each scan. Thus, it is possible to prevent the scan time from being delayed with respect to the END process and to stably operate the controlled device.
以下に、本発明に係るプログラマブルコントローラの実施の形態を図面に基づいて詳細に説明する。なお、この実施の形態によりこの発明が限定されるものではない。 Embodiments of a programmable controller according to the present invention will be described below in detail with reference to the drawings. Note that the present invention is not limited to the embodiments.
実施の形態1.
図1は、本発明の実施の形態1に係るプログラマブルコントローラのシーケンサCPUの構成を示す図である。シーケンサCPU1は、動的スケジューリングの対象になる機能(動的スケジュール対象機能)(新機能)を何スキャン目に行なうかを決定してEND処理(スキャン処理順序)の動的スケジューリングを行なうCPUである
Embodiment 1 FIG.
1 is a diagram showing a configuration of a sequencer CPU of a programmable controller according to Embodiment 1 of the present invention. The sequencer CPU 1 is a CPU that performs dynamic scheduling of END processing (scan processing order) by determining at what scan a function (dynamic scheduling target function) (new function) to be subjected to dynamic scheduling is performed.
シーケンサCPU1は、シーケンスプログラム実行部11、END処理部12、機能テーブル記憶部13、動的スケジューリング部14を有している。シーケンサCPU1内では、END処理部12がシーケンスプログラム実行部11と動的スケジューリング部14とに接続し、機能テーブル記憶部13が動的スケジューリング部14に接続している。
The sequencer CPU 1 includes a sequence
シーケンスプログラム実行部11は、ラダープログラムを解析して、シーケンスプログラムの実行処理(制御処理)を行なう。END処理部12は、動的スケジューリング部14によって作成されるEND処理の動的スケジュール(後述の動的スケジューリングテーブル53)に基づいて、END処理(情報処理)を行なう。
The sequence
機能テーブル記憶部13は、動的スケジュール対象機能に関する情報テーブル(後述の動的スケジュール対象機能テーブル50)を記憶する不揮発性メモリなどである。動的スケジュール対象機能は、スキャンが毎回必要な機能とは異なり、1日に1回や10秒に1回など、所定回数に1回の割合でスキャンすればよい機能である。本実施の形態では、スキャンが毎回必要な機能を基本機能とし、所定回数に1回の割合でスキャンすればよい動的スケジュール対象機能を新機能(後述の新機能f1〜f6)として説明する。動的スケジュール対象機能は、例えば、SNTP(Simple Network Time Protocol)の実行機能やFTP(File Transfer Protocol)の要求確認機能である。
The function
動的スケジューリング部14は、各新機能を何スキャン目に実行するかの動的スケジューリングを行う。動的スケジューリング部14は、機能テーブル記憶部13に格納されている動的スケジュール対象機能テーブル50から動的スケジュール対象機能やデフォルト処理時間を読み込むとともに、所定のメモリから目標スキャンタイム(1スキャン内で新機能に与えられる処理時間)(後述の許容スキャンタイム)を読み込んで、動的スケジュール対象機能の実行スキャン順序を決定する。許容スキャンタイムは、使用者などがマウスやキーボードなどの入力手段(図示せず)によって設定し、機能テーブル記憶部13などの記憶手段に記憶させておいてもよいし、動的スケジュール対象機能テーブル50内に含めておいてもよい。
The
このように、本実施の形態のシーケンサCPU1は、従来のシーケンサCPUに動的スケジューリング部14を新たに追加するとともに、従来のEND処理部を改修したEND処理部12を備える構成となっている。
As described above, the sequencer CPU 1 according to the present embodiment has a configuration in which the
つぎに、シーケンサCPU1の動作手順について説明する。まず、動的スケジューリング部14による動的スケジュール(動的スケジューリングテーブル53など)の作成処理手順について説明し、その後、END処理部12によるEND処理の手順について説明する。
Next, an operation procedure of the sequencer CPU 1 will be described. First, a procedure for creating a dynamic schedule (such as the dynamic scheduling table 53) by the
図2は、実施の形態1に係るシーケンサCPUの動的スケジュール作成処理手順を示すフローチャートである。動的スケジューリング部14は、機能テーブル記憶部13に格納されている動的スケジュール対象機能テーブル50を読み込む(ステップS110)。
FIG. 2 is a flowchart showing a dynamic schedule creation processing procedure of the sequencer CPU according to the first embodiment. The
ここで、動的スケジュール対象機能テーブル50の構成について説明する。図3は、動的スケジュール対象機能テーブルの構成を示す図である。動的スケジュール対象機能テーブル(機能名列挙テーブル)50は、動的スケジュール対象機能毎の情報テーブル群である。図3では、動的スケジュール対象機能テーブル50が、新機能の情報テーブルである新機能テーブルT1〜T6を含んで構成されている場合を示している。なお、ここでの新機能が特許請求の範囲に記載の所定回限定スキャン機能に対応している。 Here, the configuration of the dynamic schedule target function table 50 will be described. FIG. 3 is a diagram showing the configuration of the dynamic schedule target function table. The dynamic schedule target function table (function name enumeration table) 50 is an information table group for each dynamic schedule target function. FIG. 3 shows a case where the dynamic schedule target function table 50 includes new function tables T1 to T6 that are information tables of new functions. The new function here corresponds to the predetermined limited scan function described in the claims.
各新機能テーブルT1〜T6は、動的スケジュール対象機能を識別する「ID」、動的スケジュール対象機能の「機能名」、動的スケジュール対象機能のスキャンに要するデフォルトの「処理時間」(μsec)を対応付けた情報テーブルである。 Each new function table T1 to T6 includes an “ID” for identifying a dynamic schedule target function, a “function name” of the dynamic schedule target function, and a default “processing time” (μsec) required for scanning the dynamic schedule target function. It is the information table which matched.
新機能テーブルT1は、「ID」が「001」であり、「機能名」が「新機能f1」であり、「処理時間」が「50」である動的スケジュール対象機能の情報テーブルである。新機能テーブルT2は、「ID」が「002」であり、「機能名」が「新機能f2」であり、「処理時間」が「50」である動的スケジュール対象機能の情報テーブルである。新機能テーブルT3は、「ID」が「003」であり、「機能名」が「新機能f3」であり、「処理時間」が「25」である動的スケジュール対象機能の情報テーブルである。 The new function table T1 is an information table of dynamic schedule target functions whose “ID” is “001”, “function name” is “new function f1”, and “processing time” is “50”. The new function table T2 is an information table of dynamic schedule target functions whose “ID” is “002”, “function name” is “new function f2”, and “processing time” is “50”. The new function table T3 is an information table of dynamic schedule target functions whose “ID” is “003”, “function name” is “new function f3”, and “processing time” is “25”.
新機能テーブルT4は、「ID」が「004」であり、「機能名」が「新機能f4」であり、「処理時間」が「20」である動的スケジュール対象機能の情報テーブルである。新機能テーブルT5は、「ID」が「005」であり、「機能名」が「新機能f5」であり、「処理時間」が「25」である動的スケジュール対象機能の情報テーブルである。新機能テーブルT6は、「ID」が「006」であり、「機能名」が「新機能f6」であり、「処理時間」が「20」である動的スケジュール対象機能の情報テーブルである。 The new function table T4 is an information table of dynamic schedule target functions whose “ID” is “004”, “function name” is “new function f4”, and “processing time” is “20”. The new function table T5 is an information table of dynamic schedule target functions whose “ID” is “005”, “function name” is “new function f5”, and “processing time” is “25”. The new function table T6 is an information table of dynamic schedule target functions whose “ID” is “006”, “function name” is “new function f6”, and “processing time” is “20”.
また、動的スケジューリング部14は、機能テーブル記憶部13などから許容スキャンタイムを読み込んでおく。許容スキャンタイムは、1スキャンのうち、動的スケジュール対象機能に与えられるスキャン時間(処理時間の閾値)である。このため、許容スキャンタイム内に収まる範囲内であれば、許容スキャンタイム内で複数の動的スケジュール対象機能をスキャンさせてもよい。本実施の形態では、許容スキャンタイムが50μsecである場合について説明する。
The
動的スケジューリング部14は、機能テーブル記憶部13から読み込んだ動的スケジュール対象機能テーブル50に基づいて、初期スケジューリングテーブル51を作成する(ステップS120)。具体的には、動的スケジューリング部14は、新機能テーブルT1〜T6のそれぞれから「ID」、「機能名」、「処理時間」を抽出する。そして、動的スケジューリング部14は、各新機能テーブルT1〜T6の「ID」と「機能名」を、「ID」の値の小さい順番に並べて1つの情報テーブルを作成する。
The
図4は、初期スケジューリングテーブルの構成を示す図である。初期スケジューリングテーブル(機能名テーブル)51は、「スキャン番号」、「ID」、「機能名」、「処理時間」を対応付けした情報テーブルである。「スキャン番号」は、各動的スケジュール対象機能を1つずつスキャンしていく場合のスキャン順序である。 FIG. 4 is a diagram showing the configuration of the initial scheduling table. The initial scheduling table (function name table) 51 is an information table in which “scan number”, “ID”, “function name”, and “processing time” are associated with each other. The “scan number” is a scan order when each dynamic schedule target function is scanned one by one.
初期スケジューリングテーブル51では、各動的スケジュール対象機能に対して、「ID」の値の小さい順番にスキャン順序を設定している。具体的には、「ID」の値が最も小さい1つ目の動的スケジュール対象機能(新機能f1)には、スキャン順序として1スキャン目を設定し、「ID」の値が2番目に小さい2つ目の動的スケジュール対象機能(新機能f2)には、スキャン順序として2スキャン目を設定している。また、「ID」の値が3番目に小さい3つ目の動的スケジュール対象機能(新機能f3)には、スキャン順序として3スキャン目を設定し、「ID」の値が4番目に小さい4つ目の動的スケジュール対象機能(新機能f4)には、スキャン順序として4スキャン目を設定している。また、「ID」の値が5番目に小さい5つ目の動的スケジュール対象機能(新機能f5)には、スキャン順序として5スキャン目を設定し、「ID」の値が6番目に小さい6つ目の動的スケジュール対象機能(新機能f6)には、スキャン順序として6スキャン目を設定している。 In the initial scheduling table 51, the scan order is set in ascending order of the value of “ID” for each dynamic schedule target function. Specifically, for the first dynamic schedule target function (new function f1) having the smallest “ID” value, the first scan is set as the scan order, and the “ID” value is the second smallest. In the second dynamic schedule target function (new function f2), the second scan is set as the scan order. The third dynamic schedule target function (new function f3) having the third smallest value of “ID” is set to the third scan as the scan order, and the value of “ID” is the fourth smallest 4 In the first dynamic schedule target function (new function f4), the fourth scan is set as the scan order. The fifth dynamic schedule target function (new function f5) having the fifth smallest “ID” value sets the fifth scan as the scan order, and the sixth smallest “ID” value 6 In the first dynamic schedule target function (new function f6), the sixth scan is set as the scan order.
つぎに、動的スケジューリング部14は、作成した初期スケジューリングテーブル51の各新機能f1〜f6を処理時間の長い順番に並べ替えた処理時間順テーブル52を作成する(ステップS130)。
Next, the
図5は、処理時間順テーブルの構成を示す図である。処理時間順テーブル52は、初期スケジューリングテーブル51を処理時間の長い順番に並べ替えた情報テーブルである。初期スケジューリングテーブル51では、新機能f1と新機能f2の処理時間が50μsecであり、新機能f3と新機能f5の処理時間が25μsecであり、新機能f4と新機能f6の処理時間が20μsecである。 FIG. 5 is a diagram showing the configuration of the processing time order table. The processing time order table 52 is an information table in which the initial scheduling table 51 is rearranged in the order of long processing time. In the initial scheduling table 51, the processing time of the new function f1 and the new function f2 is 50 μsec, the processing time of the new function f3 and the new function f5 is 25 μsec, and the processing time of the new function f4 and the new function f6 is 20 μsec. .
したがって、処理時間順テーブル52では、「スキャン番号」以外の項目を、新機能f1、新機能f2、新機能f3、新機能f5、新機能f4、新機能f6の順番に並べ替えている。すなわち、初期スケジューリングテーブル51の、4スキャン目の動的スケジュール対象機能(新機能f4)と、5スキャン目の動的スケジュール対象機能(新機能f5)と、を入れ替えている。具体的には、4スキャン目の動的スケジュール対象機能を「ID」が「005」、「機能名」が「新機能f5」、「処理時間」が25μsecの動的スケジュール対象機能とし、5スキャン目の動的スケジュール対象機能を「ID」が「004」、「機能名」が「新機能f4」、「処理時間」が20μsecの動的スケジュール対象機能としている。 Therefore, in the processing time order table 52, items other than the “scan number” are rearranged in the order of the new function f1, the new function f2, the new function f3, the new function f5, the new function f4, and the new function f6. That is, the dynamic schedule target function for the fourth scan (new function f4) and the dynamic schedule target function for the fifth scan (new function f5) in the initial scheduling table 51 are interchanged. Specifically, the dynamic schedule target function in the fourth scan is set to “005”, “function name” is “new function f5”, and “processing time” is 25 μsec. The dynamic schedule target function of the eye is a dynamic schedule target function whose “ID” is “004”, “function name” is “new function f4”, and “processing time” is 20 μsec.
つぎに、動的スケジューリング部14は、処理時間順テーブル52と許容スキャンタイムに基づいて、各新機能のスキャン順序に関するスケジューリングを行なう。動的スケジューリング部14は、各新機能f1〜f6に対し、順番にスキャン順序(スキャン番号)を設定していく。
Next, the
動的スケジューリング部14は、設定対象となる「スキャン番号」をプラス1する(「スキャン番号」に1をプラスする)(ステップS140)。初期状態では、設定対象の「スキャン番号」が0であるので、動的スケジューリング部14は、0にプラス1して設定対象の「スキャン番号」を1(1スキャン目)とする。
The
そして、動的スケジューリング部14は、設定対象の新機能に設定対象の「スキャン番号」を割り付ける(ステップS150)。具体的には、動的スケジューリング部14は、設定対象の1つ目の新機能f1に、現在設定対象となっている「スキャン番号」の1を割り付ける。
Then, the
動的スケジューリング部14は、設定対象となっている「スキャン番号」に割り付けられた新機能の合計処理時間が許容スキャンタイムを超えているか否かを判断する(ステップS160)。
The
設定対象となっている「スキャン番号」に割り付けられた新機能の合計処理時間が許容スキャンタイムを超えている場合(ステップS160、No)、動的スケジューリング部14は、設定対象の新機能を次の新機能へ進める(ステップS170)。
When the total processing time of the new function assigned to the “scan number” to be set exceeds the allowable scan time (No at step S160), the
一方、設定対象となっている「スキャン番号」に割り付けられた新機能の合計処理時間が許容スキャンタイムを超えている場合(ステップS160、Yes)、動的スケジューリング部14は、設定対象の「スキャン番号」をプラス1する(ステップS140)。
On the other hand, when the total processing time of the new function assigned to the setting target “scan number” exceeds the allowable scan time (Yes in step S160), the
「スキャン番号」の1に割り付けられている新機能は新機能f1である。そして、この新機能f1の処理時間は50μsecであり、許容スキャンタイムの50μsecと同じである。したがって、動的スケジューリング部14は、設定対象の新機能を次の新機能へ進める。具体的には、動的スケジューリング部14は、ステップS170の処理として設定対象の新機能を新機能f1から次の新機能である新機能f2に進める。
The new function assigned to “scan number” 1 is the new function f1. The processing time of the new function f1 is 50 μsec, which is the same as the allowable scan time of 50 μsec. Therefore, the
そして、動的スケジューリング部14は、未割付の新機能があるか否かを判断する(ステップS180)。未割付の新機能f2があるので、動的スケジューリング部14は、未割付の新機能があると判断して(ステップS180、Yes)、設定対象の新機能に設定対象の「スキャン番号」を割り付ける(ステップS150)。具体的には、動的スケジューリング部14は、設定対象の2つ目の新機能f2に、現在設定対象となっている「スキャン番号」の1を割り付けてみる。
Then, the
そして、動的スケジューリング部14は、設定対象となっている「スキャン番号」に割り付けられた新機能の合計処理時間が許容スキャンタイムを超えているか否かを判断する(ステップS160)。
Then, the
「スキャン番号」の1に割り付けられている新機能は新機能f1と新機能f2である。そして、この新機能f1と新機能f2の合計処理時間は100μsecであり、許容スキャンタイムの50μsecを超えている。したがって、動的スケジューリング部14は、設定対象の「スキャン番号」をプラス1する(ステップS140)。具体的には、動的スケジューリング部14は、ステップS140の処理として「スキャン番号」の1にプラス1して設定対象の「スキャン番号」を2(2スキャン目)とする。
New functions assigned to “scan number” 1 are a new function f1 and a new function f2. The total processing time of the new function f1 and the new function f2 is 100 μsec, which exceeds the allowable scan time of 50 μsec. Therefore, the
そして、動的スケジューリング部14は、設定対象の新機能に設定対象の「スキャン番号」を割り付ける(ステップS150)。具体的には、動的スケジューリング部14は、設定対象となっている2つ目の新機能f2に、現在設定対象となっている「スキャン番号」の2を割り付ける。換言すると、動的スケジューリング部14は、新機能f2に設定した「スキャン番号」の1を「スキャン番号」の2に変更(再設定)する。
Then, the
動的スケジューリング部14は、設定対象となっている「スキャン番号」に割り付けられた新機能の合計処理時間が許容スキャンタイムを超えているか否かを判断する(ステップS160)。
The
「スキャン番号」の2に割り付けられている新機能は新機能f2である。そして、この新機能f2の処理時間は50μsecであり、許容スキャンタイムの50μsecと同じである。したがって、動的スケジューリング部14は、設定対象の新機能を次の新機能へ進める。具体的には、動的スケジューリング部14は、ステップS170の処理として設定対象の新機能を新機能f2から次の新機能である新機能f3に進める。
The new function assigned to “scan number 2” is the new function f2. The processing time of the new function f2 is 50 μsec, which is the same as the allowable scan time of 50 μsec. Therefore, the
そして、動的スケジューリング部14は、未割付の新機能があるか否かを判断する(ステップS180)。未割付の新機能f3があるので、動的スケジューリング部14は、未割付の新機能があると判断して(ステップS180、Yes)、設定対象の新機能に設定対象の「スキャン番号」を割り付ける(ステップS150)。具体的には、動的スケジューリング部14は、設定対象の3つ目の新機能f3に、現在設定対象となっている「スキャン番号」の2を割り付けてみる。
Then, the
そして、動的スケジューリング部14は、設定対象となっている「スキャン番号」に割り付けられた新機能の合計処理時間が許容スキャンタイムを超えているか否かを判断する(ステップS160)。
Then, the
「スキャン番号」の2に割り付けられている新機能は新機能f2と新機能f3である。そして、この新機能f2と新機能f3の合計処理時間は75μsecであり、許容スキャンタイムの50μsecを超えている。したがって、動的スケジューリング部14は、設定対象の「スキャン番号」をプラス1する(ステップS140)。具体的には、動的スケジューリング部14は、ステップS140の処理として「スキャン番号」の2にプラス1して設定対象の「スキャン番号」を3(3スキャン目)とする。
New functions assigned to “scan number” 2 are a new function f2 and a new function f3. The total processing time of the new function f2 and the new function f3 is 75 μsec, which exceeds the allowable scan time of 50 μsec. Therefore, the
そして、動的スケジューリング部14は、設定対象の新機能に設定対象の「スキャン番号」を割り付ける(ステップS150)。具体的には、動的スケジューリング部14は、設定対象となっている3つ目の新機能f3に、現在設定対象となっている「スキャン番号」の3を割り付ける。換言すると、動的スケジューリング部14は、新機能f3に設定した「スキャン番号」の2を「スキャン番号」の3に変更する。
Then, the
動的スケジューリング部14は、設定対象となっている「スキャン番号」に割り付けられた新機能の合計処理時間が許容スキャンタイムを超えているか否かを判断する(ステップS160)。
The
「スキャン番号」の3に割り付けられている新機能は新機能f3である。そして、この新機能f3の処理時間は25μsecであり、許容スキャンタイムの50μsecよりも短い時間である。したがって、動的スケジューリング部14は、設定対象の新機能を次の新機能へ進める。具体的には、動的スケジューリング部14は、ステップS170の処理として設定対象の新機能を新機能f3から次の新機能である新機能f5に進める。
A new function assigned to “scan number” 3 is a new function f3. The processing time of the new function f3 is 25 μsec, which is shorter than the allowable scan time of 50 μsec. Therefore, the
そして、動的スケジューリング部14は、未割付の新機能があるか否かを判断する(ステップS180)。未割付の新機能f5があるので、動的スケジューリング部14は、未割付の新機能があると判断して(ステップS180、Yes)、設定対象の新機能に設定対象の「スキャン番号」を割り付ける(ステップS150)。具体的には、動的スケジューリング部14は、設定対象の4つ目の新機能f5に、現在設定対象となっている「スキャン番号」の3を割り付けてみる。
Then, the
そして、動的スケジューリング部14は、設定対象となっている「スキャン番号」に割り付けられた新機能の合計処理時間が許容スキャンタイムを超えているか否かを判断する(ステップS160)。
Then, the
「スキャン番号」の3に割り付けられている新機能は新機能f3と新機能f5である。そして、この新機能f3と新機能f5の合計処理時間は50μsecであり、許容スキャンタイムの50μsecと同じである。したがって、動的スケジューリング部14は、設定対象の新機能を次の新機能へ進める。具体的には、動的スケジューリング部14は、ステップS170の処理として設定対象の新機能を新機能f5から次の新機能である新機能f4に進める。
New functions assigned to "scan number" 3 are a new function f3 and a new function f5. The total processing time of the new function f3 and the new function f5 is 50 μsec, which is the same as the allowable scan time of 50 μsec. Therefore, the
そして、動的スケジューリング部14は、未割付の新機能があるか否かを判断する(ステップS180)。未割付の新機能f4があるので、動的スケジューリング部14は、未割付の新機能があると判断して(ステップS180、Yes)、設定対象の新機能に設定対象の「スキャン番号」を割り付ける(ステップS150)。具体的には、動的スケジューリング部14は、設定対象の5つ目の新機能f4に、現在設定対象となっている「スキャン番号」の3を割り付けてみる。
Then, the
そして、動的スケジューリング部14は、設定対象となっている「スキャン番号」に割り付けられた新機能の合計処理時間が許容スキャンタイムを超えているか否かを判断する(ステップS160)。
Then, the
「スキャン番号」の3に割り付けられている新機能は新機能f3、新機能f5、新機能f4である。そして、この新機能f3〜新機能f5の合計処理時間は70μsecであり、許容スキャンタイムの50μsecを超えている。したがって、動的スケジューリング部14は、設定対象の「スキャン番号」をプラス1する(ステップS140)。具体的には、動的スケジューリング部14は、ステップS140の処理として「スキャン番号」の3にプラス1して設定対象の「スキャン番号」を4(4スキャン目)とする。
New functions assigned to “scan number” 3 are a new function f3, a new function f5, and a new function f4. The total processing time of these new functions f3 to f5 is 70 μsec, which exceeds the allowable scan time of 50 μsec. Therefore, the
そして、動的スケジューリング部14は、設定対象の新機能に設定対象の「スキャン番号」を割り付ける(ステップS150)。具体的には、動的スケジューリング部14は、設定対象となっている5つ目の新機能f4に、現在設定対象となっている「スキャン番号」の4を割り付ける。換言すると、動的スケジューリング部14は、新機能f4に設定した「スキャン番号」の3を「スキャン番号」の4に変更する。
Then, the
動的スケジューリング部14は、設定対象となっている「スキャン番号」に割り付けられた新機能の合計処理時間が許容スキャンタイムを超えているか否かを判断する(ステップS160)。
The
「スキャン番号」の4に割り付けられている新機能は新機能f4である。そして、この新機能f4の処理時間は20μsecであり、許容スキャンタイムの50μsecよりも短い時間である。したがって、動的スケジューリング部14は、設定対象の新機能を次の新機能へ進める。具体的には、動的スケジューリング部14は、ステップS170の処理として設定対象の新機能を新機能f4から次の新機能である新機能f6に進める。
A new function assigned to “scan number” 4 is a new function f4. The processing time of the new function f4 is 20 μsec, which is shorter than the allowable scan time of 50 μsec. Therefore, the
そして、動的スケジューリング部14は、未割付の新機能があるか否かを判断する(ステップS180)。未割付の新機能f6があるので、動的スケジューリング部14は、未割付の新機能があると判断して(ステップS180、Yes)、設定対象の新機能に設定対象の「スキャン番号」を割り付ける(ステップS150)。具体的には、動的スケジューリング部14は、設定対象の6つ目の新機能f6に、現在設定対象となっている「スキャン番号」の4を割り付けてみる。
Then, the
そして、動的スケジューリング部14は、設定対象となっている「スキャン番号」に割り付けられた新機能の合計処理時間が許容スキャンタイムを超えているか否かを判断する(ステップS160)。
Then, the
「スキャン番号」の4に割り付けられている新機能は新機能f4と新機能f6である。そして、この新機能f4と新機能f6の合計処理時間は40μsecであり、許容スキャンタイムの40μsecより短い時間である。したがって、動的スケジューリング部14は、設定対象の新機能を次の新機能へ進める。
New functions assigned to “scan number” 4 are a new function f4 and a new function f6. The total processing time of the new function f4 and the new function f6 is 40 μsec, which is shorter than the allowable scan time of 40 μsec. Therefore, the
そして、動的スケジューリング部14は、未割付の新機能があるか否かを判断する(ステップS180)。未割付の新機能が無いので、動的スケジューリング部14は、未割付の新機能が無いと判断して(ステップS180、No)、動的スケジュールの作成処理を終了する。これにより、動的スケジューリング部14によって作成される動的スケジューリングテーブルは、図6に示す動的スケジューリングテーブル53となる。
Then, the
動的スケジューリングテーブル(スキャン手順情報)53では、新機能f3と新機能f5の合計処理時間が50μsecであり、許容スキャンタイムを超えていないので、同じ「スキャン番号」の3が設定されている。また、新機能f3と新機能f5の合計処理時間が40μsecであり、許容スキャンタイムを超えていないので、同じ「スキャン番号」の4が設定されている。 In the dynamic scheduling table (scan procedure information) 53, the total processing time of the new function f3 and the new function f5 is 50 μsec and does not exceed the allowable scan time, so the same “scan number” of 3 is set. Further, since the total processing time of the new function f3 and the new function f5 is 40 μsec and does not exceed the allowable scan time, the same “scan number” of 4 is set.
これにより、1スキャン目〜4スキャン目までの各処理時間は、50μsec、50μsec、50μsec、40μsecとなり、平均化されている。換言すると、各スキャンの処理時間にばらつきがなくなっている。 Thus, the processing times from the first scan to the fourth scan are 50 μsec, 50 μsec, 50 μsec, and 40 μsec, and are averaged. In other words, there is no variation in the processing time of each scan.
なお、図2では、各スキャンで実行される新機能が1つまたは2つの場合について説明したが、許容スキャンタイムを超えなければ、各スキャンで実行される新機能は3つ以上であってもよい。 In FIG. 2, the case where one or two new functions are executed in each scan has been described. However, if the allowable scan time is not exceeded, three or more new functions may be executed in each scan. Good.
動的スケジューリング部14は、作成した動的スケジューリングテーブル53を、END処理部12に送り、END処理部12は、動的スケジューリングテーブル53に従って各新機能f1〜f6を実行する。
The
つぎに、シーケンサCPU1によるスキャン処理の手順について説明する。図7は、スキャン処理の処理手順を示すフローチャートである。図7では、シーケンサCPU1によるスキャン処理の手順として、シーケンスプログラム実行部11によるシーケンスプログラムの実行処理手順と、END処理部12によるEND処理手順とを示している。
Next, a procedure of scan processing by the sequencer CPU 1 will be described. FIG. 7 is a flowchart showing the processing procedure of the scan processing. FIG. 7 shows a sequence program execution processing procedure by the sequence
まず、シーケンスプログラム実行部11は、1スキャン目の処理としてラダープログラムを解析し、シーケンスプログラムを実行する(ステップS210)。END処理部12は、スキャン毎に実行が必要な基本機能をスキャンする。何れの機能が基本機能であるかを示す基本機能情報は、予め所定の記憶手段(例えば機能テーブル記憶部13)に格納しておき、END処理部12は、基本機能情報に基づいて基本機能のスキャンを実行する(ステップS220)。
First, the sequence
END処理部12は、基本機能のスキャンを実行した後に、現在は何スキャン目であるか(スキャン番号)を確認する(ステップS230)。そして、END処理部12は、動的スケジューリングテーブル53に従って、各スキャン処理時にスキャン番号に応じた新機能を実行していく。
After executing the basic function scan, the
現在のスキャンが1スキャン目である場合(ステップS230、1スキャン目)、動的スケジューリングテーブル53の1スキャン目には新機能f1が設定されているので、END処理部12は、新機能f1のスキャンを実行する(ステップS240)。これにより、シーケンサCPU1では、1スキャン目の処理を完了し、次のスキャン処理(2スキャン目)を実行する。
When the current scan is the first scan (step S230, the first scan), since the new function f1 is set for the first scan of the dynamic scheduling table 53, the
シーケンスプログラム実行部11は、2スキャン目の処理としてラダープログラムを解析し、シーケンスプログラムを実行する(ステップS210)。END処理部12は、スキャン毎に実行が必要な基本機能をスキャンする(ステップS220)。さらに、END処理部12は、現在は何スキャン目であるかを確認する(ステップS230)。
The sequence
現在のスキャンが2スキャン目である場合(ステップS230、2スキャン目)、動的スケジューリングテーブル53の2スキャン目には新機能f2が設定されているので、END処理部12は、新機能f2のスキャンを実行する(ステップS250)。これにより、シーケンサCPU1では、2スキャン目の処理を完了し、次のスキャン処理(3スキャン目)を実行する。
When the current scan is the second scan (step S230, the second scan), since the new function f2 is set for the second scan of the dynamic scheduling table 53, the
シーケンスプログラム実行部11は、3スキャン目の処理としてラダープログラムを解析し、シーケンスプログラムを実行する(ステップS210)。END処理部12は、スキャン毎に実行が必要な基本機能をスキャンする(ステップS220)。さらに、END処理部12は、現在は何スキャン目であるかを確認する(ステップS230)。
The sequence
現在のスキャンが3スキャン目である場合(ステップS230、3スキャン目)、動的スケジューリングテーブル53の3スキャン目には新機能f3と新機能f5が設定されているので、END処理部12は、新機能f3のスキャンと新機能f5のスキャンを実行する(ステップS260,S270)。これにより、シーケンサCPU1では、3スキャン目の処理を完了し、次のスキャン処理(4スキャン目)を実行する。
When the current scan is the third scan (step S230, the third scan), since the new function f3 and the new function f5 are set in the third scan of the dynamic scheduling table 53, the
シーケンスプログラム実行部11は、4スキャン目の処理としてラダープログラムを解析し、シーケンスプログラムを実行する(ステップS210)。END処理部12は、スキャン毎に実行が必要な基本機能をスキャンする(ステップS220)。さらに、END処理部12は、現在は何スキャン目であるかを確認する(ステップS230)。
The sequence
現在のスキャンが4スキャン目である場合(ステップS230、4スキャン目)、動的スケジューリングテーブル53の4スキャン目には新機能f4と新機能f6が設定されているので、END処理部12は、新機能f4のスキャンと新機能f6のスキャンを実行する(ステップS280,S290)。これにより、シーケンサCPU1では、4スキャン目の処理を完了する。
When the current scan is the fourth scan (step S230, the fourth scan), since the new function f4 and the new function f6 are set for the fourth scan of the dynamic scheduling table 53, the
動的スケジューリングテーブル53には、1スキャン目〜4スキャン目までが設定されているので、シーケンサCPU1は、1スキャン目〜4スキャン目まで実行すると、5スキャン目として再び1スキャン目を実行する。したがって、シーケンサCPU1では、4スキャン目を実行した後、次のスキャン処理として1スキャン目を実行する。これにより、シーケンサCPU1は、1スキャン目〜4スキャン目までの処理を繰り返す。このように、本実施の形態では、END処理部12は、動的スケジュール対象機能を、動的スケジューリング部14で決めたスキャン時に実行する。
Since the first to fourth scans are set in the dynamic scheduling table 53, the sequencer CPU 1 executes the first scan again as the fifth scan when the first to fourth scans are executed. Therefore, the sequencer CPU 1 executes the first scan as the next scan process after executing the fourth scan. Thereby, the sequencer CPU1 repeats the processes from the first scan to the fourth scan. As described above, in the present embodiment, the
ここで、本実施の形態におけるシーケンサCPU1と、従来用いられていたシーケンサCPUの動作の差異を明確にするため、従来用いられていたシーケンサCPUの動作手順について説明する。 Here, in order to clarify the difference in operation between the sequencer CPU 1 in the present embodiment and the conventionally used sequencer CPU, an operation procedure of the conventionally used sequencer CPU will be described.
従来のシーケンサCPUは、シーケンスプログラムの実行を行なった後、END処理で全ての機能のスキャンを実行している。換言すると、1回のスキャンで、シーケンスプログラムの実行と、スキャンが毎回必要な機能のスキャンと、所定回数に1回の割合でスキャンすればよい全ての機能のスキャンと、を行なっている。 A conventional sequencer CPU executes a scan of all functions in an END process after executing a sequence program. In other words, the execution of the sequence program, the scanning of functions that require scanning each time, and the scanning of all functions that only need to be scanned once every predetermined number of times are performed in one scan.
例えば、スキャンが毎回必要な機能が機能Xであり、所定回数に1回の割合でスキャンすればよい機能が、機能A、機能B、機能Cである場合、従来のシーケンサCPUでは、END処理を行なう度に、機能X、機能A、機能B、機能Cの全てのスキャンを行なっている。このため、1日に1回や10秒に1回など、所定回数に1回の割合でスキャンすればよい機能であっても、END処理で毎回スキャンされることとなり、スキャンタイムが遅延していた。 For example, when the function that needs to be scanned every time is the function X and the functions that should be scanned once every predetermined number of times are the function A, the function B, and the function C, the conventional sequencer CPU performs the END process. Every time it is performed, all of the functions X, A, B, and C are scanned. For this reason, even if it is a function that only needs to be scanned once a predetermined number of times, such as once a day or once every 10 seconds, the scan is delayed every time in the END process. It was.
一方、本実施の形態のシーケンサCPU1は、END処理でスキャンする新機能を、各スキャン処理に分割(配分)させている。このため、従来のように、所定回数に1回の割合でスキャンすればよい機能を、END処理で毎回スキャンすることはない。したがって、END処理に新機能f1〜f6などを追加した場合であっても、スキャン処理の負荷を分散させることが可能となる。 On the other hand, the sequencer CPU 1 according to the present embodiment divides (distributes) the new function to be scanned in the END process into each scan process. For this reason, unlike the prior art, a function that only needs to be scanned once every predetermined number of times is not scanned every time in the END process. Therefore, even when new functions f1 to f6 are added to the END process, it is possible to distribute the load of the scan process.
また、本実施の形態のシーケンサCPU1は、各スキャンでの新機能の合計処理時間が許容スキャンタイムを超えないよう各スキャンのスケジューリングを行なっているので、各スキャンの処理時間のばらつきを小さくし平均化することが可能となる。 In addition, the sequencer CPU 1 of the present embodiment schedules each scan so that the total processing time of the new functions in each scan does not exceed the allowable scan time. Can be realized.
また、本実施の形態のシーケンサCPU1は、各スキャンでの新機能の合計処理時間が許容スキャンタイムに近付くよう、各スキャンのスケジューリングを行なっているので、各スキャンの処理時間のばらつきを小さくし平均化することが可能となる。 In addition, since the sequencer CPU 1 of the present embodiment schedules each scan so that the total processing time of new functions in each scan approaches the allowable scan time, the variation in the processing time of each scan is reduced and averaged. Can be realized.
つぎに、シーケンサCPU1の具体的な構成の一例について説明する。図8は、シーケンサCPUを有したユニットの構成を示す図である。本実施の形態のシーケンサCPU1は、例えばCPU91、SDRAM(Synchronous Dynamic Random Access Memory)92、ASIC(Application Specific Integrated Circuit)93、FLASHメモリ94、BUS95、MC(Memory Card)96、USB(Universal Serial Bus)497などを有したユニット100として構成されており、ユニット100は、BUS95を介してプログラマブルコントローラ101のバックプレーン(シーケンサバス80)などに着脱自在に配設される。
Next, an example of a specific configuration of the sequencer CPU 1 will be described. FIG. 8 is a diagram showing a configuration of a unit having a sequencer CPU. The sequencer CPU 1 of the present embodiment includes, for example, a
また、プログラマブルコントローラ101のシーケンサバス80には、図示しない電源ユニットなどのユニット100以外のユニットが接続されており、各ユニット間で情報などの送受信を行なっている。
In addition, a unit other than the
ASIC93は、CPU91、SDRAM92、FLASHメモリ94、BUS95、MC96、USB97をそれぞれ接続している。ASIC93は、PCIバスなどを介してMC96、USB97などが接続されている。
The
ユニット100では、CPU91がEND処理部12や動的スケジューリング部14として動作し、FLASHメモリ94が動的スケジュール対象機能テーブル50を記憶しておく。また、ASIC93は、RAMやROM(Read Only Memory)を備えており、シーケンスプログラム実行部11として動作する。
In the
ASIC93は、シーケンスプログラム実行処理用のハードウェア要素を有するシーケンスプログラム実行処理用途向けのIC(Integrated Circuit)である。具体的には、ASIC93は、CPU91からシーケンスプログラムの実行を指示する処理要求が入力されると、ROM内からシーケンスプログラムの実行プログラムやアプリケーションプログラムなどを読み出してRAM内のプログラム格納領域に展開してシーケンスプログラムの実行に関する種々の処理を行なう。
The
なお、本実施の形態では、動的スケジュール対象機能となる新機能が新機能f1〜f6の6つである場合について説明したが、新機能は5つ以下であってもよいし、7つ以上であってもよい。 In the present embodiment, the case has been described where there are six new functions f1 to f6 as dynamic schedule target functions, but the number of new functions may be five or less, or seven or more. It may be.
また、本実施の形態では、図2に示した手順によって各スキャンの処理時間を平均化させたが、各スキャンの処理時間を平均化させる方法は他の方法であってもよい。例えば、設定対象の「スキャン番号」に割り付ける新機能を種々組み合わせることによって、各スキャンの処理時間を平均化させてもよい。この場合、種々の組み合わせの中から、各「スキャン番号」に割り付けられる新機能の合計処理時間のばらつき(標準偏差など)が最も小さい組合せなどを動的スケジューリング部14に設定する。
Further, in this embodiment, the processing time of each scan is averaged according to the procedure shown in FIG. 2, but the method of averaging the processing time of each scan may be another method. For example, the processing time of each scan may be averaged by combining various new functions assigned to the “scan number” to be set. In this case, among the various combinations, a combination having the smallest variation (standard deviation or the like) in the total processing time of the new function assigned to each “scan number” is set in the
また、本実施の形態では、初期スケジューリングテーブル51の各新機能f1〜f6を処理時間の長い順番に並べ替えた処理時間順テーブル52を作成してから動的スケジューリングテーブル53を作成したが、初期スケジューリングテーブル51の各新機能f1〜f6を処理時間の短い順番に並べ替えた処理時間順テーブル52を作成してから動的スケジューリングテーブル53を作成してもよい。 In this embodiment, the dynamic scheduling table 53 is created after creating the processing time order table 52 in which the new functions f1 to f6 of the initial scheduling table 51 are rearranged in the order of the longest processing time. The dynamic scheduling table 53 may be created after creating the processing time order table 52 in which the new functions f1 to f6 of the scheduling table 51 are rearranged in the order of short processing time.
また、本実施の形態では、初期スケジューリングテーブル51の各新機能f1〜f6を処理時間の長い順番に並べ替えた処理時間順テーブル52を作成してから動的スケジューリングテーブル53を作成したが、各新機能f1〜f6を処理時間などに基づいて並べ替えることなく、初期スケジューリングテーブル51から動的スケジューリングテーブル53を作成してもよい。 In the present embodiment, the dynamic scheduling table 53 is created after creating the processing time order table 52 in which the new functions f1 to f6 of the initial scheduling table 51 are rearranged in the order of the longest processing time. The dynamic scheduling table 53 may be created from the initial scheduling table 51 without rearranging the new functions f1 to f6 based on the processing time.
また、各スキャンの処理時間を平均化させた後、各「スキャン番号」に割り付けられる新機能の合計処理時間に所定の待機時間を加算して、それぞれの合計処理時間を許容スキャンタイムと同じ時間になるよう、各スキャンの処理時間を調整してもよい。 Also, after averaging the processing time of each scan, add a predetermined waiting time to the total processing time of the new function assigned to each “scan number”, and make the total processing time the same as the allowable scan time. The processing time of each scan may be adjusted so that
また、本実施の形態では、各スキャンでの新機能の合計処理時間が許容スキャンタイムを超えないよう各スキャンのスケジューリングを行なったが、各スキャンでの新機能の合計処理時間が許容スキャンタイムに近付くよう各スキャンのスケジューリングを行なってもよい。例えば、新機能の合計処理時間と許容スキャンタイムとの差が所定の範囲内に入るよう各スキャンのスケジューリングを行なうことによって、スキャンタイムを平均化することができる。 In this embodiment, scheduling of each scan is performed so that the total processing time of new functions in each scan does not exceed the allowable scan time. However, the total processing time of new functions in each scan is set to the allowable scan time. You may schedule each scan so that it may approach. For example, the scan times can be averaged by scheduling each scan so that the difference between the total processing time of the new functions and the allowable scan time falls within a predetermined range.
このように実施の形態1によれば、新機能f1〜f6のスキャンを複数回のスキャンに分配し、スキャン処理の負荷分散を行なっているので、簡易な構成で容易にスキャンタイムの遅延を防止できる。また、スキャンタイムを平均化しているので、プログラマブルコントローラによって制御される被制御装置の動作を簡易な構成で容易に安定させることが可能となる。 As described above, according to the first embodiment, the scans of the new functions f1 to f6 are distributed to a plurality of scans, and the load of the scan process is distributed. Therefore, the scan time can be easily prevented with a simple configuration. it can. Further, since the scan times are averaged, the operation of the controlled device controlled by the programmable controller can be easily stabilized with a simple configuration.
また、予め作成されている動的スケジュール対象機能テーブル50を用いて動的スケジューリングテーブル53を作成しているので、簡易な構成で容易にEND処理のスケジューリングを行なうことが可能となる。 In addition, since the dynamic scheduling table 53 is created using the dynamic schedule target function table 50 created in advance, it is possible to easily schedule the END process with a simple configuration.
実施の形態2.
つぎに、図9および図10を用いてこの発明の実施の形態2について説明する。実施の形態2では、新機能f1〜f6のスキャンに要する時間(実行時間)を測定し、この測定結果に基づいて動的スケジューリングテーブル53を作成する。
Embodiment 2. FIG.
Next, a second embodiment of the present invention will be described with reference to FIGS. In the second embodiment, the time (execution time) required for scanning the new functions f1 to f6 is measured, and the dynamic scheduling table 53 is created based on the measurement result.
図9は、本発明の実施の形態2に係るプログラマブルコントローラのシーケンサCPUの構成を示す図である。図9の各構成要素のうち図1に示す実施の形態1のシーケンサCPU1と同一機能を達成する構成要素については同一番号を付しており、重複する説明は省略する。 FIG. 9 is a diagram showing a configuration of the sequencer CPU of the programmable controller according to the second embodiment of the present invention. Among the constituent elements in FIG. 9, constituent elements that achieve the same functions as those of the sequencer CPU 1 of the first embodiment shown in FIG. 1 are given the same numbers, and redundant descriptions are omitted.
シーケンサCPU2は、シーケンスプログラム実行部11、END処理部12、機能テーブル記憶部13、動的スケジューリング部14に加えて、実行時間測定部21を有している。
The sequencer CPU 2 includes an execution
実行時間測定部21は、END処理部12および動的スケジューリング部14に接続している。実行時間測定部21は、END処理部12から受ける新機能f1〜f6のスキャン開始通知とスキャン終了通知に基づいて、各新機能f1〜f6の実行時間(処理時間)を測定する。実行時間測定部21は、測定した各新機能f1〜f6の実行時間を動的スケジューリング部14に送る。
The execution
本実施の形態では、動的スケジューリング部14は、実行時間測定部21から送られてくる新機能f1〜f6の実行時間を用いて各新機能を何スキャン目に実行するかの動的スケジューリングを行う。
In the present embodiment, the
つぎに、シーケンサCPU2の動作手順として、動的スケジューリング部14による動的スケジュールの作成処理手順について説明する。なお、図2で説明した実施の形態1のシーケンサCPU1と同様の処理を行なう手順については、その説明を省略する。
Next, a procedure for creating a dynamic schedule by the
図10は、実施の形態1に係るシーケンサCPUの動的スケジュール作成処理手順を示すフローチャートである。シーケンサCPU2へは、新機能f1〜f6のデフォルトの処理時間(実行時間)を登録しておく。登録しておくデフォルトの処理時間は、図4に示した初期スケジューリングテーブル51であってもよいし、図5に示した処理時間順テーブル52であってもよい。また、図6に示した動的スケジューリングテーブル53であってもよい。また、各新機能f1〜f6の処理時間を0に設定登録しておいてもよい。新機能f1〜f6のデフォルトの処理時間は、デフォルトのスケジューリングテーブルとして、例えば機能テーブル記憶部13などの記憶手段に格納しておく(ステップS310,S320)。
FIG. 10 is a flowchart showing a dynamic schedule creation processing procedure of the sequencer CPU according to the first embodiment. The default processing time (execution time) of the new functions f1 to f6 is registered in the sequencer CPU2. The default processing time to be registered may be the initial scheduling table 51 shown in FIG. 4 or the processing time order table 52 shown in FIG. Moreover, the dynamic scheduling table 53 shown in FIG. 6 may be used. Further, the processing times of the new functions f1 to f6 may be set and registered as 0. The default processing times of the new functions f1 to f6 are stored in a storage means such as the function
この後、シーケンサCPU2は、予め登録しておいたデフォルトのスケジューリングテーブルに基づいてスキャン処理を開始する(ステップS330)。シーケンサCPU2では、シーケンスプログラム実行部11によるシーケンスプログラム実行処理とEND処理部12によるEND処理とを行なう。例えば、デフォルトのスケジューリングテーブルが図6に示した動的スケジューリングテーブル53の場合、シーケンサCPU2は、図7に示したスキャン処理の処理手順にしたがってスキャン処理を行なう。
Thereafter, the sequencer CPU 2 starts a scanning process based on a default scheduling table registered in advance (step S330). The sequencer CPU 2 performs sequence program execution processing by the sequence
このとき、END処理部12は、各新機能f1〜f6のスキャンを開始する際に、実行時間測定部21にスキャンの開始通知を送る。また、END処理部12は、各新機能f1〜f6のスキャンを終了する際に、実行時間測定部21にスキャンの終了通知を送る。
At this time, the
実行時間測定部21は、各新機能f1〜f6の開始通知から終了通知までの時間を、AISICに内蔵されているμsecカウンタなどで新機能f1〜f6毎に計測する。具体的には、新機能f1〜f6の開始通知があるとμsecカウンタを開始し、新機能f1〜f6の終了通知があるとμsecカウンタを停止させ、μsecカウンタの開始から停止までの時間をスキャンの実行時間とする。これにより、実行時間測定部21は、新機能f1〜f6の各実行時間を測定する(ステップS340)。
The execution
実行時間測定部21は、デフォルトのスケジューリングテーブルに設定されている新機能の実行時間を全て測定すると、測定した各新機能f1〜f6の実行時間を動的スケジューリング部14に送るとともに、再スケジューリング要求フラグをONさせる。
When the execution
動的スケジューリング部14は、実行時間測定部21から送られてくる新機能f1〜f6の実行時間を用いて、初期スケジューリングテーブル51の作成を行なう(ステップS350)。動的スケジューリング部14は、作成した初期スケジューリングテーブル51を機能テーブル記憶部13に格納する。
The
なお、機能テーブル記憶部13内に既に初期スケジューリングテーブル51がある場合、動的スケジューリング部14は、既に格納されている初期スケジューリングテーブル51を、作成した初期スケジューリングテーブル51で上書きする。
When the initial scheduling table 51 already exists in the function
この後、シーケンサCPU2は、シーケンサCPU1と同様の処理によって、処理時間順テーブル52を作成し、その後、動的スケジューリングテーブル53を作成(再設定)する(ステップS360,S370)。この処理時間順テーブル52と動的スケジューリングテーブル53の作成処理は、図2に示したステップS130〜S180の処理に対応している。 Thereafter, the sequencer CPU 2 creates the processing time order table 52 by the same process as the sequencer CPU 1, and then creates (resets) the dynamic scheduling table 53 (steps S 360 and S 370). The processing for creating the processing time order table 52 and the dynamic scheduling table 53 corresponds to the processing in steps S130 to S180 shown in FIG.
シーケンサCPU2は、作成した動的スケジューリングテーブル53に従って、スキャン処理を行なう。シーケンサCPU2は、シーケンサCPU1と同様の処理手順によってスキャン処理を行なうのでその説明を省略する。 The sequencer CPU 2 performs a scan process according to the created dynamic scheduling table 53. Since the sequencer CPU 2 performs the scan process according to the same processing procedure as the sequencer CPU 1, description thereof is omitted.
この後、シーケンサCPU2では、スキャン処理を行なう度に、実行時間測定部21が新機能f1〜f6の各実行時間を測定し、動的スケジューリング部14が動的スケジューリングテーブル53を作成する処理を繰り返す(ステップS330〜S370)。このとき、シーケンサCPU2で、新機能f1〜f6の何れかの実行時間が変動した場合に、動的スケジューリング部14が動的スケジューリングテーブル53を再作成し、新機能f1〜f6の何れかの実行時間が変動していなければ動的スケジューリング部14は動的スケジューリングテーブル53の作成を行なわない。
Thereafter, in the sequencer CPU 2, every time the scan process is performed, the execution
なお、動的スケジューリングテーブル53を再作成するか否か(実行時間を測定するか否か)は、再スケジューリングのあり/なし設定により判断してもよい。この再スケジューリングのあり/なし設定は、予め使用者が設定してもよいし、実行時間の測定実績(履歴)に基づいて、シーケンサCPU2(END処理部12、動的スケジューリング部14、実行時間測定部21)が設定してもよい。例えば、測定した実行時間が所定回数変動しなければ、シーケンサCPU2は、再スケジューリングを行なわない。なお、本実施の形態では、図8に示したユニット100のCPU91が、END処理部12、動的スケジューリング部14、実行時間測定部21として動作する。
Whether or not to recreate the dynamic scheduling table 53 (whether or not to measure the execution time) may be determined based on the setting of rescheduling. This rescheduling presence / absence setting may be set in advance by the user, or based on the measurement result (history) of the execution time, the sequencer CPU 2 (END processing
このように実施の形態2によれば、実際に測定した各新機能f1〜f6の実行時間に基づいて、動的スケジューリングテーブル53を作成しているので、各スキャンでの処理時間を正確に平均化することが可能となる。これにより、実施の形態1のシーケンサCPU1よりも、効率良くスキャン処理の負荷分散を行なうことが可能となる。したがって、実施の形態1のシーケンサCPU1よりも効率良くスキャンタイムの遅延を防止できる。またプログラマブルコントローラによって制御される被制御装置の動作を、実施の形態1のシーケンサCPU1よりも安定させることが可能となる。 As described above, according to the second embodiment, the dynamic scheduling table 53 is created based on the actually measured execution times of the new functions f1 to f6, so that the processing time in each scan is accurately averaged. Can be realized. As a result, the load distribution of the scan process can be performed more efficiently than the sequencer CPU 1 of the first embodiment. Therefore, it is possible to prevent the scan time from being delayed more efficiently than the sequencer CPU 1 of the first embodiment. Further, the operation of the controlled device controlled by the programmable controller can be made more stable than the sequencer CPU 1 of the first embodiment.
また、実際に測定した各新機能f1〜f6の実行時間に基づいて、動的スケジューリングテーブル53を再作成しているので、各スキャンでの処理時間が変動した場合であっても各スキャンでの処理時間を正確に平均化することが可能となる。 Further, since the dynamic scheduling table 53 is recreated based on the actually measured execution times of the new functions f1 to f6, even if the processing time in each scan varies, The processing time can be accurately averaged.
以上のように、本発明に係るプログラマブルコントローラは、END処理のスケジューリングに適している。 As described above, the programmable controller according to the present invention is suitable for scheduling of END processing.
1,2 シーケンサCPU
11 シーケンスプログラム実行部
12 END処理部
13 機能テーブル記憶部
14 動的スケジューリング部
21 実行時間測定部
50 動的スケジュール対象機能テーブル
51 初期スケジューリングテーブル
52 処理時間順テーブル
53 動的スケジューリングテーブル
80 シーケンサバス
91 CPU
92 SDRAM
93 ASIC
94 FLASHメモリ
95 BUS
96 MC
97 USB
100 ユニット
101 プログラマブルコントローラ
T1〜T6 新機能テーブル
1, 2 Sequencer CPU
DESCRIPTION OF
92 SDRAM
93 ASIC
94
96 MC
97 USB
100
Claims (2)
前記END処理を行なう際に所定回数のスキャン毎に1回の割合で実行すればよい所定回限定スキャン機能を何回目のスキャンで実行するかをスケジューリングして、各スキャン毎の所定回限定スキャン機能をスキャン手順情報として設定するスケジューリング部と、
各スキャンを実行する際に、前記END処理として毎回実行する必要のある機能と、前記スキャン手順情報に従って、各回のスキャンに設定されている前記所定回限定スキャン機能と、を実行するEND処理部と、
前記各スキャンの実行時間を測定する実行時間測定部と、
を備え、
前記スケジューリング部は、前記実行時間測定部が測定した各スキャンの実行時間に基づいて、各回のスキャンに設定される前記所定回限定スキャン機能の実行に要する合計時間がそれぞれ所定の範囲内に入るようスキャン手順情報を設定し、
前記実行時間測定部は、前記スケジューリング部において設定された前記スキャン手順情報に従って前記END処理部がEND処理を行なっている間に、前記各スキャンの実行時間を再測定し、
前記スケジューリング部は、前記実行時間測定部が再測定した各スキャンの実行時間に基づいて前記スキャン手順情報を再設定することを特徴とするプログラマブルコントローラ。 In a programmable controller that performs sequence control while executing sequence program execution processing and END processing,
When the END process is performed, a predetermined number of scans that should be executed at a rate of once per predetermined number of scans are scheduled to be executed at what number of scans. A scheduling unit for setting as scan procedure information;
In performing the scan, a function that must be performed each time as the END processing, according to the scanning procedure information, and END processing unit for executing said a predetermined time limit scan function that is set in each round of scanning, ,
An execution time measuring unit for measuring the execution time of each scan;
With
Based on the execution time of each scan measured by the execution time measurement unit , the scheduling unit is configured so that the total time required to execute the predetermined scan function set for each scan falls within a predetermined range. Set scan procedure information,
The execution time measurement unit remeasures the execution time of each scan while the END processing unit is performing END processing according to the scan procedure information set in the scheduling unit,
The programmable controller , wherein the scheduling unit resets the scan procedure information based on an execution time of each scan remeasured by the execution time measurement unit .
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008024249A JP4901775B2 (en) | 2008-02-04 | 2008-02-04 | Programmable controller |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008024249A JP4901775B2 (en) | 2008-02-04 | 2008-02-04 | Programmable controller |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2009187124A JP2009187124A (en) | 2009-08-20 |
JP4901775B2 true JP4901775B2 (en) | 2012-03-21 |
Family
ID=41070326
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2008024249A Expired - Fee Related JP4901775B2 (en) | 2008-02-04 | 2008-02-04 | Programmable controller |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4901775B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2012056537A1 (en) * | 2010-10-27 | 2012-05-03 | 三菱電機株式会社 | Programmable controller |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP3493616B2 (en) * | 1998-03-03 | 2004-02-03 | オムロン株式会社 | Control device |
JP3356077B2 (en) * | 1998-09-29 | 2002-12-09 | 三菱電機株式会社 | How to make the output interval constant when setting the constant scan of the programmable controller |
-
2008
- 2008-02-04 JP JP2008024249A patent/JP4901775B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2009187124A (en) | 2009-08-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4016010B2 (en) | Real-time scheduling possibility determination method and real-time system | |
JP2006221611A (en) | Resource management device | |
JP2010231694A (en) | System, method and program for supporting job schedule change | |
JP4901775B2 (en) | Programmable controller | |
CN112860390A (en) | Job scheduling program, information processing apparatus, and job scheduling method | |
US20080034140A1 (en) | Bus Arbitrating Device and Bus Arbitrating Method | |
JP5726006B2 (en) | Task and resource scheduling apparatus and method, and control apparatus | |
US10649934B2 (en) | Image processing apparatus, notification monitoring program, and notification monitoring method | |
KR20130022707A (en) | Periodic and aperiodic task scheduling algorithm based on topological sort and residual time | |
Gratia et al. | Adaptation of run to mixed-criticality systems | |
JP2001256064A (en) | Optimization scheduling system of plural periodic performance tasks | |
US20210374652A1 (en) | Storage medium, job scheduling device, and job scheduling method | |
Aijaz et al. | Efficient round robin algorithm (ERRA) using the average burst time | |
Bartal et al. | On the value of preemption in scheduling | |
JPS62210546A (en) | Job schedule processing system | |
US20160364264A1 (en) | Multiple processor core interrupt priority levels | |
JP2002006944A (en) | Indicator with control function | |
D’Souza et al. | Optimal round robin CPU scheduling algorithm using euclidean distance | |
US11281180B2 (en) | Programmable controller | |
KR20190105356A (en) | Programmable logic controller system | |
CN113711192B (en) | Information processing apparatus | |
JP6435911B2 (en) | Information processing apparatus, activation processing method, and activation processing program | |
Davis et al. | What is the exact speedup factor for fixed priority pre-emptive versus fixed priority non-pre-emptive scheduling? | |
JP4955205B2 (en) | Arbitration device and arbitration method | |
JPS6388646A (en) | Job corresponding cpu resource averaging system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20100614 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20110824 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20110920 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20111108 |
|
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: 20111129 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20111227 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 Ref document number: 4901775 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20150113 Year of fee payment: 3 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
LAPS | Cancellation because of no payment of annual fees |