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
681a5bc1
Commit
681a5bc1
authored
Nov 17, 2009
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify uniset-simitator: add param fir use more sensors
parent
c6821247
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
17 deletions
+49
-17
main.cc
Utilities/SImitator/main.cc
+48
-16
start_fg.sh
Utilities/SImitator/start_fg.sh
+1
-1
No files found.
Utilities/SImitator/main.cc
View file @
681a5bc1
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
#include <iostream>
#include <iostream>
#include "Exceptions.h"
#include "Exceptions.h"
#include "UniversalInterface.h"
#include "UniversalInterface.h"
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
using
namespace
std
;
using
namespace
std
;
using
namespace
UniSetTypes
;
using
namespace
UniSetTypes
;
...
@@ -10,7 +9,7 @@ using namespace UniSetTypes;
...
@@ -10,7 +9,7 @@ using namespace UniSetTypes;
void
help_print
()
void
help_print
()
{
{
cout
<<
endl
<<
"--help - "
<<
endl
;
cout
<<
endl
<<
"--help - "
<<
endl
;
cout
<<
"--sid id
- sensor
ID (AnalogInput)"
<<
endl
;
cout
<<
"--sid id
1,..,idXX - sensors
ID (AnalogInput)"
<<
endl
;
cout
<<
"--min val - . 0"
<<
endl
;
cout
<<
"--min val - . 0"
<<
endl
;
cout
<<
"--max val - . 100 "
<<
endl
;
cout
<<
"--max val - . 100 "
<<
endl
;
cout
<<
"--step val - . 1"
<<
endl
;
cout
<<
"--step val - . 1"
<<
endl
;
...
@@ -30,16 +29,25 @@ int main( int argc, char **argv )
...
@@ -30,16 +29,25 @@ int main( int argc, char **argv )
}
}
// -------------------------------------
// -------------------------------------
uniset_init
(
argc
,
argv
,
"configure.xml"
);
uniset_init
(
argc
,
argv
,
"configure.xml"
);
UniversalInterface
ui
;
UniversalInterface
ui
;
UniSetTypes
::
IDList
lst
;
string
sid
(
conf
->
getArgParam
(
"--sid"
));
if
(
sid
.
empty
()
)
{
cerr
<<
endl
<<
"Use --sid id1,..,idXX"
<<
endl
<<
endl
;
return
1
;
}
lst
=
UniSetTypes
::
explode
(
sid
);
std
::
list
<
ObjectId
>
l
=
lst
.
getList
();
int
asid
=
conf
->
getArgInt
(
"--sid"
,
""
);
if
(
l
.
empty
()
)
if
(
asid
<=
0
)
{
{
cerr
<<
endl
<<
"Use --sid id"
<<
endl
<<
endl
;
cerr
<<
endl
<<
"Use --sid id
1,..,idXX
"
<<
endl
<<
endl
;
return
1
;
return
1
;
}
}
int
amin
=
conf
->
getArgInt
(
"--min"
,
"0"
);
int
amin
=
conf
->
getArgInt
(
"--min"
,
"0"
);
int
amax
=
conf
->
getArgInt
(
"--max"
,
"100"
);
int
amax
=
conf
->
getArgInt
(
"--max"
,
"100"
);
if
(
amin
>
amax
)
if
(
amin
>
amax
)
...
@@ -66,7 +74,7 @@ int main( int argc, char **argv )
...
@@ -66,7 +74,7 @@ int main( int argc, char **argv )
cout
<<
endl
<<
"------------------------------"
<<
endl
;
cout
<<
endl
<<
"------------------------------"
<<
endl
;
cout
<<
" :"
<<
endl
;
cout
<<
" :"
<<
endl
;
cout
<<
"------------------------------"
<<
endl
;
cout
<<
"------------------------------"
<<
endl
;
cout
<<
" sid = "
<<
a
sid
<<
endl
;
cout
<<
" sid = "
<<
sid
<<
endl
;
cout
<<
" min = "
<<
amin
<<
endl
;
cout
<<
" min = "
<<
amin
<<
endl
;
cout
<<
" max = "
<<
amax
<<
endl
;
cout
<<
" max = "
<<
amax
<<
endl
;
cout
<<
" step = "
<<
astep
<<
endl
;
cout
<<
" step = "
<<
astep
<<
endl
;
...
@@ -74,7 +82,8 @@ int main( int argc, char **argv )
...
@@ -74,7 +82,8 @@ int main( int argc, char **argv )
cout
<<
"------------------------------"
<<
endl
<<
endl
;
cout
<<
"------------------------------"
<<
endl
<<
endl
;
int
i
=
amin
-
astep
,
j
=
amax
;
int
i
=
amin
-
astep
,
j
=
amax
;
while
(
1
)
while
(
1
)
{
{
if
(
i
>=
amax
)
if
(
i
>=
amax
)
...
@@ -83,12 +92,24 @@ int main( int argc, char **argv )
...
@@ -83,12 +92,24 @@ int main( int argc, char **argv )
if
(
j
<
amin
)
//
if
(
j
<
amin
)
//
j
=
amin
;
j
=
amin
;
cout
<<
"
\r
"
<<
" i = "
<<
j
<<
" "
<<
flush
;
cout
<<
"
\r
"
<<
" i = "
<<
j
<<
" "
<<
flush
;
ui
.
saveValue
(
asid
,
j
,
UniversalIO
::
AnalogInput
);
if
(
j
<=
amin
)
for
(
std
::
list
<
ObjectId
>::
iterator
it
=
l
.
begin
();
it
!=
l
.
end
();
++
it
)
{
{
i
=
amin
;
try
j
=
amax
;
{
}
ui
.
saveValue
((
*
it
),
j
,
UniversalIO
::
AnalogInput
);
}
catch
(
Exception
&
ex
)
{
cerr
<<
endl
<<
"save id="
<<
(
*
it
)
<<
" "
<<
ex
<<
endl
;
}
}
if
(
j
<=
amin
)
{
i
=
amin
;
j
=
amax
;
}
}
}
else
else
{
{
...
@@ -96,7 +117,18 @@ int main( int argc, char **argv )
...
@@ -96,7 +117,18 @@ int main( int argc, char **argv )
if
(
i
>
amax
)
//
if
(
i
>
amax
)
//
i
=
amax
;
i
=
amax
;
cout
<<
"
\r
"
<<
" i = "
<<
i
<<
" "
<<
flush
;
cout
<<
"
\r
"
<<
" i = "
<<
i
<<
" "
<<
flush
;
ui
.
saveValue
(
asid
,
i
,
UniversalIO
::
AnalogInput
);
for
(
std
::
list
<
ObjectId
>::
iterator
it
=
l
.
begin
();
it
!=
l
.
end
();
++
it
)
{
try
{
ui
.
saveValue
((
*
it
),
i
,
UniversalIO
::
AnalogInput
);
}
catch
(
Exception
&
ex
)
{
cerr
<<
endl
<<
"save id="
<<
(
*
it
)
<<
" "
<<
ex
<<
endl
;
}
}
}
}
msleep
(
amsec
);
msleep
(
amsec
);
}
}
...
...
Utilities/SImitator/start_fg.sh
View file @
681a5bc1
...
@@ -2,6 +2,6 @@
...
@@ -2,6 +2,6 @@
ulimit
-Sc
1000000
ulimit
-Sc
1000000
uniset-start.sh
-f
./uniset-simitator
--confile
test.xml
--sid
10
uniset-start.sh
-f
./uniset-simitator
--confile
test.xml
--sid
10
,16
#--unideb-add-levels info,crit,warn,level9,system
#--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