Класс SEESInitMode

#include <SEESMode.h>

Граф наследования:SEESInitMode:

Inheritance graph
[см. легенду]
Граф связей класса SEESInitMode:

Collaboration graph
[см. легенду]

Полный список членов класса

Открытые члены

void Destroy ()
virtual bool activate (SEES *sc)
virtual const string modeName ()
virtual SEESMessage::SEESMode getMode ()
bool checkMode (SEES *sc)

Открытые статические члены

static SEESInitModeInstance ()


Подробное описание

Режим "инициализации" или "повторной попытки"
См. также:
Описание алгоритма управления конкретным ГДГ

Методы

bool SEESInitMode::activate ( SEES sc  )  [virtual]

Необходимо сделать:
Не следует ли здесь если режим "автомат" делать принудительный пуск или остановку (лидера), в зависимости от напряжения на шинах. И соответственно пуск или остановку резервного, в зависимости от команд управления резервом.

Переопределяет метод предка SEESMode.

Перекрестные ссылки SEES::initPause, SEESMessage::OffMode и SEESMessage::RunningMode.

00045 {
00046     SEES::dlog[Debug::INFO] << sc << ": init state..." << endl;
00047     // время на инициализацию режима СЭС, а также
00048     // состояния ГА
00049     msleep(sc->initPause);
00050     sc->updateValues();
00051     sc->dis->updateValues();
00052     sc->gen->updateValues();
00053     sc->qg->updateValues();
00054 
00055     if( sc->in_CtlMode_f == mOffControl ||
00056         sc->in_CtlMode_f == mUndefined )
00057     {
00058         SEES::dlog[Debug::INFO] << sc << ": режим ручного управления..." << endl;
00059         changeMode( SEESSleepMode::Instance(), sc );
00060         return true;
00061     }
00062     
00063     {
00064         if( sc->in_state_as == mPROTECTION )
00065         {
00066             SEES::dlog[Debug::INFO] << sc << "(activate): "
00067                         << " state == mPROTECTION " << endl;
00068             changeMode( SEESProtectionMode::Instance(), sc );
00069             return true;
00070         }
00071         
00072         try
00073         {
00074             bool qg_prot = sc->qg->isProtection();
00075             bool dis_prot = sc->dis->isProtection();
00076             bool gen_prot = sc->gen->isProtection();
00077             
00078             SEES::dlog[Debug::INFO] << sc << "(activate): "
00079                         << " qg_prot=" << qg_prot
00080                         << " gen_prot=" << gen_prot
00081                         << " dis_prot=" << dis_prot << endl;
00082                         
00083             if( qg_prot || dis_prot || gen_prot )
00084             {
00085                 SEES::dlog[Debug::INFO] << sc << ": init ProtectionMode\n";
00086                 changeMode( SEESProtectionMode::Instance(), sc );
00087                 return true;
00088             }
00089 
00090 #warning Maybe check state_as?
00091             bool qg_state = sc->qg->isOnMode();
00092             bool dis_state = sc->dis->isOnMode();
00093             bool gen_state = sc->gen->isOnMode();
00094             SEES::dlog[Debug::INFO] << sc << ": init Diesel=" << dis_state
00095                                 << " Generator=" << gen_state 
00096                                 << " QG=" << qg_state 
00097                                 << " sees=" << sc->in_state_as << endl;
00098 //          try
00099 //          {
00100 //              sc->updateValues();
00101 //          }
00102 //          catch( Exception& ex )
00103 //          {
00104 //              SEES::dlog[Debug::CRIT] << sc << ": (init): !!!!!!!!!! " << ex << endl;
00105 //              throw;
00106 //          }
00107 
00108             if( ( dis_state && gen_state && qg_state ) || (sc->in_state_as == mON) )
00109             {
00110                 sc->out_postID = sc->myPostID;
00111                 if( sc->in_CtlMode_f == mAuto )
00112                 {
00113                     if( sc->in_Leader_f )
00114                     {
00115                         SEES::dlog[Debug::INFO] << sc << ": to auto mode.." << endl;
00116                         changeMode( SEESOnAutoMode::Instance(), sc );
00117                     }
00118                     else
00119                     {
00120                         SEES::dlog[Debug::INFO] << sc << ": to reserv mode.." << endl;
00121                         changeMode( SEESOnReservMode::Instance(), sc );
00122                     }
00123                     return true;
00124                 }
00125 
00126                 SEES::dlog[Debug::INFO] << sc << ": to on mode.." << endl;
00127                 changeMode( SEESOnMode::Instance(), sc );
00128                 return true;
00129             }
00130             else if( ( dis_state && gen_state ) || ( sc->in_state_as == mRunning ) )
00131             {
00132                 if( sc->in_CtlMode_f == mPultControl )
00133                 {
00134                     sc->out_postID = sc->myPostID;
00135                     changeMode( SEESRunningMode::Instance(), sc );
00136                     return true;
00137                 }
00138                 else if( sc->in_CtlMode_f == mAuto )
00139                 {
00140                     sc->out_postID = sc->myPostID;
00141 //                  if( sc->in_Leader_f )
00142 //                  {
00143                         if( sc->in_NoPower_S )
00144                             changeMode( SEESAutoWaitingMode::Instance(sc,SEESMessage::RunningMode,SEESProtectionMode::Instance()), sc );
00145                         else
00146                             changeMode( SEESAutoWaitingMode::Instance(sc,SEESMessage::OffMode,SEESProtectionMode::Instance()), sc );
00147 //                  }
00148                     return true;
00149                 }
00150             }
00151             else if( (!dis_state && !gen_state && !qg_state) || (sc->in_state_as == mOFF) )
00152             {
00153                 if( sc->in_CtlMode_f == mAuto )
00154                 {
00155                     sc->out_postID = sc->myPostID;
00156                     if( sc->in_Leader_f )
00157                         changeMode( SEESAutoMode::Instance(), sc );
00158                     else
00159                         changeMode( SEESReservMode::Instance(), sc );
00160                     return true;
00161                 }
00162             
00163                 sc->out_postID = sc->myPostID;
00164                 changeMode( SEESOffMode::Instance(), sc );
00165                 return true;
00166             }
00167             
00168             if( checkMode(sc) )
00169                 return true;
00170             
00171             if( sc->in_state_as == mTRANSITIVE )
00172             {
00173                 for( int i=0; i<sc->initAttempts; i++ )
00174                 {
00175                     msleep(sc->initPause);
00176                     sc->updateValues();
00177                     if( checkMode(sc) )
00178                         return true;
00179                 }
00180             }
00181         }
00182         catch(Exception& ex)
00183         {
00184             SEES::dlog[Debug::WARN] << sc << ": " << ex << endl;
00185         }
00186         catch(...)
00187         {
00188             SEES::dlog[Debug::CRIT] << sc << ": неопределённое состояние" << endl;
00189         }
00190         // Undefined state logic....
00191         SEES::dlog[Debug::INFO] << sc << ": state_as=" << sc->in_state_as 
00192                 << " " << txtModeName((ObjectMode)sc->in_state_as)
00193                 << endl;
00194 
00195         if( sc->in_state_as == mPROTECTION  )
00196         {
00197             changeMode( SEESProtectionMode::Instance(), sc );
00198             return true;
00199         }
00200 
00201         if( sc->in_CtlMode_f == mAuto )
00202         {
00203             // если состояние "переходное", то делаем несколько попыток
00204             // подождать...
00205             if( sc->in_state_as == mTRANSITIVE )
00206             {
00207                 for( int i=0; i<sc->initAttempts; i++ )
00208                 {
00209                     msleep(sc->initPause);
00210                     sc->updateValues();
00211                     if( sc->in_state_as != mTRANSITIVE )
00212                         break;
00213                 }
00214             }
00215         
00216             if( sc->in_Leader_f )
00217             {
00218                 if( sc->in_state_as == mON )
00219                 {
00220                     changeMode( SEESOnAutoMode::Instance(), sc );
00221                     return true;
00222                 }
00223                 else if( sc->in_state_as == mOFF )
00224                 {
00225                     changeMode( SEESAutoMode::Instance(), sc );
00226                     return true;
00227                 }
00228             }
00229             else
00230             {
00231                 if( sc->in_state_as == mON )
00232                 {
00233                     changeMode( SEESOnReservMode::Instance(), sc );
00234                     return true;
00235                 }
00236                 else if( sc->in_state_as == mOFF )
00237                 {
00238                     changeMode( SEESReservMode::Instance(), sc );
00239                     return true;
00240                 }
00241             }
00242         }
00243 
00244         SEES::dlog[Debug::CRIT] << sc << ": ПРОТИВОРЕЧИВОЕ СОСТОЯНИЕ" << endl;
00251 //      changeMode( SEESUndefinedMode::Instance(), sc );
00252         changeMode( SEESProtectionMode::Instance(), sc );
00253     }
00254     
00255     return true;
00256 }


Объявления и описания членов классов находятся в файлах:

Документация по uniset-algorithms. Последние изменения: Fri Dec 12 14:27:17 2014. Создано системой  doxygen 1.5.9