Omron K6CM User Manual page 231

Motor condition
Hide thumbs Also See for K6CM:
Table of Contents

Advertisement

 K6CM Sample Program Code Descriptions
// K6CM Sample Program
// Initialization
IF ( P_First_Run = TRUE ) THEN
iNumOfUnits := UINT#20;
// the number of data collection units (up to 100)
iRetryValue := UINT#1;
// retry times for communications error
tOutputCycle := T#30s;
// data collection cycle time (should be over 20 sec)
iNumOfParallel := UINT#10; // the unit number of parallel connection (up to 10)
iCIPTimeOut := UINT#10;
// CIP timeout (x 0.1 sec)
sIPAddress[UINT#0] := '192.168.250.101'; // connected IP address (up to 100 units)
sIPAddress[UINT#1] := '192.168.250.102'; // handled sequentially from top
sIPAddress[UINT#2] := '192.168.250.103'; // as only the amount set by iNumOfUnits
sIPAddress[UINT#3] := '192.168.250.104';
sIPAddress[UINT#4] := '192.168.250.105';
sIPAddress[UINT#5] := '192.168.250.106';
sIPAddress[UINT#6] := '192.168.250.107';
sIPAddress[UINT#7] := '192.168.250.108';
sIPAddress[UINT#8] := '192.168.250.109';
sIPAddress[UINT#9] := '192.168.250.110';
sIPAddress[UINT#10] := '192.168.250.111';
sIPAddress[UINT#11] := '192.168.250.112';
sIPAddress[UINT#12] := '192.168.250.113';
sIPAddress[UINT#13] := '192.168.250.114';
sIPAddress[UINT#14] := '192.168.250.115';
sIPAddress[UINT#15] := '192.168.250.116';
sIPAddress[UINT#16] := '192.168.250.117';
sIPAddress[UINT#17] := '192.168.250.118';
sIPAddress[UINT#18] := '192.168.250.119';
sIPAddress[UINT#19] := '192.168.250.120';
sIPAddress[UINT#20] := '192.168.250.121';
sIPAddress[UINT#21] := '192.168.250.122';
sIPAddress[UINT#22] := '192.168.250.123';
sIPAddress[UINT#23] := '192.168.250.124';
sIPAddress[UINT#24] := '192.168.250.125';
sIPAddress[UINT#25] := '192.168.250.126';
sIPAddress[UINT#26] := '192.168.250.127';
sIPAddress[UINT#27] := '192.168.250.128';
sIPAddress[UINT#28] := '192.168.250.129';
sIPAddress[UINT#29] := '192.168.250.130';
sIPAddress[UINT#30] := '192.168.250.131';
sIPAddress[UINT#31] := '192.168.250.132';
sIPAddress[UINT#32] := '192.168.250.133';
sIPAddress[UINT#33] := '192.168.250.134';
sIPAddress[UINT#34] := '192.168.250.135';
sIPAddress[UINT#35] := '192.168.250.136';
sIPAddress[UINT#36] := '192.168.250.137';
sIPAddress[UINT#37] := '192.168.250.138';
sIPAddress[UINT#38] := '192.168.250.139';
sIPAddress[UINT#39] := '192.168.250.140';
sIPAddress[UINT#40] := '192.168.250.141';
sIPAddress[UINT#41] := '192.168.250.142';
sIPAddress[UINT#42] := '192.168.250.143';
sIPAddress[UINT#43] := '192.168.250.144';
sIPAddress[UINT#44] := '192.168.250.145';
sIPAddress[UINT#45] := '192.168.250.146';
sIPAddress[UINT#46] := '192.168.250.147';
sIPAddress[UINT#47] := '192.168.250.148';
sIPAddress[UINT#48] := '192.168.250.149';
sIPAddress[UINT#49] := '192.168.250.150';
sIPAddress[UINT#50] := '192.168.250.151';
sIPAddress[UINT#51] := '192.168.250.152';
sIPAddress[UINT#52] := '192.168.250.153';
sIPAddress[UINT#53] := '192.168.250.154';
sIPAddress[UINT#54] := '192.168.250.155';
sIPAddress[UINT#55] := '192.168.250.156';
sIPAddress[UINT#56] := '192.168.250.157';
sIPAddress[UINT#57] := '192.168.250.158';
sIPAddress[UINT#58] := '192.168.250.159';
sIPAddress[UINT#59] := '192.168.250.160';
sIPAddress[UINT#60] := '192.168.250.161';
sIPAddress[UINT#61] := '192.168.250.162';
sIPAddress[UINT#62] := '192.168.250.163';
sIPAddress[UINT#63] := '192.168.250.164';
sIPAddress[UINT#64] := '192.168.250.165';
sIPAddress[UINT#65] := '192.168.250.166';
sIPAddress[UINT#66] := '192.168.250.167';
sIPAddress[UINT#67] := '192.168.250.168';
sIPAddress[UINT#68] := '192.168.250.169';
sIPAddress[UINT#69] := '192.168.250.170';
sIPAddress[UINT#70] := '192.168.250.171';
sIPAddress[UINT#71] := '192.168.250.172';
sIPAddress[UINT#72] := '192.168.250.173';
sIPAddress[UINT#73] := '192.168.250.174';
sIPAddress[UINT#74] := '192.168.250.175';
sIPAddress[UINT#75] := '192.168.250.176';
sIPAddress[UINT#76] := '192.168.250.177';
sIPAddress[UINT#77] := '192.168.250.178';
sIPAddress[UINT#78] := '192.168.250.179';
sIPAddress[UINT#79] := '192.168.250.180';
sIPAddress[UINT#80] := '192.168.250.181';
sIPAddress[UINT#81] := '192.168.250.182';
sIPAddress[UINT#82] := '192.168.250.183';
sIPAddress[UINT#83] := '192.168.250.184';
sIPAddress[UINT#84] := '192.168.250.185';
sIPAddress[UINT#85] := '192.168.250.186';
sIPAddress[UINT#86] := '192.168.250.187';
sIPAddress[UINT#87] := '192.168.250.188';
sIPAddress[UINT#88] := '192.168.250.189';
sIPAddress[UINT#89] := '192.168.250.190';
sIPAddress[UINT#90] := '192.168.250.191';
sIPAddress[UINT#91] := '192.168.250.192';
sIPAddress[UINT#92] := '192.168.250.193';
sIPAddress[UINT#93] := '192.168.250.194';
sIPAddress[UINT#94] := '192.168.250.195';
sIPAddress[UINT#95] := '192.168.250.196';
sIPAddress[UINT#96] := '192.168.250.197';
sIPAddress[UINT#97] := '192.168.250.198';
sIPAddress[UINT#98] := '192.168.250.199';
sIPAddress[UINT#99] := '192.168.250.200';
// set enable status (for the number of data collection units)
Clear(bEnable);
FOR iWk1 := UINT#0 TO iNumOfUnits - UINT#1 BY UINT#1 DO
bEnable[iWk1] := TRUE;
END_FOR;
// set the first cycle flag
bTimeMeas := FALSE;
bFirstOutput := TRUE;
bFirstOutputDone := FALSE;
bOutput := FALSE;
K6CM Motor Condition Monitoring Device User's Manual (N219)
8 Monitoring and Setting Using the EtherNet/IP Devices
[Initial setting] iNumOfUnits
Sets the number of K6CM devices to be used (up to 100 can be set).
If it is set more than the number to be used, wait time will be generated at initial setting, so set it
according to the actual number to be used.
[Initial setting] iRetryValue
Sets the number of retries at communications error between the PLC and the K6CM devices. (Initial value: 1)
In the initial state, it is set to 0. Therefore, the collected data of the device that caused the communications error is treated as
unmeasured, so communications are not retried. This makes it possible to prioritize the data collection cycle.
On the other hand, if you increase the number of retries, communications will be retried on basis of the set number of times even if
communications error occurs. This makes it possible to prioritize the data collection of the device. However, the data collection cycle
should also be longer because the waiting time becomes longer.
[Initial setting] tOutputCycle
Sets the data collection cycle. (Initial value: 30 s)
If the number of retries or the CIP timeout value is increased from the initial value and a communications error occurs in that state, the waiting
time will be longer. As a result, the data collection processing may not be completed within the data collection cycle.
Calculate the maximum waiting time using the following calculation formula and then set a data collection cycle larger than the calculation
result.
Maximum waiting time [sec] = (CIP timeout time × 4) × (1 + communications retry count) × number of cycles+ CSV output time
* The number of cycles is an integer (the decimal point is rounded up) obtained by dividing the number of data collection devices by the number
of parallel connection.
Example: calculation with initial value
Maximum waiting time = (1 × 4) × (1 + 1) × (20 ÷ 10) + 4 = 20 s→ The data collection cycle requires 10 s or more with a margin
[Initial setting] iNumOfParallel
Sets the number of K6CM devices to be connected (i.e., communicate) with the PLC at one time. (Initial
value: 10)
In this program, it is assumed that the number of connections at one time is 10 or less, and it is not normally
necessary to change from the initial value, but if you incorporate this program into another program, change it
as necessary.
In that case, note that the maximum number of clients that PLC can communicate at one time is 32.
In the K6CM-dedicated FB (K6CM_Read), a total of three communications processes are executed one by
one for a K6CM device, so the number of clients per K6CM device is one.
[Initial setting] iCIPTimeOut
Sets the timeout value of the CIP communications command issued by the CIP-dedicated FB.
(Initial value: 10)
Normally, there is no problem with the initial value. However, the value to be set varies depending
on the user system, so change it as necessary.
[Initial setting] sIPAddress
Set the IP address of K6CM devices to be used in advance. Set in order from the top of the program for the
number to use.
Example: Using three devics of 192.168.250.121 to 192.168.250.123
sIPAddress [UINT # 0]: = '192.168.250.121';
sIPAddress [UINT # 1]: = '192.168.250.122';
sIPAddress [UINT # 2]: = '192.168.250.123';
sIPAddress [UINT # 3]: = '192.168.250.104'; ← No need to change IP address after this
sIPAddress [UINT # 4]: = '192.168.250.105'; ← (however, setting is required below)
* Set the number of collecting devices on line number106 to "3".
→ iNumOfUnits: = UINT # 3; // number of collected devices
8
8 - 41

Advertisement

Table of Contents
loading

This manual is also suitable for:

K6cm-ismK6cm-cimK6cm-vbmK6cm-ci2m

Table of Contents