ERMsg CBioSIMModelBase::FinaliseInit()
	{
		ERMsg msg;

		SetLanguage(m_info.m_language);//Set global language variable

		if ((NB_INPUT_PARAMETER == -1 || m_info.m_inputParameters.size() == NB_INPUT_PARAMETER))
		{
			//process parameters
			msg += ProcessParameters(m_info.m_inputParameters);
		}
		else
		{
			//the number of input parameters in the model is incorrect
			msg = GetErrorMessage(ERROR_BAD_NUMBER_PARAMETER);
		}

		return msg;
	}
	void CBioSIMModelBase::GetFValue(const std::vector<double>& paramArray, CStatisticXY& stat)
	{
		Randomize((unsigned int)m_info.m_seed);
		InitRandomGenerator(m_info.m_seed);

		for (size_t i = 0, j = 0; i < m_info.m_inputParameters.size() && j < paramArray.size(); i++)
		{
			if (m_info.m_inputParameters[i].IsVariable())
			{
				std::string value;
				value = ToString(paramArray[j]);
				m_info.m_inputParameters[i].SetString(value);
				j++;
			}
		}

		ProcessParameters(m_info.m_inputParameters);

		InitializeStat(stat);

		for (size_t i = 0; i < m_info.m_repCounter.GetTotal(); i++)
		{
			CStatisticXY statTmp;

			switch (m_info.m_TM.Type())
			{
			case CTM::HOURLY: GetFValueHourly(statTmp); break;
			case CTM::DAILY: GetFValueDaily(statTmp); break;
			case CTM::MONTHLY: GetFValueMonthly(statTmp); break;
			case CTM::ANNUAL: GetFValueAnnual(statTmp); break;
			case CTM::ATEMPORAL: GetFValueAtemporal(statTmp); break;
			default: _ASSERTE(false);
			}

			stat += statTmp;
		}


		FinalizeStat(stat);
	}
Ejemplo n.º 3
0
/*----------------------------------------------------------------------------*/
int main(int argc, char **argv, char *envp)
{
   char           szMsg[128];
   int            Index, ReturnCode ;
   TID            tidPager;
   ULONG          ulRC;
   PAGEMSGINFO    pInfo;


   printf("QuickPage/2 - OS/2 Operating System.\n");
   printf("Version 1.0 - Aug 29 1995.\n");

   #ifdef DEMO_ONLY
      printf("*************************\n");
      printf("*    EVALUATION COPY    *\n");
      printf("*************************\n");
   #endif

   printf("Copyright (C) OS/Tools Incorporated 1995 - All Rights Reserved.\n");

   bPopUp            = FALSE;
   ConfigFileDefined = FALSE;
   LogFileDefined    = FALSE;
   PinDefined        = FALSE;
   DisplayHelp       = FALSE;

   if (argc == 1)
      DisplayHelp = TRUE;

   memset(&pInfo,        0, sizeof(PAGEMSGINFO));
   memset(&szConfigFile, 0, sizeof(szConfigFile));
   memset(&szLogFile,    0, sizeof(szLogFile));

   /*-----------------------------------------------------*/
   /* First pass of parameters passed.                    */
   /*-----------------------------------------------------*/
   for(Index = 1; Index < argc; Index++)
   {
      ProcessParameters(argv[Index],
                        &pInfo,
                        TRUE);
   }

   if( ConfigFileDefined )
   {
      ReturnCode = ProcessConfigFile(szConfigFile,
                                     &pInfo);

      if(ReturnCode)
      {
         ReportErrorMessage( (int)ReturnCode );
         exit(ReturnCode);
      }
   }


   /*-----------------------------------------------------*/
   /* Second pass of parameters passed to override        */
   /* default configuration in PAGEDEF.CFG                */
   /*-----------------------------------------------------*/
   for(Index = 1; Index < argc; Index++)
   {
      ProcessParameters(argv[Index], 
                        &pInfo,
                        FALSE);
   }


   if ( DisplayHelp )
   {
      DisplaySyntax();
      exit(ID_INCORRECT_SYNTAX);
   }


   if(pInfo.Message[0] == 0)
      strcpy(pInfo.Message, "No Text");

   /*-----------------------------------------------------*/
   /* When an individual PIN is passed as parameter and   */
   /* a CFG file is also defined, all other PINs defined  */
   /* in the CFG file are ignored.                        */
   /*-----------------------------------------------------*/
   if(PinDefined)
   {
      for(Index = 1; Index < MAX_PAGES_PER_CALL; Index++)
         memset(&pInfo.pSubscriberInfo[Index].PinID, 0,
                sizeof(pInfo.pSubscriberInfo[Index].PinID));
   }

   printf("\n");

   ReportErrorMessage( ID_BEGIN_COMMAND );




         if( LogFileDefined || szLogFile )
         {
            sprintf(szMsg, "QPI150 Page In Progress");
            if(pInfo.SinglePage)
            {
               if(atoi(pInfo.pSubscriberInfo[0].PinID) != 0)
               {
                  strcat(szMsg, " To PIN ");
                  strcat(szMsg, pInfo.pSubscriberInfo[0].PinID);
               }
            }
            else
            {
               if(pInfo.GroupName[0] != 0)
               {
                  strcat(szMsg, " To ");
                  strcat(szMsg, pInfo.GroupName);
               }
            }

            if(pInfo.ServicePNum[0] != 0)
            {
               strcat(szMsg, ".  Dialing ");
               strcat(szMsg, pInfo.ServicePNum);
            }

            strcat(szMsg, "...\n");
            printf(szMsg);

            WriteMessageToLogFile( szLogFile, szMsg );
         }





   ulRC = SendAlphaMessage((ULONG)&pInfo);

   ReportErrorMessage( (int)ulRC );

   exit(ulRC);

}
Ejemplo n.º 4
0
void CParameterStringConfiguration::ProcessParameters(const CString& Parameters)
{
 CParameterString parameterString(Parameters);
 ProcessParameters(parameterString);
}