Ethernet/IPのConnection設定するときに、そのTransfer formatが気になったことがありますか?普段はEDSからImportすると誰も気にしませんが、このようにGeneric_EtherNet_IP_deviceからConnectionを構築すると正しく設定しないと通信できません。特にRobot ControllerではほぼInstance番号とData Sizeしか入力できませんので、このパラメータを一緒に見てみましょう。
Real time formats
Class0/1のConnectionでは必ずPackets内で以下のFormatを送信することが必要です。
- Modeless format- Run/Idle通知なし
- Zero Length Data Format-Idle通知含め
- Heartbeat Format- Run/Idle通知なし
- 32Bit Header format-Run/idle通知あり
- Safety Format-今回の記事で説明しません。
注意するのはそのReal Time formatはTargetデバイスにより対応できるFormatが変わり、その対応FormatはEDS File内に記載されています。EDS FilesからのConnection構築する場合、Configuration ToolsがO>TとT>O間でReal Time formatを一目瞭然にします。
もちろん、Realtime Formatを正しく設定しないとConnectionの成立ができません。
Modeless Format
Modeless FormatのPacketでは0-n Bytesまでのアプリケーションデータが含まれ、Run/idle通知が入ってないんです。そのNetwork Connection sizeはFixedでもVariableでもOKです。
Class0 Real-Time Packets
0-n Bytesまでのアプリケーションデータ
Class1 modeless real time Packets
2 BytesのSequence count + 0-n Bytesまでのアプリケーションデータ

Zero Length Data Format
Zero Lengthでは1-n BytesのProducer アプリケーションデータとRun ModeがPackets内に含まれています。もしZero length Data Format+ 0bytesのアプリケーションデータなら、Producer がいまIdle Modeだと示してます。そのNetwork Connection sizeは必ずVariablesです。

Heartbeat Format
Heartbeat formatではPackets内で0Bytesのアプリケーションデータ、なおかつRun/idle通知が入っていないんです。そのNetwork Connection sizeは必ずFixedです。

32-Bit Header Format
その32Bit Header Formatが0-n Bytesまでのアプリケーションデータに含まれるだけではなく、32BitのReal-time formatも入っています。
HeaderのFormatは以下になります。
そのRun/idle(Bit 0)はTrueであるとRunの状態を示して、その状態をTargetに知らせる必要があります。ROOとCOOはRedundant Ownerで使うので今回は説明しません。そしてBit4-31はReservedで必ず0にしてください。

そのRun/idle(Bit 0)はTrueであるとRunの状態を示して、その状態をTargetに知らせる必要があります。ROOとCOOはRedundant Ownerで使うので今回は説明しません。そしてBit4-31はReservedで必ず0にしてください。

Test By Codesys

Case1 32 Bit Header x Modeless
Case1ではO->TのTrasnfer formatを32Bit Header、T->OはModelessに設定しています。

こちらはO>TのPacktesです。
Ethernet/IPのPacket見ますと、データのLengthは32ではなく38Byteですね。
先に書いたように、32BitHeaderでは2Byte のSequence count+32Bit Real time header+ 0-N Bytes アプリケーションデータ(IO)なので、2+4+32=38Bytesになる。

ではTargetからScannerのアプリケーションデータを見てみましょう。
中のPacketsを覗くとLength=34ですね。
Modelessの設定なので、Class1だと2BytesのSequence count+0-n Bytesのアプリケーションデータになります。つまり2+32=34Bytesです。

Case2 Heartbeat
Case2ではO->TのTrasnfer formatをHeartBeatに設定しています。

次はCodesysからPathで、Trasnfer FormatをHeartbeatに設定し、ここで少しO>TのSizeを2Bytesで設定してみますね。
そうするとCodesysからMessageが出てきます。
View>MessagesでMessageを一覧できます。
Warning(s)だけをFilterし、The connection *Generic connection* is a heartbeat connection, but the connection size>0.だと言われています。
先にも言いましたが、Class1のHeartbeat Real-Time Packetは、2BytesのSequence count+0Bytesのアプリケーションデータなので、Codesysがこの設定が正しくないよと怒られています。

もう1度設定を見直しします。
Packetsを覗いてみますね。
Ethernet/IPのPackets見ますと、Lengthは2でデータは0000ですね。
その2は2BytesのSequence countのことです。