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
0d882a8c
Commit
0d882a8c
authored
Mar 19, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил возможность задавать пороговые датчики для процесса обмена
Modbus TCP|RTU
parent
fa6d6a5f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
22 deletions
+39
-22
libuniset.spec
conf/libuniset.spec
+5
-1
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+22
-11
MBExchange.h
extensions/ModbusMaster/MBExchange.h
+5
-0
RTUExchange.cc
extensions/ModbusMaster/RTUExchange.cc
+6
-9
IOBase.h
extensions/include/IOBase.h
+1
-1
No files found.
conf/libuniset.spec
View file @
0d882a8c
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
Name: libuniset
Name: libuniset
Version: 1.7
Version: 1.7
Release: alt
8
Release: alt
9
Summary: UniSet - library for building distributed industrial control systems
Summary: UniSet - library for building distributed industrial control systems
...
@@ -335,6 +335,10 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
...
@@ -335,6 +335,10 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet.pc
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
%changelog
* Wed Mar 19 2014 Pavel Vainerman <pv@altlinux.ru> 1.7-alt9
- add thresholds processing for ModbusMaster (TCP and RTU)
- minor fixes
* Fri Mar 07 2014 Pavel Vainerman <pv@altlinux.ru> 1.7-alt8
* Fri Mar 07 2014 Pavel Vainerman <pv@altlinux.ru> 1.7-alt8
- fixed bug in ComPort class (getTimeout. eterbug #9890)
- fixed bug in ComPort class (getTimeout. eterbug #9890)
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
0d882a8c
...
@@ -309,9 +309,17 @@ void MBExchange::initIterators()
...
@@ -309,9 +309,17 @@ void MBExchange::initIterators()
{
{
shm
->
initDIterator
(
it2
->
dit
);
shm
->
initDIterator
(
it2
->
dit
);
shm
->
initAIterator
(
it2
->
ait
);
shm
->
initAIterator
(
it2
->
ait
);
shm
->
initAIterator
(
it2
->
t_ait
);
}
}
}
}
}
}
for
(
ThresholdList
::
iterator
t
=
thrlist
.
begin
();
t
!=
thrlist
.
end
();
++
t
)
{
shm
->
initDIterator
(
t
->
dit
);
shm
->
initAIterator
(
t
->
ait
);
shm
->
initAIterator
(
t
->
t_ait
);
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
bool
MBExchange
::
checkUpdateSM
(
bool
wrFunc
,
long
mdev
)
bool
MBExchange
::
checkUpdateSM
(
bool
wrFunc
,
long
mdev
)
...
@@ -1832,6 +1840,15 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML_iterator& it )
...
@@ -1832,6 +1840,15 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML_iterator& it )
if
(
!
IOBase
::
initItem
(
&
p
,
it
,
shm
,
&
dlog
,
myname
)
)
if
(
!
IOBase
::
initItem
(
&
p
,
it
,
shm
,
&
dlog
,
myname
)
)
return
false
;
return
false
;
// проверяем не пороговый ли это датчик (т.е. не связанный с обменом)
// тогда заносим его в отдельный список
if
(
p
.
t_ai
!=
DefaultObjectId
)
{
thrlist
.
push_back
(
p
);
return
true
;
}
if
(
it
.
getIntProp
(
prop_prefix
+
"rawdata"
)
)
if
(
it
.
getIntProp
(
prop_prefix
+
"rawdata"
)
)
{
{
p
.
cal
.
minRaw
=
0
;
p
.
cal
.
minRaw
=
0
;
...
@@ -2838,18 +2855,12 @@ void MBExchange::poll()
...
@@ -2838,18 +2855,12 @@ void MBExchange::poll()
updateSM
();
updateSM
();
// check thresholds
// check thresholds
for
(
MBExchange
::
RTUDeviceMap
::
iterator
it1
=
rmap
.
begin
();
it1
!=
rmap
.
end
();
++
it1
)
for
(
ThresholdList
::
iterator
t
=
thrlist
.
begin
();
t
!=
thrlist
.
end
();
++
t
)
{
{
RTUDevice
*
d
(
it1
->
second
);
if
(
!
checkProcActive
()
)
for
(
MBExchange
::
RegMap
::
iterator
it
=
d
->
regmap
.
begin
();
it
!=
d
->
regmap
.
end
();
++
it
)
return
;
{
if
(
!
checkProcActive
()
)
IOBase
::
processingThreshold
(
&
(
*
t
),
shm
,
force
);
return
;
RegInfo
*
r
(
it
->
second
);
for
(
PList
::
iterator
i
=
r
->
slst
.
begin
();
i
!=
r
->
slst
.
end
();
++
i
)
IOBase
::
processingThreshold
(
&
(
*
i
),
shm
,
force
);
}
}
}
if
(
trReopen
.
hi
(
allNotRespond
)
)
if
(
trReopen
.
hi
(
allNotRespond
)
)
...
...
extensions/ModbusMaster/MBExchange.h
View file @
0d882a8c
...
@@ -325,6 +325,11 @@ class MBExchange:
...
@@ -325,6 +325,11 @@ class MBExchange:
PassiveTimer
ptReopen
;
/*!< таймер для переоткрытия соединения */
PassiveTimer
ptReopen
;
/*!< таймер для переоткрытия соединения */
Trigger
trReopen
;
Trigger
trReopen
;
// т.к. пороговые датчики не связаны напрямую с обменом, создаём для них отдельный список
// и отдельно его проверяем потом
typedef
std
::
list
<
IOBase
>
ThresholdList
;
ThresholdList
thrlist
;
private
:
private
:
MBExchange
();
MBExchange
();
...
...
extensions/ModbusMaster/RTUExchange.cc
View file @
0d882a8c
...
@@ -301,17 +301,14 @@ void RTUExchange::poll()
...
@@ -301,17 +301,14 @@ void RTUExchange::poll()
updateSM
();
updateSM
();
// check thresholds
// check thresholds
for
(
MBExchange
::
RTUDeviceMap
::
iterator
it1
=
rmap
.
begin
();
it1
!=
rmap
.
end
();
++
it1
)
for
(
ThresholdList
::
iterator
t
=
thrlist
.
begin
();
t
!=
thrlist
.
end
();
++
t
)
{
{
RTUDevice
*
d
(
it1
->
second
);
if
(
!
checkProcActive
()
)
for
(
RTUExchange
::
RegMap
::
iterator
it
=
d
->
regmap
.
begin
();
it
!=
d
->
regmap
.
end
();
++
it
)
return
;
{
RegInfo
*
r
(
it
->
second
);
IOBase
::
processingThreshold
(
&
(
*
t
),
shm
,
force
);
for
(
PList
::
iterator
i
=
r
->
slst
.
begin
();
i
!=
r
->
slst
.
end
();
++
i
)
IOBase
::
processingThreshold
(
&
(
*
i
),
shm
,
force
);
}
}
}
if
(
trReopen
.
hi
(
allNotRespond
)
)
if
(
trReopen
.
hi
(
allNotRespond
)
)
ptReopen
.
reset
();
ptReopen
.
reset
();
...
...
extensions/include/IOBase.h
View file @
0d882a8c
...
@@ -101,7 +101,7 @@ static const int NoSafety = -1;
...
@@ -101,7 +101,7 @@ static const int NoSafety = -1;
хранится идентификатор аналогового датчика
хранится идентификатор аналогового датчика
с которым он связан */
с которым он связан */
IONotifyController_i
::
ThresholdInfo
ti
;
IONotifyController_i
::
ThresholdInfo
ti
;
IOController
::
AIOStateList
::
iterator
t_ait
;
/*! итератор на датчик по которому формируется порог */
IOController
::
AIOStateList
::
iterator
ait
;
IOController
::
AIOStateList
::
iterator
ait
;
IOController
::
DIOStateList
::
iterator
dit
;
IOController
::
DIOStateList
::
iterator
dit
;
...
...
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