diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2436cb7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+
+nvram.txt
diff --git a/docs/README.MD b/docs/README.MD
new file mode 100644
index 0000000..13d619f
--- /dev/null
+++ b/docs/README.MD
@@ -0,0 +1,7 @@
+# **T1-PLCnext-Demo** #
+
+| Тегов | Строк кода | Аппаратов | Агрегатов | Устройств | IO-Link I/O | Узлов | Модулей |
+|---|---|---|---|---|---|---|---|
+| | | | | | | |
+
+Проект для тестового стенда **PLCnext**.
\ No newline at end of file
diff --git a/docs/statistics/agregates_total.svg b/docs/statistics/agregates_total.svg
new file mode 100644
index 0000000..0fe0146
--- /dev/null
+++ b/docs/statistics/agregates_total.svg
@@ -0,0 +1,10 @@
+
+
diff --git a/docs/statistics/devices_total.svg b/docs/statistics/devices_total.svg
new file mode 100644
index 0000000..b706d20
--- /dev/null
+++ b/docs/statistics/devices_total.svg
@@ -0,0 +1,10 @@
+
+
diff --git a/docs/statistics/io_couplers_total.svg b/docs/statistics/io_couplers_total.svg
new file mode 100644
index 0000000..ddd83e2
--- /dev/null
+++ b/docs/statistics/io_couplers_total.svg
@@ -0,0 +1,10 @@
+
+
diff --git a/docs/statistics/io_link_usage.svg b/docs/statistics/io_link_usage.svg
new file mode 100644
index 0000000..3dcb110
--- /dev/null
+++ b/docs/statistics/io_link_usage.svg
@@ -0,0 +1,10 @@
+
+
diff --git a/docs/statistics/io_modules_total.svg b/docs/statistics/io_modules_total.svg
new file mode 100644
index 0000000..52388e3
--- /dev/null
+++ b/docs/statistics/io_modules_total.svg
@@ -0,0 +1,10 @@
+
+
diff --git a/docs/statistics/lines_total.svg b/docs/statistics/lines_total.svg
new file mode 100644
index 0000000..eded00f
--- /dev/null
+++ b/docs/statistics/lines_total.svg
@@ -0,0 +1,10 @@
+
+
diff --git a/docs/statistics/tags_total.svg b/docs/statistics/tags_total.svg
new file mode 100644
index 0000000..43dccbe
--- /dev/null
+++ b/docs/statistics/tags_total.svg
@@ -0,0 +1,10 @@
+
+
diff --git a/docs/statistics/units_total.svg b/docs/statistics/units_total.svg
new file mode 100644
index 0000000..0fe0146
--- /dev/null
+++ b/docs/statistics/units_total.svg
@@ -0,0 +1,10 @@
+
+
diff --git a/main.devices.lua b/main.devices.lua
new file mode 100644
index 0000000..c8769f8
--- /dev/null
+++ b/main.devices.lua
@@ -0,0 +1,90 @@
+--version = 1
+--PAC_name = 'T1-PLCnext-Demo'
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+system = system or {}
+system.init_dev_names = function()
+ V1 = V('V1')
+ LS1 = LS('LS1')
+ TE1 = TE('TE1')
+ QT1 = QT('QT1')
+ A2HL1 = HL('A2HL1')
+ A2HL2 = HL('A2HL2')
+ A2HL3 = HL('A2HL3')
+ A2HL4 = HL('A2HL4')
+ A2HL5 = HL('A2HL5')
+ A2HL6 = HL('A2HL6')
+ A2HL7 = HL('A2HL7')
+ A2HL8 = HL('A2HL8')
+ A5HL1 = HL('A5HL1')
+ A5HL2 = HL('A5HL2')
+ A5HL3 = HL('A5HL3')
+ A5HL4 = HL('A5HL4')
+ A5HL5 = HL('A5HL5')
+ A5HL6 = HL('A5HL6')
+ A5HL7 = HL('A5HL7')
+ A5HL8 = HL('A5HL8')
+ A2DI1 = DI('A2DI1')
+ A2DI2 = DI('A2DI2')
+ A2DI3 = DI('A2DI3')
+ A2DI4 = DI('A2DI4')
+ A2DI5 = DI('A2DI5')
+ A2DI6 = DI('A2DI6')
+ A2DI7 = DI('A2DI7')
+ A2DI8 = DI('A2DI8')
+ A5DI1 = DI('A5DI1')
+ A5DI2 = DI('A5DI2')
+ A5DI3 = DI('A5DI3')
+ A5DI4 = DI('A5DI4')
+ A5DI5 = DI('A5DI5')
+ A5DI6 = DI('A5DI6')
+ A5DI7 = DI('A5DI7')
+ A5DI8 = DI('A5DI8')
+ A3AI1 = AI('A3AI1')
+ A3AI2 = AI('A3AI2')
+ A3AO1 = AO('A3AO1')
+ A3AO2 = AO('A3AO2')
+ PT1 = PT('PT1')
+
+ __V1 = DEVICE( 0 )
+ __LS1 = DEVICE( 1 )
+ __TE1 = DEVICE( 2 )
+ __QT1 = DEVICE( 3 )
+ __A2HL1 = DEVICE( 4 )
+ __A2HL2 = DEVICE( 5 )
+ __A2HL3 = DEVICE( 6 )
+ __A2HL4 = DEVICE( 7 )
+ __A2HL5 = DEVICE( 8 )
+ __A2HL6 = DEVICE( 9 )
+ __A2HL7 = DEVICE( 10 )
+ __A2HL8 = DEVICE( 11 )
+ __A5HL1 = DEVICE( 12 )
+ __A5HL2 = DEVICE( 13 )
+ __A5HL3 = DEVICE( 14 )
+ __A5HL4 = DEVICE( 15 )
+ __A5HL5 = DEVICE( 16 )
+ __A5HL6 = DEVICE( 17 )
+ __A5HL7 = DEVICE( 18 )
+ __A5HL8 = DEVICE( 19 )
+ __A2DI1 = DEVICE( 20 )
+ __A2DI2 = DEVICE( 21 )
+ __A2DI3 = DEVICE( 22 )
+ __A2DI4 = DEVICE( 23 )
+ __A2DI5 = DEVICE( 24 )
+ __A2DI6 = DEVICE( 25 )
+ __A2DI7 = DEVICE( 26 )
+ __A2DI8 = DEVICE( 27 )
+ __A5DI1 = DEVICE( 28 )
+ __A5DI2 = DEVICE( 29 )
+ __A5DI3 = DEVICE( 30 )
+ __A5DI4 = DEVICE( 31 )
+ __A5DI5 = DEVICE( 32 )
+ __A5DI6 = DEVICE( 33 )
+ __A5DI7 = DEVICE( 34 )
+ __A5DI8 = DEVICE( 35 )
+ __A3AI1 = DEVICE( 36 )
+ __A3AI2 = DEVICE( 37 )
+ __A3AO1 = DEVICE( 38 )
+ __A3AO2 = DEVICE( 39 )
+ __PT1 = DEVICE( 40 )
+end
diff --git a/main.io.lua b/main.io.lua
new file mode 100644
index 0000000..f2b039c
--- /dev/null
+++ b/main.io.lua
@@ -0,0 +1,809 @@
+--version = 1
+------------------------------------------------------------------------------
+PAC_name = 'T1-PLCnext-Demo'
+PAC_id = '28204'
+------------------------------------------------------------------------------
+--Узлы IO
+nodes =
+ {
+ {
+ name = 'A1',
+ ntype = 201, --AXC F 2152
+ n = 1,
+ IP = '192.168.1.10',
+ modules =
+ {
+ }
+ },
+ {
+ name = 'A100',
+ ntype = 200, --AXL F BK ETH
+ n = 2,
+ IP = '192.168.1.11',
+ modules =
+ {
+ { 2701916 }, --AXL F DI8/1 DO8/1 1H,
+ { 2702072 }, --AXL F AI2 AO2 1H,
+ { 2701916 }, --AXL F DI8/1 DO8/1 1H,
+ { 1027843 }, --AXL F IOL8 2H,
+ }
+ },
+ }
+------------------------------------------------------------------------------
+--Устройства
+devices =
+ {
+ {
+ name = 'V1',
+ descr = '',
+ dtype = 0,
+ subtype = 15, -- V_IOLINK_MIXPROOF
+ article = 'AL.9615-4003-06',
+ AO =
+ {
+ {
+ node = 1,
+ offset = 16,
+ physical_port = 70,
+ logical_port = 5,
+ module_offset = 4
+ },
+ },
+ AI =
+ {
+ {
+ node = 1,
+ offset = 16,
+ physical_port = 70,
+ logical_port = 5,
+ module_offset = 4
+ },
+ },
+ par = {1000 --[[P_ON_TIME]], 1 --[[P_FB]] }
+ },
+
+ {
+ name = 'LS1',
+ descr = '',
+ dtype = 3,
+ subtype = 3, -- LS_IOLINK_MIN
+ article = 'IFM.LMT100',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 8,
+ physical_port = 31,
+ logical_port = 2,
+ module_offset = 4
+ },
+ },
+ par = {0 --[[P_DT]], 1000 --[[P_ERR]] }
+ },
+
+ {
+ name = 'TE1',
+ descr = '',
+ dtype = 4,
+ subtype = 2, -- TE_IOLINK
+ article = 'IFM.TA2502',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 7,
+ physical_port = 30,
+ logical_port = 1,
+ module_offset = 4
+ },
+ },
+ par = {0 --[[P_C0]], 1000 --[[P_ERR]] }
+ },
+
+ {
+ name = 'QT1',
+ descr = '',
+ dtype = 9,
+ subtype = 3, -- QT_IOLINK
+ article = 'IFM.LDL100',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 10,
+ physical_port = 33,
+ logical_port = 4,
+ module_offset = 4
+ },
+ },
+ par = {1000 --[[P_ERR]] }
+ },
+
+ {
+ name = 'A2HL1',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 8,
+ physical_port = 2,
+ logical_port = 3,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL2',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 9,
+ physical_port = 3,
+ logical_port = 4,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL3',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 10,
+ physical_port = 12,
+ logical_port = 7,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL4',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 11,
+ physical_port = 13,
+ logical_port = 8,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL5',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 12,
+ physical_port = 22,
+ logical_port = 11,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL6',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 13,
+ physical_port = 23,
+ logical_port = 12,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL7',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 14,
+ physical_port = 32,
+ logical_port = 15,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL8',
+ descr = '',
+ dtype = 11,
+ subtype = 1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 15,
+ physical_port = 33,
+ logical_port = 16,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A5HL1',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 56,
+ physical_port = 2,
+ logical_port = 3,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL2',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 57,
+ physical_port = 3,
+ logical_port = 4,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL3',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 58,
+ physical_port = 12,
+ logical_port = 7,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL4',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 59,
+ physical_port = 13,
+ logical_port = 8,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL5',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 60,
+ physical_port = 22,
+ logical_port = 11,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL6',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 61,
+ physical_port = 23,
+ logical_port = 12,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL7',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 62,
+ physical_port = 32,
+ logical_port = 15,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL8',
+ descr = '',
+ dtype = 11,
+ subtype = 1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 63,
+ physical_port = 33,
+ logical_port = 16,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A2DI1',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 8,
+ physical_port = 0,
+ logical_port = 1,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI2',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 9,
+ physical_port = 1,
+ logical_port = 2,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI3',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 10,
+ physical_port = 10,
+ logical_port = 5,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI4',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 11,
+ physical_port = 11,
+ logical_port = 6,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI5',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 12,
+ physical_port = 20,
+ logical_port = 9,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI6',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 13,
+ physical_port = 21,
+ logical_port = 10,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI7',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 14,
+ physical_port = 30,
+ logical_port = 13,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI8',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 15,
+ physical_port = 31,
+ logical_port = 14,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI1',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 56,
+ physical_port = 0,
+ logical_port = 1,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI2',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 57,
+ physical_port = 1,
+ logical_port = 2,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI3',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 58,
+ physical_port = 10,
+ logical_port = 5,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI4',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 59,
+ physical_port = 11,
+ logical_port = 6,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI5',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 60,
+ physical_port = 20,
+ logical_port = 9,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI6',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 61,
+ physical_port = 21,
+ logical_port = 10,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI7',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 62,
+ physical_port = 30,
+ logical_port = 13,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI8',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 63,
+ physical_port = 31,
+ logical_port = 14,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A3AI1',
+ descr = '',
+ dtype = 15,
+ subtype = 1, -- AI
+ article = '',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 1,
+ physical_port = 0,
+ logical_port = 1,
+ module_offset = 1
+ },
+ },
+ par = {0 --[[P_C0]], 0 --[[P_MIN_V]], 10 --[[P_MAX_V]] }
+ },
+
+ {
+ name = 'A3AI2',
+ descr = '',
+ dtype = 15,
+ subtype = 1, -- AI
+ article = '',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 2,
+ physical_port = 1,
+ logical_port = 2,
+ module_offset = 1
+ },
+ },
+ par = {0 --[[P_C0]], 0 --[[P_MIN_V]], 10 --[[P_MAX_V]] }
+ },
+
+ {
+ name = 'A3AO1',
+ descr = '',
+ dtype = 16,
+ subtype = 1, -- AO
+ article = '',
+ AO =
+ {
+ {
+ node = 1,
+ offset = 1,
+ physical_port = 2,
+ logical_port = 3,
+ module_offset = 1
+ },
+ },
+ par = {0 --[[P_MIN_V]], 10 --[[P_MAX_V]] }
+ },
+
+ {
+ name = 'A3AO2',
+ descr = '',
+ dtype = 16,
+ subtype = 1, -- AO
+ article = '',
+ AO =
+ {
+ {
+ node = 1,
+ offset = 2,
+ physical_port = 3,
+ logical_port = 4,
+ module_offset = 1
+ },
+ },
+ par = {0 --[[P_MIN_V]], 10 --[[P_MAX_V]] }
+ },
+
+ {
+ name = 'PT1',
+ descr = '',
+ dtype = 18,
+ subtype = 2, -- PT_IOLINK
+ article = 'IFM.PI2797',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 9,
+ physical_port = 32,
+ logical_port = 3,
+ module_offset = 4
+ },
+ },
+ par = {1000 --[[P_ERR]] }
+ },
+
+ }
diff --git a/main.modbus_srv.lua b/main.modbus_srv.lua
new file mode 100644
index 0000000..7465c2a
--- /dev/null
+++ b/main.modbus_srv.lua
@@ -0,0 +1,9 @@
+--version = 1
+------------------------------------------------------------------------------
+function read_holding_registers( n, start_idx, count )
+ return read_hr2(n, start_idx, count)
+end
+
+function write_holding_registers( n, start_idx, count, buff )
+ write_hr2(n, start_idx, count, buff)
+end
\ No newline at end of file
diff --git a/main.objects.lua b/main.objects.lua
new file mode 100644
index 0000000..27a5e52
--- /dev/null
+++ b/main.objects.lua
@@ -0,0 +1,9 @@
+--version = 1
+--PAC_name = 'T1-PLCnext-Demo'
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+init_tech_objects_modes = function()
+ return
+ {
+ }
+end
\ No newline at end of file
diff --git a/main.plua b/main.plua
new file mode 100644
index 0000000..0a2b727
--- /dev/null
+++ b/main.plua
@@ -0,0 +1,71 @@
+--Проект 'T1-PLCnext-Demo'
+
+prg = require("prg") --Технологические объекты.
+require( "sharedmodbus" ) --Межконтроллерный обмен
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+--Пользовательская функция инициализации, выполняемая однократно в PAC.
+
+A5HL1_info = { lamp = A5HL1 }
+A5HL2_info = { lamp = A5HL2 }
+A5HL3_info = { lamp = A5HL3 }
+A5HL4_info = { lamp = A5HL4 }
+A5HL5_info = { lamp = A5HL5 }
+A5HL6_info = { lamp = A5HL6 }
+A5HL7_info = { lamp = A5HL7 }
+A5HL8_info = { lamp = A5HL8 }
+
+function user_init()
+ local delay = 5000
+ local delta = 200
+
+ A5HL1_info.start_time = get_millisec()
+ A5HL2_info.start_time = A5HL1_info.start_time - delta
+ A5HL3_info.start_time = A5HL2_info.start_time - delta
+ A5HL4_info.start_time = A5HL3_info.start_time - delta
+ A5HL5_info.start_time = A5HL4_info.start_time - delta
+ A5HL6_info.start_time = A5HL5_info.start_time - delta
+ A5HL7_info.start_time = A5HL6_info.start_time - delta
+ A5HL8_info.start_time = A5HL7_info.start_time - delta
+end
+
+function blink( info )
+ if get_delta_millisec( info.start_time ) > 2000 then
+ if info.lamp:get_state() == 1 then info.lamp:set_state( 0 ) else info.lamp:set_state( 1 ) end
+ info.start_time = get_millisec()
+ end
+end
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+--Пользовательская функция, выполняемая каждый цикл в PAC.
+
+
+function user_eval()
+ A2HL1:set_state( A2DI1:get_state() )
+ A2HL2:set_state( A2DI2:get_state() )
+ A2HL3:set_state( A2DI3:get_state() )
+ A2HL4:set_state( A2DI4:get_state() )
+ A2HL5:set_state( A2DI5:get_state() )
+ A2HL6:set_state( A2DI6:get_state() )
+ A2HL7:set_state( A2DI7:get_state() )
+ A2HL8:set_state( A2DI8:get_state() )
+
+ A3AO1:set_value( A3AI1:get_value() )
+
+ blink( A5HL1_info )
+ blink( A5HL2_info )
+ blink( A5HL3_info )
+ blink( A5HL4_info )
+ blink( A5HL5_info )
+ blink( A5HL6_info )
+ blink( A5HL7_info )
+ blink( A5HL8_info )
+end
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+--Функция инициализации параметров, выполняемая однократно в PAC.
+
+function user_init_params()
+end
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
diff --git a/main.profibus.lua b/main.profibus.lua
new file mode 100644
index 0000000..a440aa0
--- /dev/null
+++ b/main.profibus.lua
@@ -0,0 +1,6 @@
+--version = 1
+--Описание конфигурации PROFIBUS
+------------------------------------------------------------------------------
+system = system or { }
+system.init_profibus = function()
+end
diff --git a/main.restrictions.lua b/main.restrictions.lua
new file mode 100644
index 0000000..b57f72a
--- /dev/null
+++ b/main.restrictions.lua
@@ -0,0 +1,7 @@
+--version = 1
+--Файл ограничений проекта
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+restrictions =
+ {
+ }
\ No newline at end of file
diff --git a/main.wago.lua b/main.wago.lua
new file mode 100644
index 0000000..f2b039c
--- /dev/null
+++ b/main.wago.lua
@@ -0,0 +1,809 @@
+--version = 1
+------------------------------------------------------------------------------
+PAC_name = 'T1-PLCnext-Demo'
+PAC_id = '28204'
+------------------------------------------------------------------------------
+--Узлы IO
+nodes =
+ {
+ {
+ name = 'A1',
+ ntype = 201, --AXC F 2152
+ n = 1,
+ IP = '192.168.1.10',
+ modules =
+ {
+ }
+ },
+ {
+ name = 'A100',
+ ntype = 200, --AXL F BK ETH
+ n = 2,
+ IP = '192.168.1.11',
+ modules =
+ {
+ { 2701916 }, --AXL F DI8/1 DO8/1 1H,
+ { 2702072 }, --AXL F AI2 AO2 1H,
+ { 2701916 }, --AXL F DI8/1 DO8/1 1H,
+ { 1027843 }, --AXL F IOL8 2H,
+ }
+ },
+ }
+------------------------------------------------------------------------------
+--Устройства
+devices =
+ {
+ {
+ name = 'V1',
+ descr = '',
+ dtype = 0,
+ subtype = 15, -- V_IOLINK_MIXPROOF
+ article = 'AL.9615-4003-06',
+ AO =
+ {
+ {
+ node = 1,
+ offset = 16,
+ physical_port = 70,
+ logical_port = 5,
+ module_offset = 4
+ },
+ },
+ AI =
+ {
+ {
+ node = 1,
+ offset = 16,
+ physical_port = 70,
+ logical_port = 5,
+ module_offset = 4
+ },
+ },
+ par = {1000 --[[P_ON_TIME]], 1 --[[P_FB]] }
+ },
+
+ {
+ name = 'LS1',
+ descr = '',
+ dtype = 3,
+ subtype = 3, -- LS_IOLINK_MIN
+ article = 'IFM.LMT100',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 8,
+ physical_port = 31,
+ logical_port = 2,
+ module_offset = 4
+ },
+ },
+ par = {0 --[[P_DT]], 1000 --[[P_ERR]] }
+ },
+
+ {
+ name = 'TE1',
+ descr = '',
+ dtype = 4,
+ subtype = 2, -- TE_IOLINK
+ article = 'IFM.TA2502',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 7,
+ physical_port = 30,
+ logical_port = 1,
+ module_offset = 4
+ },
+ },
+ par = {0 --[[P_C0]], 1000 --[[P_ERR]] }
+ },
+
+ {
+ name = 'QT1',
+ descr = '',
+ dtype = 9,
+ subtype = 3, -- QT_IOLINK
+ article = 'IFM.LDL100',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 10,
+ physical_port = 33,
+ logical_port = 4,
+ module_offset = 4
+ },
+ },
+ par = {1000 --[[P_ERR]] }
+ },
+
+ {
+ name = 'A2HL1',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 8,
+ physical_port = 2,
+ logical_port = 3,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL2',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 9,
+ physical_port = 3,
+ logical_port = 4,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL3',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 10,
+ physical_port = 12,
+ logical_port = 7,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL4',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 11,
+ physical_port = 13,
+ logical_port = 8,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL5',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 12,
+ physical_port = 22,
+ logical_port = 11,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL6',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 13,
+ physical_port = 23,
+ logical_port = 12,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL7',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 14,
+ physical_port = 32,
+ logical_port = 15,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A2HL8',
+ descr = '',
+ dtype = 11,
+ subtype = 1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 15,
+ physical_port = 33,
+ logical_port = 16,
+ module_offset = 0
+ },
+ },
+ },
+
+ {
+ name = 'A5HL1',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 56,
+ physical_port = 2,
+ logical_port = 3,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL2',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 57,
+ physical_port = 3,
+ logical_port = 4,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL3',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 58,
+ physical_port = 12,
+ logical_port = 7,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL4',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 59,
+ physical_port = 13,
+ logical_port = 8,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL5',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 60,
+ physical_port = 22,
+ logical_port = 11,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL6',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 61,
+ physical_port = 23,
+ logical_port = 12,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL7',
+ descr = '',
+ dtype = 11,
+ subtype = -1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 62,
+ physical_port = 32,
+ logical_port = 15,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A5HL8',
+ descr = '',
+ dtype = 11,
+ subtype = 1, -- HL
+ article = 'SIE.3SB3217-6AA40',
+ DO =
+ {
+ {
+ node = 1,
+ offset = 63,
+ physical_port = 33,
+ logical_port = 16,
+ module_offset = 48
+ },
+ },
+ },
+
+ {
+ name = 'A2DI1',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 8,
+ physical_port = 0,
+ logical_port = 1,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI2',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 9,
+ physical_port = 1,
+ logical_port = 2,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI3',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 10,
+ physical_port = 10,
+ logical_port = 5,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI4',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 11,
+ physical_port = 11,
+ logical_port = 6,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI5',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 12,
+ physical_port = 20,
+ logical_port = 9,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI6',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 13,
+ physical_port = 21,
+ logical_port = 10,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI7',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 14,
+ physical_port = 30,
+ logical_port = 13,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A2DI8',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 15,
+ physical_port = 31,
+ logical_port = 14,
+ module_offset = 0
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI1',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 56,
+ physical_port = 0,
+ logical_port = 1,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI2',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 57,
+ physical_port = 1,
+ logical_port = 2,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI3',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 58,
+ physical_port = 10,
+ logical_port = 5,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI4',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 59,
+ physical_port = 11,
+ logical_port = 6,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI5',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 60,
+ physical_port = 20,
+ logical_port = 9,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI6',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 61,
+ physical_port = 21,
+ logical_port = 10,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI7',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 62,
+ physical_port = 30,
+ logical_port = 13,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A5DI8',
+ descr = '',
+ dtype = 13,
+ subtype = 1, -- DI
+ article = '',
+ DI =
+ {
+ {
+ node = 1,
+ offset = 63,
+ physical_port = 31,
+ logical_port = 14,
+ module_offset = 48
+ },
+ },
+ par = {0 --[[P_DT]] }
+ },
+
+ {
+ name = 'A3AI1',
+ descr = '',
+ dtype = 15,
+ subtype = 1, -- AI
+ article = '',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 1,
+ physical_port = 0,
+ logical_port = 1,
+ module_offset = 1
+ },
+ },
+ par = {0 --[[P_C0]], 0 --[[P_MIN_V]], 10 --[[P_MAX_V]] }
+ },
+
+ {
+ name = 'A3AI2',
+ descr = '',
+ dtype = 15,
+ subtype = 1, -- AI
+ article = '',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 2,
+ physical_port = 1,
+ logical_port = 2,
+ module_offset = 1
+ },
+ },
+ par = {0 --[[P_C0]], 0 --[[P_MIN_V]], 10 --[[P_MAX_V]] }
+ },
+
+ {
+ name = 'A3AO1',
+ descr = '',
+ dtype = 16,
+ subtype = 1, -- AO
+ article = '',
+ AO =
+ {
+ {
+ node = 1,
+ offset = 1,
+ physical_port = 2,
+ logical_port = 3,
+ module_offset = 1
+ },
+ },
+ par = {0 --[[P_MIN_V]], 10 --[[P_MAX_V]] }
+ },
+
+ {
+ name = 'A3AO2',
+ descr = '',
+ dtype = 16,
+ subtype = 1, -- AO
+ article = '',
+ AO =
+ {
+ {
+ node = 1,
+ offset = 2,
+ physical_port = 3,
+ logical_port = 4,
+ module_offset = 1
+ },
+ },
+ par = {0 --[[P_MIN_V]], 10 --[[P_MAX_V]] }
+ },
+
+ {
+ name = 'PT1',
+ descr = '',
+ dtype = 18,
+ subtype = 2, -- PT_IOLINK
+ article = 'IFM.PI2797',
+ AI =
+ {
+ {
+ node = 1,
+ offset = 9,
+ physical_port = 32,
+ logical_port = 3,
+ module_offset = 4
+ },
+ },
+ par = {1000 --[[P_ERR]] }
+ },
+
+ }
diff --git a/prg.lua b/prg.lua
new file mode 100644
index 0000000..98c0c7f
--- /dev/null
+++ b/prg.lua
@@ -0,0 +1,56 @@
+--version = 1
+--PAC_name = 'T1-PLCnext-Demo'
+------------------------------------------------------------------------------
+------------------------------------------------------------------------------
+--Базовая функциональность
+
+-- Основные объекты проекта (объекты, описанные в Eplan).
+local prg =
+ {
+ control_modules =
+ {
+ V1 = V('V1'),
+ LS1 = LS('LS1'),
+ TE1 = TE('TE1'),
+ QT1 = QT('QT1'),
+ A2HL1 = HL('A2HL1'),
+ A2HL2 = HL('A2HL2'),
+ A2HL3 = HL('A2HL3'),
+ A2HL4 = HL('A2HL4'),
+ A2HL5 = HL('A2HL5'),
+ A2HL6 = HL('A2HL6'),
+ A2HL7 = HL('A2HL7'),
+ A2HL8 = HL('A2HL8'),
+ A5HL1 = HL('A5HL1'),
+ A5HL2 = HL('A5HL2'),
+ A5HL3 = HL('A5HL3'),
+ A5HL4 = HL('A5HL4'),
+ A5HL5 = HL('A5HL5'),
+ A5HL6 = HL('A5HL6'),
+ A5HL7 = HL('A5HL7'),
+ A5HL8 = HL('A5HL8'),
+ A2DI1 = DI('A2DI1'),
+ A2DI2 = DI('A2DI2'),
+ A2DI3 = DI('A2DI3'),
+ A2DI4 = DI('A2DI4'),
+ A2DI5 = DI('A2DI5'),
+ A2DI6 = DI('A2DI6'),
+ A2DI7 = DI('A2DI7'),
+ A2DI8 = DI('A2DI8'),
+ A5DI1 = DI('A5DI1'),
+ A5DI2 = DI('A5DI2'),
+ A5DI3 = DI('A5DI3'),
+ A5DI4 = DI('A5DI4'),
+ A5DI5 = DI('A5DI5'),
+ A5DI6 = DI('A5DI6'),
+ A5DI7 = DI('A5DI7'),
+ A5DI8 = DI('A5DI8'),
+ A3AI1 = AI('A3AI1'),
+ A3AI2 = AI('A3AI2'),
+ A3AO1 = AO('A3AO1'),
+ A3AO2 = AO('A3AO2'),
+ PT1 = PT('PT1'),
+ },
+
+ }
+return prg
diff --git a/shared.lua b/shared.lua
new file mode 100644
index 0000000..81e69ee
--- /dev/null
+++ b/shared.lua
@@ -0,0 +1,6 @@
+remote_gateways =
+{
+}
+shared_devices =
+{
+}
\ No newline at end of file