Commit 2e4f535d authored by claes's avatar claes

Merge branch 'master' of 62.20.65.89:/data1/git/pwr

parents 9a13b257 f33c8fbb
......@@ -29,22 +29,22 @@
100 20
135 20
101 20
102 111
103 -106
104 3.89525
136 3.89525
102 -200
103 -130
104 3.06593
136 3.06593
105 100
106 10
107 -20
106 -30
107 -19
108 42.5353
109 2.75476
110 24.2545
111 1.2
116 11
116 0
117 0
118 143
119 118
120 1
118 192
119 96
120 0
121 Claes context
122 0
126 0.1
......@@ -61,7 +61,7 @@
134
22
2200 0
2201 165
2201 169
2202 pwr_c_basefcppo3
2203 31
2205 0
......@@ -73,12 +73,8 @@
2210 1.5
2211 43
2212 24
2213 4
2213 0
2214
pwrp_pop:
pwrp_exe:
ssab_exe:
pwr_exe:
2215 0
2236 0
2216 0
......@@ -1055,6 +1051,7 @@ pwr_exe:
2418 0
2419 4
2420 0
2422 0
2407 0
2406
2405
......@@ -1105,6 +1102,7 @@ pwr_exe:
2418 0
2419 4
2420 0
2422 0
2407 0
2406
2405
......@@ -1155,6 +1153,7 @@ pwr_exe:
2418 0
2419 4
2420 0
2422 0
2407 0
2406
2405
......@@ -1205,6 +1204,7 @@ pwr_exe:
2418 0
2419 4
2420 0
2422 0
2407 0
2406
2405
......@@ -2275,6 +2275,7 @@ pwr_exe:
2418 0
2419 4
2420 0
2422 0
2407 0
2406
2405
......@@ -5212,8 +5213,8 @@ pwr_exe:
2
19
1904 O164
1900 42.483
1901 2.75474
1900 42.4831
1901 2.75476
1902 3.37653
1903 2.25501
1908 0
......@@ -5454,12 +5455,13 @@ pwr_exe:
99
30
3004 O144
3000 14.0064
3000 14.2
3001 12.15
3002 8.82803
3003 8.18789
3002 8.8
3003 8.2
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -9053,12 +9055,13 @@ pwr_exe:
99
30
3004 O146
3000 30.0284
3000 30.2
3001 28.3
3002 5.12803
3003 4.48789
3002 5.1
3003 4.5
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -9215,12 +9218,13 @@ pwr_exe:
99
30
3004 O147
3000 29.4522
3000 29.5
3001 28.3
3002 6.08803
3003 5.44789
3002 6.06
3003 5.46
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -9377,12 +9381,13 @@ pwr_exe:
99
30
3004 O148
3000 30.5405
3000 30.6
3001 28.3
3002 10.548
3003 9.90789
3002 10.52
3003 9.92
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -9539,12 +9544,13 @@ pwr_exe:
99
30
3004 O149
3000 33.4211
3000 33.45
3001 28.3
3002 7.10803
3003 6.46789
3002 7.08
3003 6.48
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -9704,12 +9710,13 @@ pwr_exe:
99
30
3004 O150
3000 30.7965
3000 30.85
3001 28.3
3002 8.06803
3003 7.42789
3002 8.04
3003 7.44
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -9866,12 +9873,13 @@ pwr_exe:
99
30
3004 O151
3000 32.0128
3000 32.3
3001 28.3
3002 9.02803
3003 8.38789
3002 9
3003 8.4
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -9899,12 +9907,13 @@ pwr_exe:
99
30
3004 O152
3000 25.4064
3000 25.6
3001 23.55
3002 6.77803
3003 6.13789
3002 6.75
3003 6.15
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -9989,12 +9998,12 @@ pwr_exe:
0
1006 11.25
1007 8.25
1008 19.05
1009 18.05
1008 17.15
1009 16.15
1013 11.25
1014 8.25
1015 19.05
1016 18.05
1015 17.15
1016 16.15
1003
0
0
......@@ -10036,7 +10045,7 @@ pwr_exe:
2802 8.25
2803 0
2804 1
2805 18.05
2805 16.15
2806 0
99
2716 0
......@@ -10067,12 +10076,13 @@ pwr_exe:
99
30
3004 O153
3000 6.71054
3000 6.95
3001 4.15
3002 19.028
3003 18.3879
3002 17.1
3003 16.5
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -10094,7 +10104,7 @@ pwr_exe:
2802 1.3
2803 0
2804 1
2805 10.35
2805 8.45
2806 0
99
99
......@@ -10157,12 +10167,12 @@ pwr_exe:
0
1006 11.25
1007 8.25
1008 17.7
1009 16.7
1008 15.8
1009 14.8
1013 11.25
1014 8.25
1015 17.7
1016 16.7
1015 15.8
1016 14.8
1003
0
0
......@@ -10204,7 +10214,7 @@ pwr_exe:
2802 8.25
2803 0
2804 1
2805 16.7
2805 14.8
2806 0
99
2716 0
......@@ -10235,12 +10245,13 @@ pwr_exe:
99
30
3004 O154
3000 7.60673
3000 7.85
3001 4.15
3002 17.678
3003 17.0379
3002 15.75
3003 15.15
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -10262,7 +10273,7 @@ pwr_exe:
2802 1.3
2803 0
2804 1
2805 9
2805 7.1
2806 0
99
99
......@@ -10837,12 +10848,13 @@ pwr_exe:
99
30
3004 O155
3000 41.6722
3000 41.6661
3001 41.4161
3002 21.8593
3003 21.2832
3002 21.8313
3003 21.2813
3008 103
3010 0
3011 2
3007 0
3006
3005
......@@ -11374,12 +11386,13 @@ pwr_exe:
99
30
3004 O156
3000 17.9843
3000 17.9661
3001 17.2161
3002 21.8593
3003 21.2832
3002 21.8313
3003 21.2813
3008 103
3010 0
3011 2
3007 0
3006
3005
......@@ -11661,8 +11674,8 @@ pwr_exe:
1904 O157
1900 11.8287
1901 11.4287
1902 19.0573
1903 18.0573
1902 17.1573
1903 16.1573
1908 295
1909 284
1910 284
......@@ -11704,7 +11717,7 @@ pwr_exe:
2802 3.62866
2803 0
2804 1
2805 0.0573241
2805 -1.84268
2806 0
99
99
......@@ -11712,8 +11725,8 @@ pwr_exe:
1904 O158
1900 11.8287
1901 11.4287
1902 17.6959
1903 16.6959
1902 15.7959
1903 14.7959
1908 295
1909 163
1910 163
......@@ -11755,18 +11768,19 @@ pwr_exe:
2802 3.62866
2803 0
2804 1
2805 -1.30412
2805 -3.20412
2806 0
99
99
30
3004 O159
3000 5.89238
3000 6.1
3001 4.1
3002 14.078
3003 13.4379
3002 14.05
3003 13.45
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -11794,12 +11808,13 @@ pwr_exe:
99
30
3004 O160
3000 26.0465
3000 26.2
3001 23.55
3002 11.928
3003 11.2879
3002 11.9
3003 11.3
3008 0
3010 4
3011 2
3007 0
3006
3005
......@@ -12624,6 +12639,344 @@ pwr_exe:
99
99
99
27
2703 10000
2704 10000
2722 10000
2705 10000
2723 10000
2706 10000
2708 0
2709 0
2710 0
2711 0
2712 0
2713 0
2714 0
2715 0
2720 0
2725 0
2726 0
2702 0
2701
2700
10
1000 pwr_valuemedium
1002 O165
1005
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1006 11.25
1007 8.25
1008 20.35
1009 19.35
1013 11.25
1014 8.25
1015 20.35
1016 19.35
1003
0
0
0
0
0
0
0
0
0
0
1004
1001
7
700 11.2
701 18.4
99
1010
1011
1018
1019
1020
1021
1022
1023
1024
1025
1012 0
1017 9999
1027 9999
1026 65532
1028 0
1029
99
2707
28
2800 1
2801 0
2802 8.25
2803 0
2804 1
2805 19.35
2806 0
99
2716 0
2718
2717
2719 0
2724 1
2727 0
2728 303
2729 9999
2721
1
100 1
101 3
102 65532
103 0
12
1200 $object.RefSpeed.SigValue##Float32
1201 %7.2f
1202 1
1203 1
1204 0
99
50
5000 $object.RefSpeed
99
99
99
30
3004 O166
3000 7.05
3001 4.15
3002 20.3
3003 19.7
3008 0
3010 4
3011 2
3007 0
3006
3005
9
900 2
901 303
904 0
902 SV SigVal
903
7
700 2.85
701 8.55
99
99
3009
28
2800 1
2801 0
2802 1.3
2803 0
2804 1
2805 11.65
2806 0
99
99
27
2703 10000
2704 10000
2722 10000
2705 10000
2723 10000
2706 10000
2708 0
2709 0
2710 0
2711 0
2712 0
2713 0
2714 0
2715 0
2720 0
2725 0
2726 0
2702 0
2701
2700
10
1000 pwr_valuemedium
1002 O167
1005
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1006 11.25
1007 8.25
1008 19
1009 18
1013 11.25
1014 8.25
1015 19
1016 18
1003
0
0
0
0
0
0
0
0
0
0
1004
1001
7
700 11.2
701 18.4
99
1010
1011
1018
1019
1020
1021
1022
1023
1024
1025
1012 0
1017 9999
1027 9999
1026 65532
1028 0
1029
99
2707
28
2800 1
2801 0
2802 8.25
2803 0
2804 1
2805 18
2806 0
99
2716 0
2718
2717
2719 0
2724 1
2727 0
2728 303
2729 9999
2721
1
100 1
101 3
102 65532
103 0
12
1200 $object.ActSpeed.SigValue##Float32
1201 %7.2f
1202 1
1203 1
1204 0
99
50
5000 $object.ActSpeed
99
99
99
30
3004 O168
3000 7.05
3001 4.15
3002 18.95
3003 18.35
3008 0
3010 4
3011 2
3007 0
3006
3005
9
900 2
901 303
904 0
902 AV SigVal
903
7
700 2.85
701 8.55
99
99
3009
28
2800 1
2801 0
2802 1.3
2803 0
2804 1
2805 10.3
2806 0
99
99
11
1100 30.3
1101 -11.5
......
......@@ -72,7 +72,7 @@ SObject NMps:Class
Object Data_ObjId $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$ObjId"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
......@@ -82,7 +82,7 @@ SObject NMps:Class
Object Data_Front $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
......@@ -92,7 +92,7 @@ SObject NMps:Class
Object Data_Back $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
......@@ -112,7 +112,7 @@ SObject NMps:Class
Object Data_Select $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
......
......@@ -71,12 +71,12 @@ static pwr_tStatus IoCardInit (
io_sCard *cp
)
{
io_sCardLocal *local;
io_sCardLocalMsg *local;
pwr_sClass_Modbus_Module *op;
int i;
op = (pwr_sClass_Modbus_Module *) cp->op;
local = (io_sCardLocal *) cp->Local;
local = ((io_sCardLocal *) cp->Local)->msg;
for (i = 0; i < IO_MAXCHAN; i++) {
local->scancount[i] = 0;
......@@ -98,12 +98,12 @@ static pwr_tStatus IoCardRead (
io_sCard *cp
)
{
io_sCardLocal *local;
io_sCardLocalMsg *local;
pwr_sClass_Modbus_Module *op;
pwr_sClass_Modbus_TCP_Slave *slave;
op = (pwr_sClass_Modbus_Module *) cp->op;
local = (io_sCardLocal *) cp->Local;
local = ((io_sCardLocal *) cp->Local)->msg;
slave = (pwr_sClass_Modbus_TCP_Slave *) rp->op;
if ( op->ScanInterval > 1) {
......@@ -118,7 +118,7 @@ static pwr_tStatus IoCardRead (
}
if (slave->Status == MB__NORMAL) {
io_bus_card_read(ctx, rp, cp, local->input_area, NULL, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
io_bus_card_read(ctx, rp, cp, slave->Inputs, NULL, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_Module-IoCardRead\n");
return IO__SUCCESS;
......@@ -135,13 +135,13 @@ static pwr_tStatus IoCardWrite (
io_sCard *cp
)
{
io_sCardLocal *local;
io_sCardLocalMsg *local;
pwr_sClass_Modbus_Module *op;
pwr_sClass_Modbus_TCP_Slave *slave;
op = (pwr_sClass_Modbus_Module *) cp->op;
local = (io_sCardLocal *) cp->Local;
local = ((io_sCardLocal *) cp->Local)->msg;
slave = (pwr_sClass_Modbus_TCP_Slave *) rp->op;
if ( op->ScanInterval > 1) {
......@@ -159,7 +159,7 @@ static pwr_tStatus IoCardWrite (
}
if (slave->Status == MB__NORMAL) {
io_bus_card_write(ctx, cp, local->output_area, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
io_bus_card_write(ctx, cp, slave->Outputs, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_Module-IoCardWrite\n");
return IO__SUCCESS;
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2011 SSAB Oxelosund AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_io_bus.h"
#include "rt_mb_msg.h"
#include "rt_io_mb_locals.h"
/*----------------------------------------------------------------------------*\
Init method for the Modbus module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardInit (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocal *local;
pwr_sClass_Modbus_ModuleReadWrite *op;
int i;
op = (pwr_sClass_Modbus_ModuleReadWrite *) cp->op;
local = (io_sCardLocal *) cp->Local;
for (i = 0; i < IO_MAXCHAN; i++) {
local->msg[0].scancount[i] = 0;
local->msg[1].scancount[i] = 0;
}
op->Read.Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
op->Write.Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Pb module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardRead (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocal *local;
pwr_sClass_Modbus_ModuleReadWrite *op;
pwr_sClass_Modbus_TCP_Slave *slave;
op = (pwr_sClass_Modbus_ModuleReadWrite *) cp->op;
local = (io_sCardLocal *) cp->Local;
slave = (pwr_sClass_Modbus_TCP_Slave *) rp->op;
if ( op->Read.ScanInterval > 1) {
local->msg[0].has_read_method = 1;
if ( local->msg[0].interval_cnt != 0) {
local->msg[0].interval_cnt++;
if ( local->msg[0].interval_cnt >= op->Read.ScanInterval)
local->msg[0].interval_cnt = 0;
return IO__SUCCESS;
}
local->msg[0].interval_cnt++;
}
if (slave->Status == MB__NORMAL) {
io_bus_card_read(ctx, rp, cp, slave->Inputs, NULL, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Pb module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardWrite (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocal *local;
pwr_sClass_Modbus_ModuleReadWrite *op;
pwr_sClass_Modbus_TCP_Slave *slave;
op = (pwr_sClass_Modbus_ModuleReadWrite *) cp->op;
local = (io_sCardLocal *) cp->Local;
slave = (pwr_sClass_Modbus_TCP_Slave *) rp->op;
if ( op->Write.ScanInterval > 1) {
if ( !local->msg[1].has_read_method) {
if ( local->msg[1].interval_cnt != 0) {
local->msg[1].interval_cnt++;
if ( local->msg[1].interval_cnt >= op->Write.ScanInterval)
local->msg[1].interval_cnt = 0;
return IO__SUCCESS;
}
local->msg[1].interval_cnt++;
}
else if ( local->msg[1].interval_cnt != 1)
return IO__SUCCESS;
}
if (slave->Status == MB__NORMAL) {
io_bus_card_write(ctx, cp, slave->Outputs, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_Module-IoCardWrite\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Modbus_ModuleReadWrite) = {
pwr_BindIoMethod(IoCardInit),
pwr_BindIoMethod(IoCardRead),
pwr_BindIoMethod(IoCardWrite),
pwr_NullMethod
};
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2011 SSAB Oxelosund AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_io_bus.h"
#include "rt_mb_msg.h"
#include "rt_io_mb_rtu.h"
/*----------------------------------------------------------------------------*\
Init method for the Modbus module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardInit (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocalMsg *local;
pwr_sClass_Modbus_RTU_Module *op;
int i;
op = (pwr_sClass_Modbus_RTU_Module *) cp->op;
local = ((io_sCardLocal *) cp->Local)->msg;
for (i = 0; i < IO_MAXCHAN; i++) {
local->scancount[i] = 0;
}
op->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Modbus RTU module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardRead (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocalMsg *local;
io_sRackLocal *local_rack = (io_sRackLocal *)rp->Local;
pwr_sClass_Modbus_RTU_Module *op;
pwr_sClass_Modbus_RTU_Slave *slave;
op = (pwr_sClass_Modbus_RTU_Module *) cp->op;
local = ((io_sCardLocal *) cp->Local)->msg;
slave = (pwr_sClass_Modbus_RTU_Slave *) rp->op;
if ( op->ScanInterval > 1) {
local->has_read_method = 1;
if ( local->interval_cnt != 0) {
local->interval_cnt++;
if ( local->interval_cnt >= op->ScanInterval)
local->interval_cnt = 0;
return IO__SUCCESS;
}
local->interval_cnt++;
}
if (slave->Status == MB__NORMAL || local_rack->reset_inputs) {
io_bus_card_read(ctx, rp, cp, slave->Inputs, NULL, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_RTU_Module-IoCardRead\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Modbus RTU module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardWrite (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sCardLocalMsg *local;
pwr_sClass_Modbus_RTU_Module *op;
pwr_sClass_Modbus_RTU_Slave *slave;
op = (pwr_sClass_Modbus_RTU_Module *) cp->op;
local = ((io_sCardLocal *) cp->Local)->msg;
slave = (pwr_sClass_Modbus_RTU_Slave *) rp->op;
if ( op->ScanInterval > 1) {
if ( !local->has_read_method) {
if ( local->interval_cnt != 0) {
local->interval_cnt++;
if ( local->interval_cnt >= op->ScanInterval)
local->interval_cnt = 0;
return IO__SUCCESS;
}
local->interval_cnt++;
}
else if ( local->interval_cnt != 1)
return IO__SUCCESS;
}
if (slave->Status == MB__NORMAL) {
io_bus_card_write(ctx, cp, slave->Outputs, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
}
// printf("Method Modbus_RTU_Module-IoCardWrite\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Modbus_RTU_Module) = {
pwr_BindIoMethod(IoCardInit),
pwr_BindIoMethod(IoCardRead),
pwr_BindIoMethod(IoCardWrite),
pwr_NullMethod
};
This diff is collapsed.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2011 SSAB Oxelosund AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <unistd.h>
#include "pwr.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "rt_io_bus.h"
#include "rt_mb_msg.h"
#include "rt_io_mb_rtu.h"
#include "co_time.h"
/*----------------------------------------------------------------------------*\
Init method for the Modbus server module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardInit (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sServerModuleLocal *local;
pwr_sClass_Modbus_RTU_ServerModule *op;
int i;
op = (pwr_sClass_Modbus_RTU_ServerModule *) cp->op;
local = (io_sServerModuleLocal *) cp->Local;
for (i = 0; i < IO_MAXCHAN; i++) {
local->scancount[i] = 0;
}
op->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Modbus RTU server module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardRead (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sServerModuleLocal *local;
io_sServerLocal *local_server;
pwr_sClass_Modbus_RTU_ServerModule *op;
pwr_sClass_Modbus_RTU_Server *server;
op = (pwr_sClass_Modbus_RTU_ServerModule *) cp->op;
local = (io_sServerModuleLocal *) cp->Local;
server = (pwr_sClass_Modbus_RTU_Server *) rp->op;
local_server = (io_sServerLocal *) rp->Local;
if ( server->DisableServer || !local)
return IO__SUCCESS;
if (server->Status == MB__NORMAL) {
thread_MutexLock( &local_server->mutex);
io_bus_card_read(ctx, rp, cp, local->input_area, NULL, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
thread_MutexUnlock( &local_server->mutex);
}
// printf("Method Modbus_Module-IoCardRead\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Modbus RTU server module
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoCardWrite (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp
)
{
io_sServerModuleLocal *local;
io_sServerLocal *local_server;
pwr_sClass_Modbus_RTU_ServerModule *op;
pwr_sClass_Modbus_RTU_Server *server;
op = (pwr_sClass_Modbus_RTU_ServerModule *) cp->op;
local = (io_sServerModuleLocal *) cp->Local;
server = (pwr_sClass_Modbus_RTU_Server *) rp->op;
local_server = (io_sServerLocal *) rp->Local;
if ( server->DisableServer || !local)
return IO__SUCCESS;
if (server->Status == MB__NORMAL) {
thread_MutexLock( &local_server->mutex);
io_bus_card_write(ctx, cp, local->output_area, pwr_eByteOrderingEnum_BigEndian, pwr_eFloatRepEnum_FloatIntel);
thread_MutexUnlock( &local_server->mutex);
}
// printf("Method Modbus_Module-IoCardWrite\n");
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Modbus_RTU_ServerModule) = {
pwr_BindIoMethod(IoCardInit),
pwr_BindIoMethod(IoCardRead),
pwr_BindIoMethod(IoCardWrite),
pwr_NullMethod
};
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2011 SSAB Oxelosund AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* rt_io_m_mb_rtu_slave.c -- io methods for a Modbus RTU slave */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include "pwr.h"
#include "co_cdh.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_gdh.h"
#include "rt_io_base.h"
#include "rt_io_bus.h"
#include "rt_io_msg.h"
#include "rt_errh.h"
#include "co_cdh.h"
#include "co_time.h"
#include "rt_mb_msg.h"
#include "rt_io_mb_rtu.h"
/*----------------------------------------------------------------------------*\
Init method for the Modbus_TCP slave
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackInit (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp
)
{
io_sCardLocal *local_card;
io_sCard *cardp;
io_sRackLocal *local;
int no_di;
int no_do;
pwr_sClass_Modbus_RTU_Slave *op;
char name[196];
pwr_tStatus sts;
pwr_tCid cid;
io_sChannel *chanp;
int i;
sts = gdh_ObjidToName(rp->Objid, (char *) &name, sizeof(name), cdh_mNName);
errh_Info( "Init of Modbus TCP Slave and Modules %s", name);
op = (pwr_sClass_Modbus_RTU_Slave *) rp->op;
rp->Local = calloc(1, sizeof(io_sRackLocal));
local = rp->Local;
op->Status = MB__NORMAL;
/* Do configuration check and initialize modules. */
cardp = rp->cardlist;
unsigned int prev_input_area_offset = 0;
unsigned int prev_output_area_offset = 0;
unsigned int input_area_offset = 0;
unsigned int output_area_offset = 0;
unsigned int input_area_chansize = 0;
unsigned int output_area_chansize = 0;
while(cardp) {
local_card = calloc(1, sizeof(*local_card));
cid = cardp->Class;
/* Find the super class */
while ( ODD( gdh_GetSuperClass( cid, &cid, cardp->Objid))) ;
switch (cid) {
case pwr_cClass_Modbus_RTU_Module: {
pwr_sClass_Modbus_RTU_Module *modulep;
cardp->Local = local_card;
no_di = 0;
no_do = 0;
local_card->msg[0].input_area = (void *) &(op->Inputs) + input_area_offset +
input_area_chansize;
local_card->msg[0].output_area = (void *) &(op->Outputs) + output_area_offset +
output_area_chansize;
modulep = (pwr_sClass_Modbus_RTU_Module *) cardp->op;
modulep->Status = pwr_eModbusModule_StatusEnum_StatusUnknown;
io_bus_card_init( ctx, cardp, &input_area_offset, &input_area_chansize,
&output_area_offset, &output_area_chansize,
pwr_eByteOrderingEnum_BigEndian);
/* Count number of di and do */
for (i = 0; i < cardp->ChanListSize; i++) {
chanp = &cardp->chanlist[i];
switch (chanp->ChanClass) {
case pwr_cClass_ChanDi:
no_di++;
break;
case pwr_cClass_ChanDo:
no_do++;
break;
}
}
local_card->msg[0].input_size = input_area_offset + input_area_chansize -
prev_input_area_offset;
local_card->msg[0].output_size = output_area_offset + output_area_chansize -
prev_output_area_offset;
local_card->msg[0].no_di = no_di;
local_card->msg[0].no_do = no_do;
break;
}
} /* End - switch ... */
prev_input_area_offset = input_area_offset + input_area_chansize;
prev_output_area_offset = output_area_offset + output_area_chansize;
cardp = cardp->next;
}
local->input_size = input_area_offset + input_area_chansize;
local->output_size = output_area_offset + output_area_chansize;
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Read method for the Modbus_TCP slave
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackRead (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp
)
{
#if 0
io_sRackLocal *local;
pwr_sClass_Modbus_TCP_Slave *sp;
pwr_tStatus sts;
pwr_tTime now;
pwr_tDeltaTime dt;
local = rp->Local;
sp = (pwr_sClass_Modbus_TCP_Slave *) rp->op;
/* Receive data */
if ((sp->Status == MB__NORMAL) && !sp->SingleOp) {
sts = mb_recv_data(local, rp, sp);
}
if (sp->DisableSlave != 1) {
if (sp->Status == MB__NORMAL) {
sp->ErrorCount = 0;
}
else {
sp->ErrorCount++;
}
if (sp->ErrorCount > sp->ErrorLimit) {
memset(&sp->Inputs, 0, local->input_size);
}
}
else {
sp->ErrorCount = 0;
sp->Status = MB__DISABLED;
}
#endif
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Write method for the Modbus_TCP slave
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackWrite (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp
)
{
#if 0
io_sRackLocal *local;
pwr_sClass_Modbus_TCP_Slave *sp;
pwr_tStatus sts;
local = rp->Local;
sp = (pwr_sClass_Modbus_TCP_Slave *) rp->op;
local->expected_msgs = 0;
if (sp->Status == MB__NORMAL && sp->DisableSlave != 1) {
sts = mb_send_data( rp, ap->Local, local, ap->op, sp, mb_mSendMask_WriteReq);
}
if (sp->DisableSlave == 1) sp->Status = MB__DISABLED;
#endif
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackClose (
io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp
)
{
return IO__SUCCESS;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport pwr_BindIoMethods(Modbus_RTU_Slave) = {
pwr_BindIoMethod(IoRackInit),
pwr_BindIoMethod(IoRackRead),
pwr_BindIoMethod(IoRackWrite),
pwr_BindIoMethod(IoRackClose),
pwr_NullMethod
};
......@@ -13,4 +13,9 @@ typedef struct {
int interval_cnt;
} io_sLocalAiDevice;
typedef struct {
FILE *value_fp;
int interval_cnt;
} io_sLocalAoDevice;
#endif
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2011 SSAB Oxelosund AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* rt_io_m_onewire_aodevice.c -- I/O methods for class OneWire_AoDevice. */
#include <float.h>
#include <math.h>
#include "pwr.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "co_time.h"
#include "rt_io_base.h"
#include "rt_io_card_init.h"
#include "rt_io_card_close.h"
#include "rt_io_card_write.h"
#include "rt_io_msg.h"
#include "rt_io_m_onewire.h"
static pwr_tStatus IoCardInit( io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp)
{
pwr_sClass_OneWire_AoDevice *op = (pwr_sClass_OneWire_AoDevice *)cp->op;
io_sLocalAoDevice *local;
pwr_tStatus sts;
char name[40];
pwr_tFileName fname, tmp;
int name_len;
char *s;
if ( cp->chanlist[0].cop) {
local = (io_sLocalAoDevice *) calloc( 1, sizeof(io_sLocalAoDevice));
cp->Local = local;
sprintf( name, "%d-%012x", op->Family, op->Super.Address);
name_len = strlen(name);
strncpy( fname, op->DataFile, sizeof(fname));
// Replace all '%s' with 'family-serialnumber'
s = fname;
while ( (s = strstr( s, "%s"))) {
strncpy( tmp, s+2, sizeof(tmp));
strcpy( s, name);
strncat( fname, tmp, sizeof(fname));
}
local->value_fp = fopen( fname, "w");
if (!local->value_fp) {
errh_Error( "OneWire_AoDevice Unable op open %s, '%ux'", cp->Name,
op->Super.Address);
sts = IO__INITFAIL;
op->Status = sts;
return sts;
}
io_AoRangeToCoef( &cp->chanlist[0]);
errh_Info( "Init of OneWire_AoDevice '%s'", cp->Name);
}
return IO__SUCCESS;
}
static pwr_tStatus IoCardClose( io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp)
{
io_sLocalAoDevice *local = (io_sLocalAoDevice *)cp->Local;
if ( cp->chanlist[0].cop) {
fclose( local->value_fp);
}
free( cp->Local);
return IO__SUCCESS;
}
static pwr_tStatus IoCardWrite( io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp)
{
io_sLocalAoDevice *local = (io_sLocalAoDevice *)cp->Local;
pwr_sClass_OneWire_AoDevice *op = (pwr_sClass_OneWire_AoDevice *)cp->op;
char str[80];
pwr_tUInt32 error_count = op->Super.ErrorCount;
int num;
if ( op->ScanInterval > 1) {
if ( local->interval_cnt != 0) {
local->interval_cnt++;
if ( local->interval_cnt >= op->ScanInterval)
local->interval_cnt = 0;
return IO__SUCCESS;
}
local->interval_cnt++;
}
if ( cp->chanlist[0].cop && cp->chanlist[0].sop) {
io_sChannel *chanp = &cp->chanlist[0];
pwr_sClass_ChanAo *cop = (pwr_sClass_ChanAo *)chanp->cop;
pwr_sClass_Ao *sop = (pwr_sClass_Ao *)chanp->sop;
if ( cop->CalculateNewCoef)
// Request to calculate new coefficients
io_AoRangeToCoef( chanp);
switch ( op->ChAo.Representation) {
case pwr_eDataRepEnum_Float32:
case pwr_eDataRepEnum_Float64: {
pwr_tFloat32 fvalue;
fvalue = *(pwr_tFloat32 *)cp->chanlist[0].vbp * cop->OutPolyCoef1 + cop->OutPolyCoef0;
if ( fvalue > cop->ActValRangeHigh)
fvalue = cop->ActValRangeHigh;
else if ( fvalue < cop->ActValRangeLow)
fvalue = cop->ActValRangeLow;
if ( fvalue > 0)
sop->RawValue = fvalue + 0.5;
else
sop->RawValue = fvalue - 0.5;
if ( strcmp( op->Format, "") == 0 )
num = snprintf( str, sizeof(str), "%f", fvalue);
else
num = snprintf( str, sizeof(str), op->Format, fvalue);
if ( num == 0)
op->Super.ErrorCount++;
break;
}
default: {
pwr_tInt32 ivalue;
pwr_tFloat32 fvalue;
fvalue = *(pwr_tFloat32 *)cp->chanlist[0].vbp * cop->OutPolyCoef1 + cop->OutPolyCoef0;
if ( fvalue > cop->ActValRangeHigh)
fvalue = cop->ActValRangeHigh;
else if ( fvalue < cop->ActValRangeLow)
fvalue = cop->ActValRangeLow;
if ( fvalue > 0)
ivalue = sop->RawValue = fvalue + 0.5;
else
ivalue = sop->RawValue = fvalue - 0.5;
if ( strcmp( op->Format, "") == 0 )
num = snprintf( str, sizeof(str), "%d", ivalue);
else
num = snprintf( str, sizeof(str), op->Format, ivalue);
if ( num == 0)
op->Super.ErrorCount++;
}
}
if ( num) {
fprintf( local->value_fp, "%s", str);
fflush( local->value_fp);
rewind( local->value_fp);
}
}
if ( op->Super.ErrorCount >= op->Super.ErrorSoftLimit &&
error_count < op->Super.ErrorSoftLimit) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
}
if ( op->Super.ErrorCount >= op->Super.ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
}
return IO__SUCCESS;
}
/* Every method should be registred here. */
pwr_dExport pwr_BindIoMethods(OneWire_AoDevice) = {
pwr_BindIoMethod(IoCardInit),
pwr_BindIoMethod(IoCardClose),
pwr_BindIoMethod(IoCardWrite),
pwr_NullMethod
};
......@@ -112,6 +112,10 @@ typedef struct {
short int no_do;
int interval_cnt;
int has_read_method;
} io_sCardLocalMsg;
typedef struct {
io_sCardLocalMsg msg[2];
} io_sCardLocal;
typedef struct {
......
This diff is collapsed.
......@@ -2,14 +2,21 @@ MotionControl_USB
MotionControl_USBIO
Modbus_TCP_Slave
Modbus_Module
Modbus_ModuleReadWrite
Modbus_Master
Modbus_TCP_Server
Modbus_TCP_ServerModule
Modbus_RTU_Slave
Modbus_RTU_Module
Modbus_RTU_Master
Modbus_RTU_Server
Modbus_RTU_ServerModule
Arduino_Uno
#if OS_LINUX
GPIO
GPIO_Module
OneWire_AiDevice
OneWire_AoDevice
Maxim_DS18B20
USB_Agent
Velleman_K8055_Board
......
This diff is collapsed.
......@@ -8,6 +8,6 @@ link = $(ldxx) -L$(pwr_elib) $(elinkflags) $(domap) -o $(pwr_exe)/profinet_viewe
$(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o \
$(pwre_conf_libdir) $(pwre_conf_libpwrxttgtk) $(pwre_conf_libpwrxtt) $(pwre_conf_libgtk) \
$(pwre_conf_libpwrrt) $(pwre_conf_lib)
$(pwre_conf_libpwrrt) $(pwre_conf_pnak) $(pwre_conf_lib)
endif
......@@ -1106,6 +1106,10 @@ int pb_gsd::build()
// Check Module UserPrmDataLen
for ( gsd_sModule *mp = modulelist; mp; mp = mp->next) {
if ( mp->Ext_Module_Prm_Data_Len > 0 && !mp->extuserprmdataconst) {
mp->extuserprmdataconst = (gsd_sExtUserPrmDataConst *) calloc( 1, sizeof(gsd_sExtUserPrmDataConst));
mp->extuserprmdataconst->len = mp->Ext_Module_Prm_Data_Len;
}
if ( mp->Ext_Module_Prm_Data_Len == 0 && mp->extuserprmdataconst)
mp->Ext_Module_Prm_Data_Len = mp->extuserprmdataconst->len +
mp->extuserprmdataconst->Const_Offset;
......
......@@ -231,6 +231,8 @@ static gsdml_sAttribute attrlist[] = {
{ "PowerOnToCommReady", gsdml_eTag_DeviceAccessPointItem, gsdml_eTag_, gsdml_eType_Unsigned32, sizeof(gsdml_tUnsigned32), offsetof(gsdml_sDeviceAccessPointItem,PowerOnToCommReady), 0, "0"},
{ "ParameterizationSpeedupSupported", gsdml_eTag_DeviceAccessPointItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sDeviceAccessPointItem,ParameterizationSpeedSupported), 0, "false"},
{ "NameOfStationNotTransferable", gsdml_eTag_DeviceAccessPointItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sDeviceAccessPointItem,NameOfStationNotTransferable), 0, "false"},
{ "DeviceAccessSupported", gsdml_eTag_DeviceAccessPointItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sDeviceAccessPointItem,DeviceAccessSupported), 0, "false"},
{ "SharedDeviceSupported", gsdml_eTag_DeviceAccessPointItem, gsdml_eTag_, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sDeviceAccessPointItem,SharedDeviceSupported), 0, "false"},
//
// ModuleInfo
//
......@@ -426,6 +428,7 @@ static gsdml_sAttribute attrlist[] = {
//
// InterfaceSubmoduleItem
//
{ "ID", gsdml_eTag_InterfaceSubmoduleItem, gsdml_eTag_, gsdml_eType_Id, sizeof(gsdml_tId), offsetof(gsdml_sInterfaceSubmoduleItem,ID), 0, ""},
{ "SubslotNumber", gsdml_eTag_InterfaceSubmoduleItem, gsdml_eTag_, gsdml_eType_Unsigned16, sizeof(gsdml_tUnsigned16), offsetof(gsdml_sInterfaceSubmoduleItem,SubslotNumber), 0, "32768"},
{ "TextId", gsdml_eTag_InterfaceSubmoduleItem, gsdml_eTag_, gsdml_eType_RefId, sizeof(gsdml_tRefId), offsetof(gsdml_sInterfaceSubmoduleItem,TextId), 0, ""},
{ "SupportedRT_Class", gsdml_eTag_InterfaceSubmoduleItem, gsdml_eTag_, gsdml_eType_Enum, sizeof(gsdml_tEnum), offsetof(gsdml_sInterfaceSubmoduleItem,SupportedRT_Class), 0, "Class1"},
......@@ -462,6 +465,7 @@ static gsdml_sAttribute attrlist[] = {
{ "NumberOfAdditionalOutputCR", gsdml_eTag_ApplicationRelations, gsdml_eTag_InterfaceSubmoduleItem, gsdml_eType_Unsigned16, sizeof(gsdml_tUnsigned16), offsetof(gsdml_sInterfaceSubmoduleItem_ApplicationRelations,NumberOfAdditionalOutputCR), 0, "0"},
{ "NumberOfAdditionalMulticastProviderCR", gsdml_eTag_ApplicationRelations, gsdml_eTag_InterfaceSubmoduleItem, gsdml_eType_Unsigned16, sizeof(gsdml_tUnsigned16), offsetof(gsdml_sInterfaceSubmoduleItem_ApplicationRelations,NumberOfAdditionalMulticastProviderCR), 0, "0"},
{ "NumberOfMulticastConsumerCR", gsdml_eTag_ApplicationRelations, gsdml_eTag_InterfaceSubmoduleItem, gsdml_eType_Unsigned16, sizeof(gsdml_tUnsigned16), offsetof(gsdml_sInterfaceSubmoduleItem_ApplicationRelations,NumberOfMulticastConsumerCR), 0, "0"},
{ "NumberOfAR", gsdml_eTag_ApplicationRelations, gsdml_eTag_InterfaceSubmoduleItem, gsdml_eType_Unsigned16, sizeof(gsdml_tUnsigned16), offsetof(gsdml_sInterfaceSubmoduleItem_ApplicationRelations,NumberOfAR), 0, "1"},
{ "PullModuleAlarmSupported", gsdml_eTag_ApplicationRelations, gsdml_eTag_InterfaceSubmoduleItem, gsdml_eType_Boolean, sizeof(gsdml_tBoolean), offsetof(gsdml_sInterfaceSubmoduleItem_ApplicationRelations,PullModuleAlarmSupported), 0, "false"},
// These should not exist in InterfaceSubmodulItem ...
{ "AR_BlockVersion", gsdml_eTag_ApplicationRelations, gsdml_eTag_InterfaceSubmoduleItem, gsdml_eType_Unsigned16, 0, 0, 1, ""},
......@@ -490,6 +494,7 @@ static gsdml_sAttribute attrlist[] = {
//
// PortSubmoduleItem
//
{ "ID", gsdml_eTag_PortSubmoduleItem, gsdml_eTag_, gsdml_eType_Id, sizeof(gsdml_tId), offsetof(gsdml_sPortSubmoduleItem,ID), 0, ""},
{ "SubslotNumber", gsdml_eTag_PortSubmoduleItem, gsdml_eTag_, gsdml_eType_Unsigned16, sizeof(gsdml_tUnsigned16), offsetof(gsdml_sPortSubmoduleItem,SubslotNumber), 0, ""},
{ "TextId", gsdml_eTag_PortSubmoduleItem, gsdml_eTag_, gsdml_eType_RefId, sizeof(gsdml_tRefId), offsetof(gsdml_sPortSubmoduleItem,TextId), 0, ""},
{ "MAUType", gsdml_eTag_PortSubmoduleItem, gsdml_eTag_, gsdml_eType_Enum, sizeof(gsdml_tEnum), offsetof(gsdml_sPortSubmoduleItem,MAUType), 0, "100BASETXFD"},
......
......@@ -850,6 +850,7 @@ typedef struct {
gsdml_tUnsigned16 NumberOfAdditionalOutputCR;
gsdml_tUnsigned16 NumberOfAdditionalMulticastProviderCR;
gsdml_tUnsigned16 NumberOfMulticastConsumerCR;
gsdml_tUnsigned16 NumberOfAR;
gsdml_tBoolean PullModuleAlarmSupported;
} gsdml_sInterfaceSubmoduleItem_ApplicationRelations;
......@@ -880,6 +881,7 @@ class gsdml_MediaRedundancy {
};
typedef struct {
gsdml_tId ID;
gsdml_tUnsigned16 SubslotNumber;
gsdml_tRefId TextId;
gsdml_tEnum SupportedRT_Class;
......@@ -914,6 +916,7 @@ class gsdml_InterfaceSubmoduleItem {
};
typedef struct {
gsdml_tId ID;
gsdml_tUnsigned16 SubslotNumber;
gsdml_tRefId TextId;
gsdml_tEnum MAUType;
......@@ -1066,6 +1069,8 @@ typedef struct {
gsdml_tUnsigned32 PowerOnToCommReady;
gsdml_tBoolean ParameterizationSpeedSupported;
gsdml_tBoolean NameOfStationNotTransferable;
gsdml_tBoolean DeviceAccessSupported;
gsdml_tBoolean SharedDeviceSupported;
} gsdml_sDeviceAccessPointItem;
class gsdml_DeviceAccessPointItem {
......
......@@ -293,6 +293,8 @@ static pwr_tStatus IoAgentInit (
local->device_data[ii]->iocr_data[jj]->clean_io_data = (unsigned char *) calloc(1, offset_inputs + offset_outputs);
local->device_data[ii]->iocr_data[jj]->clean_io_data_length = offset_inputs + offset_outputs;
}
} else {
errh_Error( "Download of Profinet Device configuration failed for: %s", device_vect[ii]->device_name);
}
}
}
......
......@@ -246,7 +246,8 @@ static pwr_tStatus IoRackRead (
}
if (sp->ErrorCount > sp->ErrorSoftLimit ) {
memset(((io_sPnRackLocal *)(rp->Local))->inputs, 0, ((io_sPnRackLocal *)(rp->Local))->bytes_of_input);
if ( ((io_sPnRackLocal *)(rp->Local))->bytes_of_input > 0)
memset(((io_sPnRackLocal *)(rp->Local))->inputs, 0, ((io_sPnRackLocal *)(rp->Local))->bytes_of_input);
}
// if (sp->ErrorCount > sp->ErrorHardLimit && sp->StallAction >= pwr_ePbStallAction_EmergencyBreak) {
......
......@@ -57,7 +57,7 @@ typedef struct _PN_Alarm_Data {
class PnIOCRData {
public:
PnIOCRData() : type(0), number_modules(0), identifier(0), io_data_length(0) {}
PnIOCRData() : type(0), number_modules(0), identifier(0), io_data_length(0), clean_io_data_length(0) {}
unsigned short type;
unsigned short number_modules;
......
......@@ -508,6 +508,8 @@ int GsdmlDataReader::tag_attribute( const char *name, const char *value)
if ( strcmp( value, gsdmlfile_p) != 0 && !new_filename)
return PB__GSDMLFILEMISMATCH;
}
else
strncpy( data->gsdmlfile, value, sizeof(data->gsdmlfile));
}
else if ( strcmp( name, "DeviceText") == 0)
strncpy( data->device_text, value, sizeof(data->device_text));
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment