⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ictab4b8.c

📁 ICCP Toolkit 是在 Tru64下开发Tase.2通信协议的开发包
💻 C
📖 第 1 页 / 共 5 页
字号:
  status = icSendTypedMessage (linkId, msgType, NULL, (char) TAC_ALL,  			       message, msgSize);  if (status)    {    ICA_Log_Err2 ("ERROR:  icSendTypedMessage status = %d %s",                  status, icPerror(status));    printf ("\n\nSend Message Failed %d %s", status, icPerror (status));    }  else    {    ICA_Log_Flow0 ("icSendTypedMessage OK!");    printf ("icSendTypedMessage OK!");    }  }/************************************************************************//* sendDOCancel:  send Cancel Device Outage message			*//************************************************************************/static void sendDOCancel (int msgType, icLinkId linkId)  {icMsgTypeDOCancel	tkMsg;icTypeDOCancel		*doMsgPtr;icInt			msgSize, status, anInt;icUChar			*message;  /* determine message size 	*/  msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeDOCancel);  doMsgPtr = &tkMsg.MsgTypeHeader;  message = (icUChar *) &tkMsg;  /* fill up the message struct */  doMsgPtr->OutageRefId = msgType;  printf ("\nEnter OwningUtility ID (an integer): ");  intget ((ST_INT *)&doMsgPtr->OwningUtilityId);  doMsgPtr->TimeStamp = time (NULL);    printf ("\nEnter Station Name (a string):  ");  strget(doMsgPtr->StationName);  printf ("\nEnter Device Name (a string):  ");  strget (doMsgPtr->DeviceName);  printf ("\nEnter Device Type (0 thru 6):  ");  intget (&doMsgPtr->DeviceType);  printf ("\nEnter Device Number (an integer):  ");  intget (&anInt);  doMsgPtr->DeviceNumber = (icNumberType) anInt;  printf ("\nEnter Device Rating (a real):  ");  floatget (&doMsgPtr->DeviceRating);  doMsgPtr->ActivityDateAndTime = time (NULL) + 3600;  printf ("\nEnter Comments (a string):  ");  strget (doMsgPtr->Comments);		     printf ("\nEnter Outage Effect (a string):  ");  strget (doMsgPtr->OutageEffect);  /* send the message	*/  status = icSendTypedMessage (linkId, msgType, NULL, (char) TAC_ALL,  			       message, msgSize);  if (status)    {    ICA_Log_Err2 ("ERROR:  icSendTypedMessage status = %d %s",                  status, icPerror(status));    printf ("\n\nSend Message Failed %d %s", status, icPerror (status));    }  else    {    ICA_Log_Flow0 ("icSendTypedMessage OK!");    printf ("icSendTypedMessage OK!");    }  }/************************************************************************//* sendDOActual: send Actual Device Outage message			*//************************************************************************/static void sendDOActual (int msgType, icLinkId linkId)  {icMsgTypeDOActual	tkMsg;icTypeDOActual		*doMsgPtr;icInt			msgSize, status, anInt;icUChar			*message;  /* determine message size 	*/  msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeDOActual);  doMsgPtr = &tkMsg.MsgTypeHeader;  message = (icUChar *) &tkMsg;  /* fill up the message struct */  doMsgPtr->OutageRefId = msgType;  printf ("\nEnter OwningUtility ID (an integer): ");  intget ((ST_INT *)&doMsgPtr->OwningUtilityId);  doMsgPtr->TimeStamp = time (NULL);    printf ("\nEnter Station Name (a string):  ");  strget(doMsgPtr->StationName);  printf ("\nEnter Device Name (a string):  ");  strget (doMsgPtr->DeviceName);  printf ("\nEnter Device Type (0 thru 6):  ");  intget (&doMsgPtr->DeviceType);  printf ("\nEnter Device Number (an integer):  ");  intget (&anInt);  doMsgPtr->DeviceNumber = (icNumberType) anInt;  printf ("\nEnter Device Rating (a real):  ");  floatget (&doMsgPtr->DeviceRating);  doMsgPtr->ActivityDateAndTime = time (NULL) + 3600;  printf ("\nEnter Action (0 thru 4):  ");  intget (&doMsgPtr->Action);  printf ("\nEnter Affected Amount (a real):  ");  floatget (&doMsgPtr->AffectedAmount);  printf ("\nEnter Comments (a string):  ");  strget (doMsgPtr->Comments);		     printf ("\nEnter Outage Effect (a string):  ");  strget (doMsgPtr->OutageEffect);  /* send the message	*/  status = icSendTypedMessage (linkId, msgType, NULL, (char) TAC_ALL,  			       message, msgSize);  if (status)    {    ICA_Log_Err2 ("ERROR:  icSendTypedMessage status = %d %s",                  status, icPerror(status));    printf ("\n\nSend Message Failed %d %s", status, icPerror (status));    }  else    {    ICA_Log_Flow0 ("icSendTypedMessage OK!");    printf ("icSendTypedMessage OK!");    }  }/************************************************************************//* sendPlAvail: send  Power Plant Available Availability Report		*//************************************************************************/static void sendPlAvail (int msgType, icLinkId linkId)  {icMsgTypeAvailable	tkMsg;icTypeAvailable		*pstMsgPtr;icInt			msgSize, status, anInt;icUChar			*message;  /* determine message size 	*/  msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeAvailable);  pstMsgPtr = &tkMsg.MsgTypeHeader;  message = (icUChar *) &tkMsg;  /* fill up the message struct */  pstMsgPtr->AvailabilityRefId = msgType;  printf ("\nEnter Plant ID (an integer): ");  intget (&pstMsgPtr->PlantId);  printf ("\nEnter Unit ID (an integer):  ");  intget (&pstMsgPtr->UnitId);  pstMsgPtr->TimeStamp = time (NULL);  pstMsgPtr->StartDateTime = time (NULL) + 5000;  pstMsgPtr->EndDateTime = time (NULL) + 10000;  printf ("\nEnter Duration (an integer):  ");  intget (&anInt);  pstMsgPtr->Duration = (icTimeIntervalMType) anInt;  pstMsgPtr->ProvidingReserve = icTrue;  printf ("\nEnter Report Status (0 thru 2):  ");  intget (&pstMsgPtr->ReportStatus);  pstMsgPtr->Impact = icTrue;  printf ("\nEnter Price Impact (a real):  ");  floatget (&pstMsgPtr->PriceImpact);  printf ("\nEnter Max Ramp Rate Up (a real):  ");  floatget (&pstMsgPtr->RampStatus.MaxRampRateUp);  printf ("\nEnter Max Ramp Rate Down (a real):  ");  floatget (&pstMsgPtr->RampStatus.MaxRampRateDown);  pstMsgPtr->CapacityImpact.CapacityClass = 0x00;  if (ask ("\n Gross Capacity (N)? ",SD_FALSE))    pstMsgPtr->CapacityImpact.CapacityClass = 0x80;  if (ask ("\n Net Capacity (N)? ",SD_FALSE))    pstMsgPtr->CapacityImpact.CapacityClass |= 0x40;  printf ("\nEnter GrossMaxCapacity (a real):  ");  floatget (&pstMsgPtr->CapacityImpact.GrossMaxCapacity);  printf ("\nEnter GrossMinCapacity (a real):  ");  floatget (&pstMsgPtr->CapacityImpact.GrossMinCapacity);  printf ("\nEnter NetMaxCapacity (a real):  ");  floatget (&pstMsgPtr->CapacityImpact.NetMaxCapacity);  printf ("\nEnter NetMinCapacity (a real):  ");  floatget (&pstMsgPtr->CapacityImpact.NetMinCapacity);  pstMsgPtr->Availability.AvailFlags = 0xf0;  pstMsgPtr->Availability.TimeToOnline = time (NULL) + 15000;  pstMsgPtr->Availability.ReasonForNoLFC = 0;  printf ("\nEnter Comments (a string):  ");  strget (pstMsgPtr->Comment);		     /* send the message	*/  status = icSendTypedMessage (linkId, msgType, NULL, (char) TAC_ALL,  			       message, msgSize);  if (status)    {    ICA_Log_Err2 ("ERROR:  icSendTypedMessage status = %d %s",                  status, icPerror(status));    printf ("\n\nSend Message Failed %d %s", status, icPerror (status));    }  else    {    ICA_Log_Flow0 ("icSendTypedMessage OK!");    printf ("icSendTypedMessage OK!");    }  }/************************************************************************//* sendPlUnavail: send Power Plant UnAvailable Availability Report	*//************************************************************************/static void sendPlUnavail (int msgType, icLinkId linkId)  {icMsgTypeUnAvailable	tkMsg;icTypeUnAvailable	*pstMsgPtr;icInt			msgSize, status, anInt;icUChar			*message;  /* determine message size 	*/  msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeUnAvailable);  pstMsgPtr = &tkMsg.MsgTypeHeader;  message = (icUChar *) &tkMsg;  /* fill up the message struct */  pstMsgPtr->AvailabilityRefId = msgType;  printf ("\nEnter Plant ID (an integer): ");  intget (&pstMsgPtr->PlantId);  printf ("\nEnter Unit ID (an integer):  ");  intget (&pstMsgPtr->UnitId);  pstMsgPtr->TimeStamp = time (NULL);  pstMsgPtr->StartDateTime = time (NULL) + 5000;  pstMsgPtr->EndDateTime = time (NULL) + 10000;  printf ("\nEnter Duration (an integer):  ");  intget (&anInt);  pstMsgPtr->Duration = (icTimeIntervalMType) anInt;  pstMsgPtr->ProvidingReserve = icTrue;  printf ("\nEnter Report Status (0 thru 2):  ");  intget (&pstMsgPtr->ReportStatus);  printf ("\nEnter Reason For Unavailable (0 thru 2):  ");  intget (&pstMsgPtr->AvailReasonCode);  printf ("\nEnter Comments (a string):  ");  strget (pstMsgPtr->Comment);		     /* send the message	*/  status = icSendTypedMessage (linkId, msgType, NULL, (char) TAC_ALL,  			       message, msgSize);  if (status)    {    ICA_Log_Err2 ("ERROR:  icSendTypedMessage status = %d %s",                  status, icPerror(status));    printf ("\n\nSend Message Failed %d %s", status, icPerror (status));    }  else    {    ICA_Log_Flow0 ("icSendTypedMessage OK!");    printf ("icSendTypedMessage OK!");    }  }/************************************************************************//* sendPlStatusAvail: send Power Plant RealTime Status Avail msg	*//************************************************************************/static void sendPlStatusAvail (int msgType, icLinkId linkId)  {icMsgTypeStatusAvailable tkMsg;icTypeStatusAvailable	 *pstMsgPtr;icInt			 msgSize, status;icUChar			 *message;ST_UCHAR   		 hexBuf[10];ST_BOOLEAN 		 dataEntered;  /* determine message size 	*/  msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeStatusAvailable);  pstMsgPtr = &tkMsg.MsgTypeHeader;  message = (icUChar *) &tkMsg;  /* fill up the message struct */  pstMsgPtr->AvailabilityRefId = msgType;  printf ("\nEnter Plant ID (an integer): ");  intget (&pstMsgPtr->PlantId);  printf ("\nEnter Unit ID (an integer):  ");  intget (&pstMsgPtr->UnitId);  pstMsgPtr->TimeStamp = time (NULL);    printf ("\nEnter Max Ramp Rate Up (a real):  ");  floatget (&pstMsgPtr->RampStatus.MaxRampRateUp);  printf ("\nEnter Max Ramp Rate Down (a real):  ");  floatget (&pstMsgPtr->RampStatus.MaxRampRateDown);  pstMsgPtr->CapacityStatus.CapacityClass = 0x00;  if (ask ("\n Gross Capacity (N)? ",SD_FALSE))    pstMsgPtr->CapacityStatus.CapacityClass = 0x80;  if (ask ("\n Net Capacity (N)? ",SD_FALSE))    pstMsgPtr->CapacityStatus.CapacityClass |= 0x40;  printf ("\nEnter Gross Max Capacity (a real):  ");  floatget (&pstMsgPtr->CapacityStatus.GrossMaxCapacity);  printf ("\nEnter Gross Min Capacity (a real):  ");  floatget (&pstMsgPtr->CapacityStatus.GrossMinCapacity);  printf ("\nEnter Net Max Capacity (a real):  ");  floatget (&pstMsgPtr->CapacityStatus.NetMaxCapacity);  printf ("\nEnter Net Min Capacity (a real):  ");  floatget (&pstMsgPtr->CapacityStatus.NetMinCapacity);  printf("\nEnter Availability Flags in HEX:  ");  dataEntered = input_hex(hexBuf, 1);  if (dataEntered)    pstMsgPtr->AvailabilityStatus.AvailFlags = hexBuf[0];  else    pstMsgPtr->AvailabilityStatus.AvailFlags = 0;  pstMsgPtr->AvailabilityStatus.TimeToOnline = time (NULL) + 15000;  printf ("\nEnter Availability Reason For No LFC (an integer): ");  intget (&pstMsgPtr->AvailabilityStatus.ReasonForNoLFC);  pstMsgPtr->ProvidingReserve = icTrue;  /* send the message	*/  status = icSendTypedMessage (linkId, msgType, NULL, (char) TAC_ALL,  			       message, msgSize);  if (status)    {    ICA_Log_Err2 ("ERROR:  icSendTypedMessage status = %d %s",                  status, icPerror(status));    printf ("\n\nSend Message Failed %d %s", status, icPerror (status));    }  else    {    ICA_Log_Flow0 ("icSendTypedMessage OK!");    printf ("icSendTypedMessage OK!");    }  }/************************************************************************//* sendPlStatusUnavail: send Power Plant RealTime Status Unavail msg	*//************************************************************************/static void sendPlStatusUnavail (int msgType, icLinkId linkId)  {icMsgTypeStatusUnAvailable	tkMsg;icTypeStatusUnAvailable		*pstMsgPtr;icInt			msgSize, status;icUChar			*message;  /* determine message size 	*/  msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeStatusUnAvailable);  pstMsgPtr = &tkMsg.MsgTypeHeader;  message = (icUChar *) &tkMsg;  /* fill up the message struct */  pstMsgPtr->AvailabilityRefId = msgType;  printf ("\nEnter Plant ID (an integer): ");  intget (&pstMsgPtr->PlantId);  printf ("\nEnter Unit ID (an integer):  ");  intget (&pstMsgPtr->UnitId);  pstMsgPtr->TimeStamp = time (NULL);    printf ("\nEnter Reason Unavailable (0 thru 2):  ");  intget (&pstMsgPtr->ReasonUnavailable);  pstMsgPtr->ProvidingReserve = icTrue;  /* send the message	*/  status = icSendTypedMessage (linkId, msgType, NULL, (char) TAC_ALL,  			       message, msgSize);  if (status)    {    ICA_Log_Err2 ("ERROR:  icSendTypedMessage status = %d %s",                  status, icPerror(status));    printf ("\n\nSend Message Failed %d %s", status, icPerror (status));    }  else    {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -