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 @@
Name: libuniset
Version: 1.7
Release: alt
8
Release: alt
9
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -335,6 +335,10 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet.pc
%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
- fixed bug in ComPort class (getTimeout. eterbug #9890)
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
0d882a8c
...
...
@@ -309,9 +309,17 @@ void MBExchange::initIterators()
{
shm
->
initDIterator
(
it2
->
dit
);
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
)
...
...
@@ -1832,6 +1840,15 @@ bool MBExchange::initRSProperty( RSProperty& p, UniXML_iterator& it )
if
(
!
IOBase
::
initItem
(
&
p
,
it
,
shm
,
&
dlog
,
myname
)
)
return
false
;
// проверяем не пороговый ли это датчик (т.е. не связанный с обменом)
// тогда заносим его в отдельный список
if
(
p
.
t_ai
!=
DefaultObjectId
)
{
thrlist
.
push_back
(
p
);
return
true
;
}
if
(
it
.
getIntProp
(
prop_prefix
+
"rawdata"
)
)
{
p
.
cal
.
minRaw
=
0
;
...
...
@@ -2838,18 +2855,12 @@ void MBExchange::poll()
updateSM
();
// 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
);
for
(
MBExchange
::
RegMap
::
iterator
it
=
d
->
regmap
.
begin
();
it
!=
d
->
regmap
.
end
();
++
it
)
{
if
(
!
checkProcActive
()
)
return
;
RegInfo
*
r
(
it
->
second
);
for
(
PList
::
iterator
i
=
r
->
slst
.
begin
();
i
!=
r
->
slst
.
end
();
++
i
)
IOBase
::
processingThreshold
(
&
(
*
i
),
shm
,
force
);
}
if
(
!
checkProcActive
()
)
return
;
IOBase
::
processingThreshold
(
&
(
*
t
),
shm
,
force
);
}
if
(
trReopen
.
hi
(
allNotRespond
)
)
...
...
extensions/ModbusMaster/MBExchange.h
View file @
0d882a8c
...
...
@@ -325,6 +325,11 @@ class MBExchange:
PassiveTimer
ptReopen
;
/*!< таймер для переоткрытия соединения */
Trigger
trReopen
;
// т.к. пороговые датчики не связаны напрямую с обменом, создаём для них отдельный список
// и отдельно его проверяем потом
typedef
std
::
list
<
IOBase
>
ThresholdList
;
ThresholdList
thrlist
;
private
:
MBExchange
();
...
...
extensions/ModbusMaster/RTUExchange.cc
View file @
0d882a8c
...
...
@@ -301,17 +301,14 @@ void RTUExchange::poll()
updateSM
();
// 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
);
for
(
RTUExchange
::
RegMap
::
iterator
it
=
d
->
regmap
.
begin
();
it
!=
d
->
regmap
.
end
();
++
it
)
{
RegInfo
*
r
(
it
->
second
);
for
(
PList
::
iterator
i
=
r
->
slst
.
begin
();
i
!=
r
->
slst
.
end
();
++
i
)
IOBase
::
processingThreshold
(
&
(
*
i
),
shm
,
force
);
}
if
(
!
checkProcActive
()
)
return
;
IOBase
::
processingThreshold
(
&
(
*
t
),
shm
,
force
);
}
if
(
trReopen
.
hi
(
allNotRespond
)
)
ptReopen
.
reset
();
...
...
extensions/include/IOBase.h
View file @
0d882a8c
...
...
@@ -101,7 +101,7 @@ static const int NoSafety = -1;
хранится идентификатор аналогового датчика
с которым он связан */
IONotifyController_i
::
ThresholdInfo
ti
;
IOController
::
AIOStateList
::
iterator
t_ait
;
/*! итератор на датчик по которому формируется порог */
IOController
::
AIOStateList
::
iterator
ait
;
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