Commit b963e5f7 authored by Pavel Vainerman's avatar Pavel Vainerman

Сделал в simitator поддержку задания id в стиле "id@node"

parent 74011834
...@@ -7,14 +7,13 @@ using namespace UniSetTypes; ...@@ -7,14 +7,13 @@ using namespace UniSetTypes;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void help_print() void help_print()
{ {
cout << endl; cout << endl << "--help - Помощь по утилите" << endl;
cout << "--confile configure.xml. По умолчанию: configure.xml." << endl;
cout << "--sid id1@Node1,id2,..,idXX@NodeXX - Аналоговые датчики (AI,AO)" << endl; cout << "--sid id1@Node1,id2,..,idXX@NodeXX - Аналоговые датчики (AI,AO)" << endl;
cout << endl; cout << 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;
cout << "--pause msec - Пауза. По умолчанию 200 мсек" << endl << endl; cout << "--pause msec - Пауза. По умолчанию 200 мсек" << endl << endl;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
struct ExtInfo: struct ExtInfo:
...@@ -46,14 +45,14 @@ int main( int argc, char **argv ) ...@@ -46,14 +45,14 @@ int main( int argc, char **argv )
return 1; return 1;
} }
std::list<UniSetTypes::ParamSInfo> lst = UniSetTypes::getSInfoList(sid,UniSetTypes::conf); std::list<UniSetTypes::ParamSInfo> lst = UniSetTypes::getSInfoList(sid,UniSetTypes::conf);
if( lst.empty() ) if( lst.empty() )
{ {
cerr << endl << "Use --sid id1,..,idXX" << endl << endl; cerr << endl << "Use --sid id1,..,idXX" << endl << endl;
return 1; return 1;
} }
std::list<ExtInfo> l; std::list<ExtInfo> l;
for( std::list<UniSetTypes::ParamSInfo>::iterator it = lst.begin(); it!=lst.end(); ++it ) for( std::list<UniSetTypes::ParamSInfo>::iterator it = lst.begin(); it!=lst.end(); ++it )
{ {
...@@ -123,16 +122,16 @@ int main( int argc, char **argv ) ...@@ -123,16 +122,16 @@ int main( int argc, char **argv )
try try
{ {
if( it->iotype == UniversalIO::AnalogInput ) if( it->iotype == UniversalIO::AnalogInput )
ui.saveValue(it->si, j, UniversalIO::AnalogInput, DefaultObjectId); ui.saveValue(it->si, j, UniversalIO::AnalogInput, DefaultObjectId);
else else
ui.setValue(it->si, j, DefaultObjectId); ui.setValue(it->si, j, DefaultObjectId);
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
cerr << endl << "save id="<< it->fname << " " << ex << endl; cerr << endl << "save id="<< it->fname << " " << ex << endl;
} }
} }
if(j<=amin) if(j<=amin)
{ {
i = amin; i = amin;
...@@ -143,22 +142,22 @@ int main( int argc, char **argv ) ...@@ -143,22 +142,22 @@ int main( int argc, char **argv )
{ {
i += astep; i += astep;
if(i>amax) // Принудительная установка верхней границы датчика if(i>amax) // Принудительная установка верхней границы датчика
i = amax; i = amax;
cout << "\r" << " i = " << i <<" "<< flush; cout << "\r" << " i = " << i <<" "<< flush;
for( std::list<ExtInfo>::iterator it=l.begin(); it!=l.end(); ++it ) for( std::list<ExtInfo>::iterator it=l.begin(); it!=l.end(); ++it )
{ {
try try
{ {
if( it->iotype == UniversalIO::AnalogInput ) if( it->iotype == UniversalIO::AnalogInput )
ui.saveValue(it->si, i, UniversalIO::AnalogInput, DefaultObjectId); ui.saveValue(it->si, i, UniversalIO::AnalogInput, DefaultObjectId);
else else
ui.setValue(it->si, i, DefaultObjectId); ui.setValue(it->si, i, DefaultObjectId);
} }
catch( Exception& ex ) catch( Exception& ex )
{ {
cerr << endl << "save id="<< it->fname << " " << ex << endl; cerr << endl << "save id="<< it->fname << " " << ex << endl;
} }
} }
} }
msleep(amsec); msleep(amsec);
......
...@@ -4,7 +4,7 @@ ulimit -Sc 1000000 ...@@ -4,7 +4,7 @@ ulimit -Sc 1000000
#for i in `seq 1 20`; #for i in `seq 1 20`;
#do #do
uniset-start.sh -f ./uniset-simitator --confile test.xml --sid 34 uniset-start.sh -f ./uniset-simitator --confile test.xml --sid 10@localhost,9@3002
#done #done
#wait #wait
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Name: libuniset Name: libuniset
Version: 1.3 Version: 1.3
Release: alt2.1 Release: alt3
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
* Tue Jan 31 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt3
- minor fixes in simitator
* Tue Jan 24 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt2.1 * Tue Jan 24 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt2.1
- rebuild - rebuild
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment