Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
26209421
Commit
26209421
authored
Dec 26, 2009
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed minor bugs in Modbus
parent
618b749e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
34 additions
and
20 deletions
+34
-20
start_fg.sh
Utilities/DBServer-MySQL/start_fg.sh
+1
-1
MBTCPServer.cc
Utilities/MBTester/MBTCPServer.cc
+2
-2
start_fg.sh
Utilities/SImitator/start_fg.sh
+7
-1
test.xml
conf/test.xml
+2
-2
MBTCPMaster.cc
extensions/MBTCPMaster/MBTCPMaster.cc
+0
-0
MBTCPMaster.h
extensions/MBTCPMaster/MBTCPMaster.h
+18
-10
start_fg.sh
extensions/MBTCPMaster/start_fg.sh
+1
-1
RTUExchange.cc
extensions/RTUExchange/RTUExchange.cc
+1
-1
IONotifyController.cc
src/Processes/IONotifyController.cc
+2
-2
No files found.
Utilities/DBServer-MySQL/start_fg.sh
View file @
26209421
...
@@ -2,4 +2,4 @@
...
@@ -2,4 +2,4 @@
ulimit
-Sc
1000000
ulimit
-Sc
1000000
uniset-start.sh
-f
./uniset-mysql-dbserver
--confile
test.xml
--unideb-add-levels
info,crit,warn,level9,system
uniset-start.sh
-f
./uniset-mysql-dbserver
--confile
test.xml
--
name
DBServer
--
unideb-add-levels
info,crit,warn,level9,system
Utilities/MBTester/MBTCPServer.cc
View file @
26209421
...
@@ -48,9 +48,9 @@ MBTCPServer::MBTCPServer( ModbusAddr myaddr, const string inetaddr, int port, bo
...
@@ -48,9 +48,9 @@ MBTCPServer::MBTCPServer( ModbusAddr myaddr, const string inetaddr, int port, bo
sslot
->
connectRemoteService
(
sigc
::
mem_fun
(
this
,
&
MBTCPServer
::
remoteService
)
);
sslot
->
connectRemoteService
(
sigc
::
mem_fun
(
this
,
&
MBTCPServer
::
remoteService
)
);
sslot
->
connectFileTransfer
(
sigc
::
mem_fun
(
this
,
&
MBTCPServer
::
fileTransfer
)
);
sslot
->
connectFileTransfer
(
sigc
::
mem_fun
(
this
,
&
MBTCPServer
::
fileTransfer
)
);
sslot
->
setRecvTimeout
(
2
000
);
sslot
->
setRecvTimeout
(
6
000
);
// sslot->setAfterSendPause(afterSend);
// sslot->setAfterSendPause(afterSend);
// sslot->setReplyTimeout(replyTimeout
);
sslot
->
setReplyTimeout
(
10000
);
// build file list...
// build file list...
}
}
...
...
Utilities/SImitator/start_fg.sh
View file @
26209421
...
@@ -2,6 +2,12 @@
...
@@ -2,6 +2,12 @@
ulimit
-Sc
1000000
ulimit
-Sc
1000000
uniset-start.sh
-f
./uniset-simitator
--confile
test.xml
--sid
10,16
#for i in `seq 1 20`;
#do
uniset-start.sh
-f
./uniset-simitator
--confile
test.xml
--sid
10,16
#done
wait
#--unideb-add-levels info,crit,warn,level9,system
#--unideb-add-levels info,crit,warn,level9,system
conf/test.xml
View file @
26209421
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
<RSExchange
name=
"RSExchange"
speed=
"38400"
>
<RSExchange
name=
"RSExchange"
speed=
"38400"
>
<DeviceList>
<DeviceList>
<item
addr=
"0x02"
speed=
"9600"
respondSensor=
"RespondRTU_S"
timeout=
"5000"
invert=
"0"
/>
<item
addr=
"0x02"
force_disconnect=
"1"
speed=
"9600"
respondSensor=
"RespondRTU_S"
timeout=
"5000"
invert=
"0"
/>
</DeviceList>
</DeviceList>
</RSExchange>
</RSExchange>
...
@@ -112,7 +112,7 @@
...
@@ -112,7 +112,7 @@
<item
name=
"Input1_S"
textname=
" 1"
node=
""
iotype=
"DI"
priority=
"Medium"
default=
"1"
/>
<item
name=
"Input1_S"
textname=
" 1"
node=
""
iotype=
"DI"
priority=
"Medium"
default=
"1"
/>
<item
name=
"Input2_S"
textname=
" 2"
node=
""
iotype=
"DI"
priority=
"Medium"
mbtype=
"rtu"
mbaddr=
"0x01"
mbfunc=
"0x04"
mbreg=
"0x02"
rs=
"2"
/>
<item
name=
"Input2_S"
textname=
" 2"
node=
""
iotype=
"DI"
priority=
"Medium"
mbtype=
"rtu"
mbaddr=
"0x01"
mbfunc=
"0x04"
mbreg=
"0x02"
rs=
"2"
/>
<item
name=
"Input3_S"
textname=
" 3"
node=
""
iotype=
"DI"
priority=
"Medium"
<item
name=
"Input3_S"
textname=
" 3"
node=
""
iotype=
"DI"
priority=
"Medium"
mbtcp=
"1"
tcp_mbtype=
"rtu"
tcp_mbaddr=
"0x02"
tcp_mbfunc=
"0x0
4"
tcp_mbreg=
"0x02"
/>
mbtcp=
"1"
tcp_mbtype=
"rtu"
tcp_mbaddr=
"0x02"
tcp_mbfunc=
"0x0
6"
tcp_mbreg=
"0x02"
tcp_preinit=
"1"
/>
<item
name=
"Input4_S"
textname=
" 4"
node=
""
iotype=
"DI"
priority=
"Medium"
mbtype=
"rtu"
mbaddr=
"0x02"
mbfunc=
"0x04"
mbreg=
"0x02"
rs=
"2"
/>
<item
name=
"Input4_S"
textname=
" 4"
node=
""
iotype=
"DI"
priority=
"Medium"
mbtype=
"rtu"
mbaddr=
"0x02"
mbfunc=
"0x04"
mbreg=
"0x02"
rs=
"2"
/>
<item
name=
"Input5_S"
textname=
" 5"
node=
""
iotype=
"DI"
priority=
"Medium"
udp=
"2"
/>
<item
name=
"Input5_S"
textname=
" 5"
node=
""
iotype=
"DI"
priority=
"Medium"
udp=
"2"
/>
<item
name=
"Input6_S"
textname=
" 6"
node=
""
iotype=
"DI"
priority=
"Medium"
udp=
"2"
>
<item
name=
"Input6_S"
textname=
" 6"
node=
""
iotype=
"DI"
priority=
"Medium"
udp=
"2"
>
...
...
extensions/MBTCPMaster/MBTCPMaster.cc
View file @
26209421
This diff is collapsed.
Click to expand it.
extensions/MBTCPMaster/MBTCPMaster.h
View file @
26209421
...
@@ -175,8 +175,8 @@ class MBTCPMaster:
...
@@ -175,8 +175,8 @@ class MBTCPMaster:
enum
DeviceType
enum
DeviceType
{
{
dtUnknown
,
/*!< */
dtUnknown
,
/*!< */
dtRTU
/*!< RTU (default) */
dtRTU
/*!< RTU (default) */
};
};
static
DeviceType
getDeviceType
(
const
std
::
string
dtype
);
static
DeviceType
getDeviceType
(
const
std
::
string
dtype
);
...
@@ -189,10 +189,10 @@ class MBTCPMaster:
...
@@ -189,10 +189,10 @@ class MBTCPMaster:
public
IOBase
public
IOBase
{
{
// only for RTU
// only for RTU
short
nbit
;
/*!< bit number) */
short
nbit
;
/*!< bit number) */
VTypes
::
VType
vType
;
/*!< type of value */
VTypes
::
VType
vType
;
/*!< type of value */
short
rnum
;
/*!< count of registers */
short
rnum
;
/*!< count of registers */
short
nbyte
;
/*!< byte number (1-2) */
short
nbyte
;
/*!< byte number (1-2) */
RSProperty
()
:
RSProperty
()
:
nbit
(
-
1
),
vType
(
VTypes
::
vtUnknown
),
nbit
(
-
1
),
vType
(
VTypes
::
vtUnknown
),
...
@@ -213,11 +213,12 @@ class MBTCPMaster:
...
@@ -213,11 +213,12 @@ class MBTCPMaster:
RegInfo
()
:
RegInfo
()
:
mbval
(
0
),
mbreg
(
0
),
mbfunc
(
ModbusRTU
::
fnUnknown
),
mbval
(
0
),
mbreg
(
0
),
mbfunc
(
ModbusRTU
::
fnUnknown
),
dev
(
0
),
offset
(
0
),
dev
(
0
),
offset
(
0
),
q_num
(
0
),
q_count
(
1
)
q_num
(
0
),
q_count
(
1
),
mb_init
(
false
),
sm_init
(
false
),
mb_init_mbreg
(
0
)
{}
{}
ModbusRTU
::
ModbusData
mbval
;
ModbusRTU
::
ModbusData
mbval
;
ModbusRTU
::
ModbusData
mbreg
;
/*!< */
ModbusRTU
::
ModbusData
mbreg
;
/*!< */
ModbusRTU
::
SlaveFunctionCode
mbfunc
;
/*!< / */
ModbusRTU
::
SlaveFunctionCode
mbfunc
;
/*!< / */
PList
slst
;
PList
slst
;
...
@@ -226,10 +227,13 @@ class MBTCPMaster:
...
@@ -226,10 +227,13 @@ class MBTCPMaster:
int
offset
;
int
offset
;
// optimization
// optimization
int
q_num
;
/*! number in query */
int
q_num
;
/*! number in query */
int
q_count
;
/*! count registers for query */
int
q_count
;
/*! count registers for query */
RegMap
::
iterator
rit
;
RegMap
::
iterator
rit
;
bool
mb_init
;
/*!< init before use */
bool
sm_init
;
/*!< SM init value */
ModbusRTU
::
ModbusData
mb_init_mbreg
;
/*!< mb_init register */
};
};
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
RegInfo
&
r
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
RegInfo
&
r
);
...
@@ -243,8 +247,10 @@ class MBTCPMaster:
...
@@ -243,8 +247,10 @@ class MBTCPMaster:
resp_id
(
UniSetTypes
::
DefaultObjectId
),
resp_id
(
UniSetTypes
::
DefaultObjectId
),
resp_state
(
false
),
resp_state
(
false
),
resp_invert
(
false
),
resp_invert
(
false
),
resp_real
(
true
),
resp_real
(
false
),
resp_init
(
false
)
resp_init
(
false
),
ask_every_reg
(
false
),
force_disconnect
(
false
)
{
{
resp_trTimeout
.
change
(
false
);
resp_trTimeout
.
change
(
false
);
}
}
...
@@ -263,6 +269,8 @@ class MBTCPMaster:
...
@@ -263,6 +269,8 @@ class MBTCPMaster:
bool
resp_invert
;
bool
resp_invert
;
bool
resp_real
;
bool
resp_real
;
bool
resp_init
;
bool
resp_init
;
bool
ask_every_reg
;
bool
force_disconnect
;
// return TRUE if state changed
// return TRUE if state changed
bool
checkRespond
();
bool
checkRespond
();
...
...
extensions/MBTCPMaster/start_fg.sh
View file @
26209421
...
@@ -8,7 +8,7 @@ uniset-start.sh -f ./uniset-mbtcpmaster \
...
@@ -8,7 +8,7 @@ uniset-start.sh -f ./uniset-mbtcpmaster \
--mbtcp-filter-field
mbtcp
\
--mbtcp-filter-field
mbtcp
\
--mbtcp-filter-value
1
\
--mbtcp-filter-value
1
\
--mbtcp-gateway-iaddr
127.0.0.1
\
--mbtcp-gateway-iaddr
127.0.0.1
\
--mbtcp-gateway-port
1024
\
--mbtcp-gateway-port
2048
\
--mbtcp-recv-timeout
5000
--mbtcp-recv-timeout
5000
#--mbtcp-filter-field mbtcp --mbtcp-filter-value 1
#--mbtcp-filter-field mbtcp --mbtcp-filter-value 1
extensions/RTUExchange/RTUExchange.cc
View file @
26209421
...
@@ -1727,7 +1727,7 @@ void RTUExchange::updateRSProperty( RSProperty* p, bool write_only )
...
@@ -1727,7 +1727,7 @@ void RTUExchange::updateRSProperty( RSProperty* p, bool write_only )
IOBase
::
processingAsDI
(
p
,
r
->
mbval
,
shm
,
force
);
IOBase
::
processingAsDI
(
p
,
r
->
mbval
,
shm
,
force
);
}
}
else
else
IOBase
::
processingAsAI
(
p
,
(
unsigned
short
)(
r
->
mbval
)
,
shm
,
force
);
IOBase
::
processingAsAI
(
p
,
r
->
mbval
,
shm
,
force
);
}
}
return
;
return
;
}
}
...
...
src/Processes/IONotifyController.cc
View file @
26209421
...
@@ -251,7 +251,7 @@ void IONotifyController::askState( const IOController_i::SensorInfo& si,
...
@@ -251,7 +251,7 @@ void IONotifyController::askState( const IOController_i::SensorInfo& si,
smsg
.
sm_tv_usec
=
li
->
second
.
tv_usec
;
smsg
.
sm_tv_usec
=
li
->
second
.
tv_usec
;
}
}
TransportMessage
tm
(
smsg
.
transport_msg
());
TransportMessage
tm
(
smsg
.
transport_msg
());
try
try
{
{
ui
.
send
(
ci
.
id
,
tm
,
ci
.
node
);
ui
.
send
(
ci
.
id
,
tm
,
ci
.
node
);
...
@@ -1149,7 +1149,7 @@ void IONotifyController::askOutput(const IOController_i::SensorInfo& si,
...
@@ -1149,7 +1149,7 @@ void IONotifyController::askOutput(const IOController_i::SensorInfo& si,
smsg
.
sensor_type
=
type
;
smsg
.
sensor_type
=
type
;
smsg
.
supplier
=
getId
();
smsg
.
supplier
=
getId
();
TransportMessage
tm
(
smsg
.
transport_msg
());
TransportMessage
tm
(
smsg
.
transport_msg
());
ui
.
send
(
ci
.
id
,
tm
,
ci
.
node
);
ui
.
send
(
ci
.
id
,
tm
,
ci
.
node
);
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment