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
49939803
Commit
49939803
authored
Dec 21, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(LogicProcessor): исправил баг с определением iotype датчика
parent
ec61eb32
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
31 deletions
+60
-31
libuniset.spec
conf/libuniset.spec
+4
-1
LProcessor.cc
extensions/LogicProcessor/LProcessor.cc
+22
-10
PassiveLProcessor.cc
extensions/LogicProcessor/PassiveLProcessor.cc
+8
-8
TAND.cc
extensions/LogicProcessor/TAND.cc
+5
-2
TDelay.cc
extensions/LogicProcessor/TDelay.cc
+10
-4
TNOT.cc
extensions/LogicProcessor/TNOT.cc
+5
-2
TOR.cc
extensions/LogicProcessor/TOR.cc
+4
-2
start_fg.sh
extensions/LogicProcessor/start_fg.sh
+1
-1
start_fg_plogic.sh
extensions/LogicProcessor/start_fg_plogic.sh
+1
-1
No files found.
conf/libuniset.spec
View file @
49939803
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
Name: libuniset
Name: libuniset
Version: 1.0
Version: 1.0
Release: alt
59
Release: alt
60
Summary: UniSet - library for building distributed industrial control systems
Summary: UniSet - library for building distributed industrial control systems
License: GPL
License: GPL
Group: Development/C++
Group: Development/C++
...
@@ -213,6 +213,9 @@ rm -f %buildroot%_libdir/*.la
...
@@ -213,6 +213,9 @@ rm -f %buildroot%_libdir/*.la
%changelog
%changelog
* Wed Dec 21 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt60
- fixed bug in LogicProcessor
* Mon Dec 19 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt59
* Mon Dec 19 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt59
- add precision for output variables
- add precision for output variables
...
...
extensions/LogicProcessor/LProcessor.cc
View file @
49939803
#include <iostream>
#include <iostream>
#include "Configuration.h"
#include "Configuration.h"
#include "Extensions.h"
#include "LProcessor.h"
#include "LProcessor.h"
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
using
namespace
std
;
using
namespace
std
;
using
namespace
UniSetTypes
;
using
namespace
UniSetTypes
;
using
namespace
UniSetExtensions
;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
LProcessor
::
LProcessor
()
LProcessor
::
LProcessor
()
{
{
...
@@ -26,15 +28,15 @@ void LProcessor::execute( const string lfile )
...
@@ -26,15 +28,15 @@ void LProcessor::execute( const string lfile )
}
}
catch
(
LogicException
&
ex
)
catch
(
LogicException
&
ex
)
{
{
cerr
<<
"(LProcessor::execute): "
<<
ex
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::execute): "
<<
ex
<<
endl
;
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
cerr
<<
"(LProcessor::execute): "
<<
ex
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::execute): "
<<
ex
<<
endl
;
}
}
catch
(...)
catch
(...)
{
{
cerr
<<
"(LProcessor::execute): catch...
\n
"
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::execute): catch...
\n
"
;
}
}
msleep
(
sleepTime
);
msleep
(
sleepTime
);
}
}
...
@@ -58,7 +60,7 @@ void LProcessor::build( const string& lfile )
...
@@ -58,7 +60,7 @@ void LProcessor::build( const string& lfile )
UniSetTypes
::
ObjectId
sid
=
conf
->
getSensorID
(
it
->
name
);
UniSetTypes
::
ObjectId
sid
=
conf
->
getSensorID
(
it
->
name
);
if
(
sid
==
DefaultObjectId
)
if
(
sid
==
DefaultObjectId
)
{
{
cerr
<<
"НЕ НАЙДЕН ИДЕНТИФИКАТОР ДАТЧИКА: "
<<
it
->
name
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"НЕ НАЙДЕН ИДЕНТИФИКАТОР ДАТЧИКА: "
<<
it
->
name
<<
endl
;
continue
;
continue
;
}
}
...
@@ -66,7 +68,12 @@ void LProcessor::build( const string& lfile )
...
@@ -66,7 +68,12 @@ void LProcessor::build( const string& lfile )
ei
.
sid
=
sid
;
ei
.
sid
=
sid
;
ei
.
state
=
false
;
ei
.
state
=
false
;
ei
.
lnk
=
&
(
*
it
);
ei
.
lnk
=
&
(
*
it
);
ei
.
iotype
=
UniversalIO
::
UnknownIOType
;
ei
.
iotype
=
conf
->
getIOType
(
sid
);
if
(
ei
.
iotype
==
UniversalIO
::
UnknownIOType
)
{
dlog
[
Debug
::
CRIT
]
<<
"Unkown iotype for sid="
<<
sid
<<
"("
<<
it
->
name
<<
")"
<<
endl
;
continue
;
}
extInputs
.
push_front
(
ei
);
extInputs
.
push_front
(
ei
);
}
}
...
@@ -75,14 +82,19 @@ void LProcessor::build( const string& lfile )
...
@@ -75,14 +82,19 @@ void LProcessor::build( const string& lfile )
UniSetTypes
::
ObjectId
sid
=
conf
->
getSensorID
(
it
->
name
);
UniSetTypes
::
ObjectId
sid
=
conf
->
getSensorID
(
it
->
name
);
if
(
sid
==
DefaultObjectId
)
if
(
sid
==
DefaultObjectId
)
{
{
cerr
<<
"НЕ НАЙДЕН ИДЕНТИФИКАТОР ВЫХОДА: "
<<
it
->
name
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"НЕ НАЙДЕН ИДЕНТИФИКАТОР ВЫХОДА: "
<<
it
->
name
<<
endl
;
continue
;
continue
;
}
}
EXTOutInfo
ei
;
EXTOutInfo
ei
;
ei
.
sid
=
sid
;
ei
.
sid
=
sid
;
ei
.
lnk
=
&
(
*
it
);
ei
.
lnk
=
&
(
*
it
);
ei
.
iotype
=
UniversalIO
::
UnknownIOType
;
ei
.
iotype
=
conf
->
getIOType
(
sid
);
if
(
ei
.
iotype
==
UniversalIO
::
UnknownIOType
)
{
dlog
[
Debug
::
CRIT
]
<<
"Unkown iotype for sid="
<<
sid
<<
"("
<<
it
->
name
<<
")"
<<
endl
;
continue
;
}
extOuts
.
push_front
(
ei
);
extOuts
.
push_front
(
ei
);
}
}
...
@@ -135,17 +147,17 @@ void LProcessor::setOuts()
...
@@ -135,17 +147,17 @@ void LProcessor::setOuts()
break
;
break
;
default
:
default
:
cerr
<<
"(LProcessor::setOuts): неподдерживаемый тип iotype="
<<
it
->
iotype
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::setOuts): неподдерживаемый тип iotype="
<<
it
->
iotype
<<
endl
;
break
;
break
;
}
}
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
cerr
<<
"(LProcessor::setOuts): "
<<
ex
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::setOuts): "
<<
ex
<<
endl
;
}
}
catch
(...)
catch
(...)
{
{
cerr
<<
"(LProcessor::setOuts): catch...
\n
"
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::setOuts): catch...
\n
"
;
}
}
}
}
}
}
...
...
extensions/LogicProcessor/PassiveLProcessor.cc
View file @
49939803
...
@@ -90,7 +90,7 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm )
...
@@ -90,7 +90,7 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm )
{
{
if
(
!
shm
->
waitSMready
(
10000
)
)
if
(
!
shm
->
waitSMready
(
10000
)
)
{
{
cerr
<<
"(ERR): SM not ready. Terminated... "
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"(ERR): SM not ready. Terminated... "
<<
endl
;
raise
(
SIGTERM
);
raise
(
SIGTERM
);
return
;
return
;
}
}
...
@@ -163,17 +163,17 @@ void PassiveLProcessor::setOuts()
...
@@ -163,17 +163,17 @@ void PassiveLProcessor::setOuts()
break
;
break
;
default
:
default
:
cerr
<<
"(LProcessor::setOuts): неподдерживаемый тип iotype="
<<
it
->
iotype
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::setOuts): неподдерживаемый тип iotype="
<<
it
->
iotype
<<
endl
;
break
;
break
;
}
}
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
cerr
<<
"(LProcessor::setOuts): "
<<
ex
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::setOuts): "
<<
ex
<<
endl
;
}
}
catch
(...)
catch
(...)
{
{
cerr
<<
"(LProcessor::setOuts): catch...
\n
"
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::setOuts): catch...
\n
"
;
}
}
}
}
}
}
...
@@ -195,17 +195,17 @@ void PassiveLProcessor::sigterm( int signo )
...
@@ -195,17 +195,17 @@ void PassiveLProcessor::sigterm( int signo )
break
;
break
;
default
:
default
:
cerr
<<
"(LProcessor::sigterm): неподдерживаемый тип iotype="
<<
it
->
iotype
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::sigterm): неподдерживаемый тип iotype="
<<
it
->
iotype
<<
endl
;
break
;
break
;
}
}
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
cerr
<<
"(LProcessor::sigterm): "
<<
ex
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::sigterm): "
<<
ex
<<
endl
;
}
}
catch
(...)
catch
(...)
{
{
cerr
<<
"(LProcessor::sigterm): catch...
\n
"
;
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::sigterm): catch...
\n
"
;
}
}
}
}
}
}
...
@@ -243,7 +243,7 @@ void PassiveLProcessor::processingMessage( UniSetTypes::VoidMessage* msg )
...
@@ -243,7 +243,7 @@ void PassiveLProcessor::processingMessage( UniSetTypes::VoidMessage* msg )
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
cout
<<
myname
<<
"(processingMessage): "
<<
ex
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(processingMessage): "
<<
ex
<<
endl
;
}
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
extensions/LogicProcessor/TAND.cc
View file @
49939803
#include <iostream>
#include <iostream>
#include "Extensions.h"
#include "Element.h"
#include "Element.h"
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
using
namespace
std
;
using
namespace
std
;
using
namespace
UniSetExtensions
;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
TAND
::
TAND
(
ElementID
id
,
int
num
,
bool
st
)
:
TAND
::
TAND
(
ElementID
id
,
int
num
,
bool
st
)
:
TOR
(
id
,
num
,
st
)
TOR
(
id
,
num
,
st
)
...
@@ -46,7 +47,9 @@ void TAND::setIn( int num, bool state )
...
@@ -46,7 +47,9 @@ void TAND::setIn( int num, bool state )
if
(
!
brk
)
if
(
!
brk
)
myout
=
true
;
myout
=
true
;
cout
<<
this
<<
": myout "
<<
myout
<<
endl
;
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
dlog
[
Debug
::
INFO
]
<<
this
<<
": myout "
<<
myout
<<
endl
;
if
(
prev
!=
myout
)
if
(
prev
!=
myout
)
Element
::
setChildOut
();
Element
::
setChildOut
();
}
}
...
...
extensions/LogicProcessor/TDelay.cc
View file @
49939803
#include <iostream>
#include <iostream>
#include "Extensions.h"
#include "TDelay.h"
#include "TDelay.h"
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
using
namespace
std
;
using
namespace
std
;
using
namespace
UniSetExtensions
;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
TDelay
::
TDelay
(
Element
::
ElementID
id
,
int
delayMS
,
int
inCount
)
:
TDelay
::
TDelay
(
Element
::
ElementID
id
,
int
delayMS
,
int
inCount
)
:
Element
(
id
),
Element
(
id
),
...
@@ -28,7 +30,8 @@ void TDelay::setIn( int num, bool state )
...
@@ -28,7 +30,8 @@ void TDelay::setIn( int num, bool state )
{
{
pt
.
setTiming
(
0
);
// reset timer
pt
.
setTiming
(
0
);
// reset timer
myout
=
false
;
myout
=
false
;
cout
<<
this
<<
": set "
<<
myout
<<
endl
;
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
dlog
[
Debug
::
INFO
]
<<
this
<<
": set "
<<
myout
<<
endl
;
if
(
prev
!=
myout
)
if
(
prev
!=
myout
)
Element
::
setChildOut
();
Element
::
setChildOut
();
return
;
return
;
...
@@ -41,7 +44,8 @@ void TDelay::setIn( int num, bool state )
...
@@ -41,7 +44,8 @@ void TDelay::setIn( int num, bool state )
{
{
pt
.
setTiming
(
0
);
// reset timer
pt
.
setTiming
(
0
);
// reset timer
myout
=
true
;
myout
=
true
;
cout
<<
this
<<
": set "
<<
myout
<<
endl
;
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
dlog
[
Debug
::
INFO
]
<<
this
<<
": set "
<<
myout
<<
endl
;
if
(
prev
!=
myout
)
if
(
prev
!=
myout
)
Element
::
setChildOut
();
Element
::
setChildOut
();
return
;
return
;
...
@@ -50,7 +54,8 @@ void TDelay::setIn( int num, bool state )
...
@@ -50,7 +54,8 @@ void TDelay::setIn( int num, bool state )
// засекаем, если ещё не установлен таймер
// засекаем, если ещё не установлен таймер
if
(
!
myout
&&
!
prev
)
// т.е. !myout && prev != myout
if
(
!
myout
&&
!
prev
)
// т.е. !myout && prev != myout
{
{
cout
<<
this
<<
": set timer "
<<
delay
<<
" [msec]"
<<
endl
;
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
dlog
[
Debug
::
INFO
]
<<
this
<<
": set timer "
<<
delay
<<
" [msec]"
<<
endl
;
pt
.
setTiming
(
delay
);
pt
.
setTiming
(
delay
);
}
}
}
}
...
@@ -61,7 +66,8 @@ void TDelay::tick()
...
@@ -61,7 +66,8 @@ void TDelay::tick()
{
{
myout
=
true
;
myout
=
true
;
pt
.
setTiming
(
0
);
// reset timer
pt
.
setTiming
(
0
);
// reset timer
cout
<<
getType
()
<<
"("
<<
myid
<<
"): TIMER!!!! myout="
<<
myout
<<
endl
;
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
dlog
[
Debug
::
INFO
]
<<
getType
()
<<
"("
<<
myid
<<
"): TIMER!!!! myout="
<<
myout
<<
endl
;
Element
::
setChildOut
();
Element
::
setChildOut
();
}
}
}
}
...
...
extensions/LogicProcessor/TNOT.cc
View file @
49939803
#include <sstream>
#include <sstream>
#include <iostream>
#include <iostream>
#include "Extensions.h"
#include "Element.h"
#include "Element.h"
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
using
namespace
std
;
using
namespace
std
;
using
namespace
UniSetExtensions
;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
TNOT
::
TNOT
(
ElementID
id
,
bool
out_default
)
:
TNOT
::
TNOT
(
ElementID
id
,
bool
out_default
)
:
Element
(
id
),
Element
(
id
),
...
@@ -21,7 +22,9 @@ void TNOT::setIn( int num, bool state )
...
@@ -21,7 +22,9 @@ void TNOT::setIn( int num, bool state )
bool
prev
=
myout
;
bool
prev
=
myout
;
myout
=
!
state
;
myout
=
!
state
;
cout
<<
this
<<
": myout "
<<
myout
<<
endl
;
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
dlog
[
Debug
::
INFO
]
<<
this
<<
": myout "
<<
myout
<<
endl
;
if
(
prev
!=
myout
)
if
(
prev
!=
myout
)
Element
::
setChildOut
();
Element
::
setChildOut
();
}
}
...
...
extensions/LogicProcessor/TOR.cc
View file @
49939803
#include <sstream>
#include <sstream>
#include <iostream>
#include <iostream>
#include "Extensions.h"
#include "Element.h"
#include "Element.h"
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
using
namespace
std
;
using
namespace
std
;
using
namespace
UniSetExtensions
;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
TOR
::
TOR
(
ElementID
id
,
int
num
,
bool
st
)
:
TOR
::
TOR
(
ElementID
id
,
int
num
,
bool
st
)
:
Element
(
id
),
Element
(
id
),
...
@@ -59,7 +60,8 @@ void TOR::setIn( int num, bool state )
...
@@ -59,7 +60,8 @@ void TOR::setIn( int num, bool state )
if
(
!
brk
)
if
(
!
brk
)
myout
=
false
;
myout
=
false
;
cout
<<
this
<<
": myout "
<<
myout
<<
endl
;
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
dlog
[
Debug
::
INFO
]
<<
this
<<
": myout "
<<
myout
<<
endl
;
if
(
prev
!=
myout
)
if
(
prev
!=
myout
)
Element
::
setChildOut
();
Element
::
setChildOut
();
}
}
...
...
extensions/LogicProcessor/start_fg.sh
View file @
49939803
#!/bin/sh
#!/bin/sh
uniset-start.sh
-f
./uniset-logicproc
--confile
test.xml
--
unideb-add-levels
info,crit,warn,level9,system
uniset-start.sh
-f
./uniset-logicproc
--confile
test.xml
--
schema
schema.xml
--unideb-add-levels
any
--dlog-add-levels
any
extensions/LogicProcessor/start_fg_plogic.sh
View file @
49939803
#!/bin/sh
#!/bin/sh
uniset-start.sh
-
f
./uniset-plogicproc
--schema
schema.xml
\
uniset-start.sh
-
g
./uniset-plogicproc
--schema
schema.xml
\
--smemory-id
SharedMemory
--name
LProcessor
\
--smemory-id
SharedMemory
--name
LProcessor
\
--confile
test.xml
--unideb-add-levels
info,crit,warn,level9,system
--confile
test.xml
--unideb-add-levels
info,crit,warn,level9,system
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