📄 ictab8ts.c
字号:
icTypeDONewRevSched *doMsgPtr;icInt msgSize, status;icUChar *message; /* determine message size */ msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeDONewRevSched); doMsgPtr = &tkMsg.MsgTypeHeader; message = (icUChar *) &tkMsg; /* fill up the message struct */ doMsgPtr->OutageRefId = ++DORefId; doMsgPtr->OutageUtilityId = 5280; doMsgPtr->TimeStamp = time (NULL); strcpy (doMsgPtr->StationName, "StationName"); strcpy (doMsgPtr->DeviceName, "DeviceName"); doMsgPtr->DeviceType = 3; doMsgPtr->DeviceNumber = 0; doMsgPtr->DeviceRating = (icFloat) 123.456; doMsgPtr->ActivityDateAndTime = time (NULL) - 36000; doMsgPtr->PlanType = 1; doMsgPtr->PlanOpenOOSDateTime = time (NULL) + 36000; doMsgPtr->PlanCloseISDateTime = time (NULL) + 72000; doMsgPtr->OutagePeriod = 2; doMsgPtr->OutageType = 5; doMsgPtr->Amount = 0; doMsgPtr->UpperOperLimit = 56789; doMsgPtr->LowerOperLimit = 12345; doMsgPtr->Class = 1; strcpy (doMsgPtr->Comments, "DeviceOutageComments"); strcpy (doMsgPtr->OutageEffect, "DeviceOutageEffect"); /* send the message */ status = icSendTypedMessage (pRemote->linkList->linkId, IC_MSG_TYPE_DO_NEW, NULL, pRemote->taConditions, message, msgSize); if (status) { ICA_Log_Err2 ("ERROR: icSendTypedMessage status = %d %s", status, icPerror(status)); printf ("\n\nSend DeviceOutageNew Failed %d %s", status, icPerror (status)); } }/************************************************************************//* doDOCancel: send Cancel Device Outage message *//************************************************************************/static void doDOCancel (ICTA_REMOTE_INFO *pRemote) {icMsgTypeDOCancel tkMsg;icTypeDOCancel *doMsgPtr;icInt msgSize, status;icUChar *message; /* determine message size */ msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeDOCancel); doMsgPtr = &tkMsg.MsgTypeHeader; message = (icUChar *) &tkMsg; /* fill up the message struct */ doMsgPtr->OutageRefId = DORefId; doMsgPtr->OwningUtilityId = 6916; doMsgPtr->TimeStamp = time (NULL); strcpy (doMsgPtr->StationName, "DOCancelStationName"); strcpy (doMsgPtr->DeviceName, "DOCancelDeviceName"); doMsgPtr->DeviceType = 3; doMsgPtr->DeviceNumber = 0; doMsgPtr->DeviceRating = (icFloat) 123.456; doMsgPtr->ActivityDateAndTime = time (NULL) - 36000; strcpy (doMsgPtr->Comments, "DOCancelComments"); strcpy (doMsgPtr->OutageEffect, "DOCancelOutageEffect"); /* send the message */ status = icSendTypedMessage (pRemote->linkList->linkId, IC_MSG_TYPE_DO_CANCEL, NULL, pRemote->taConditions, message, msgSize); if (status) { ICA_Log_Err2 ("ERROR: icSendTypedMessage status = %d %s", status, icPerror(status)); printf ("\n\nSend DeviceOutageCancel Failed %d %s", status, icPerror (status)); } }/************************************************************************//* doDOActual: send Actual Device Outage message *//************************************************************************/static void doDOActual (ICTA_REMOTE_INFO *pRemote) {icMsgTypeDOActual tkMsg;icTypeDOActual *doMsgPtr;icInt msgSize, status;icUChar *message; /* determine message size */ msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeDOActual); doMsgPtr = &tkMsg.MsgTypeHeader; message = (icUChar *) &tkMsg; /* fill up the message struct */ doMsgPtr->OutageRefId = DORefId; doMsgPtr->OwningUtilityId = 4233; strcpy (doMsgPtr->StationName, "DOActualStationName"); strcpy (doMsgPtr->DeviceName, "DOAcutalDeviceName"); doMsgPtr->DeviceType = 3; doMsgPtr->DeviceNumber = 0; doMsgPtr->DeviceRating = (icFloat) 234.567; doMsgPtr->ActivityDateAndTime = time (NULL) - 36000; doMsgPtr->Action = 4; doMsgPtr->AffectedAmount = (icFloat) 345.678; strcpy (doMsgPtr->Comments, "DOActualComments"); strcpy (doMsgPtr->OutageEffect, "DOActualOutageEffect"); /* send the message */ status = icSendTypedMessage (pRemote->linkList->linkId, IC_MSG_TYPE_DO_ACTUAL, NULL, pRemote->taConditions, message, msgSize); if (status) { ICA_Log_Err2 ("ERROR: icSendTypedMessage status = %d %s", status, icPerror(status)); printf ("\n\nSend DeviceOutageActual Failed %d %s", status, icPerror (status)); } }/************************************************************************//* doPlAvail: send Power Plant Available Availability Report *//************************************************************************/static void doPlAvail (ICTA_REMOTE_INFO *pRemote) {icMsgTypeAvailable tkMsg;icTypeAvailable *pstMsgPtr;icInt msgSize, status;icUChar *message; /* determine message size */ msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeAvailable); pstMsgPtr = &tkMsg.MsgTypeHeader; message = (icUChar *) &tkMsg; /* fill up the message struct */ pstMsgPtr->AvailabilityRefId = 300; pstMsgPtr->PlantId = 635; pstMsgPtr->UnitId = 634; pstMsgPtr->TimeStamp = time (NULL); pstMsgPtr->StartDateTime = time (NULL) + 5000; pstMsgPtr->EndDateTime = time (NULL) + 10000; pstMsgPtr->Duration = 3643; pstMsgPtr->ProvidingReserve = icTrue; pstMsgPtr->ReportStatus = 1; pstMsgPtr->Impact = icTrue; pstMsgPtr->PriceImpact = (icFloat) 1.89; pstMsgPtr->RampStatus.MaxRampRateUp = (icFloat) 1.23; pstMsgPtr->RampStatus.MaxRampRateDown = (icFloat) 1.03; pstMsgPtr->CapacityImpact.CapacityClass = 0x80; pstMsgPtr->CapacityImpact.GrossMaxCapacity = 123456.0; pstMsgPtr->CapacityImpact.GrossMinCapacity = 49321.0; pstMsgPtr->CapacityImpact.NetMaxCapacity = 98543.0; pstMsgPtr->CapacityImpact.NetMinCapacity = 38456.0; pstMsgPtr->Availability.AvailFlags = 1; pstMsgPtr->Availability.TimeToOnline = time (NULL) + 15000; pstMsgPtr->Availability.ReasonForNoLFC = 0; strcpy (pstMsgPtr->Comment, "PowerPlantAvailComment"); /* send the message */ status = icSendTypedMessage (pRemote->linkList->linkId, IC_MSG_TYPE_PL_AVAILABLE, NULL, pRemote->taConditions, message, msgSize); if (status) { ICA_Log_Err2 ("ERROR: icSendTypedMessage status = %d %s", status, icPerror(status)); printf ("\n\nSend PowerPlantAvail Failed %d %s", status, icPerror (status)); } }/************************************************************************//* doPlUnavail: send Power Plant UnAvailable Availability Report *//************************************************************************/static void doPlUnavail (ICTA_REMOTE_INFO *pRemote) {icMsgTypeUnAvailable tkMsg;icTypeUnAvailable *pstMsgPtr;icInt msgSize, status;icUChar *message; /* determine message size */ msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeUnAvailable); pstMsgPtr = &tkMsg.MsgTypeHeader; message = (icUChar *) &tkMsg; /* fill up the message struct */ pstMsgPtr->AvailabilityRefId = 400; pstMsgPtr->PlantId = 5131; pstMsgPtr->UnitId = 870; pstMsgPtr->TimeStamp = time (NULL); pstMsgPtr->StartDateTime = time (NULL) + 5000; pstMsgPtr->EndDateTime = time (NULL) + 10000; pstMsgPtr->Duration = 6; pstMsgPtr->ProvidingReserve = icTrue; pstMsgPtr->ReportStatus = 0; pstMsgPtr->AvailReasonCode = 1; strcpy (pstMsgPtr->Comment, "PowerPlantUnavail"); /* send the message */ status = icSendTypedMessage (pRemote->linkList->linkId, IC_MSG_TYPE_PL_UNAVAILABLE, NULL, pRemote->taConditions, message, msgSize); if (status) { ICA_Log_Err2 ("ERROR: icSendTypedMessage status = %d %s", status, icPerror(status)); printf ("\n\nSend PowerPlantUnavail Failed %d %s", status, icPerror (status)); } }/************************************************************************//* doPlStatusAvail: send Power Plant RealTime Status Avail msg *//************************************************************************/static void doPlStatusAvail (ICTA_REMOTE_INFO *pRemote) {icMsgTypeStatusAvailable tkMsg;icTypeStatusAvailable *pstMsgPtr;icInt msgSize, status;icUChar *message; /* determine message size */ msgSize = sizeof (icTypeIccpHeader) + sizeof (icTypeStatusAvailable); pstMsgPtr = &tkMsg.MsgTypeHeader; message = (icUChar *) &tkMsg; /* fill up the message struct */ pstMsgPtr->AvailabilityRefId = 500; pstMsgPtr->PlantId = 11; pstMsgPtr->UnitId = 52; pstMsgPtr->TimeStamp = time (NULL); pstMsgPtr->RampStatus.MaxRampRateUp = (icFloat) 989.432; pstMsgPtr->RampStatus.MaxRampRateDown = (icFloat) -12.345; pstMsgPtr->CapacityStatus.CapacityClass |= 0x40; pstMsgPtr->CapacityStatus.GrossMaxCapacity = 89763.0; pstMsgPtr->CapacityStatus.GrossMinCapacity = 32985.0; pstMsgPtr->CapacityStatus.NetMaxCapacity = (icFloat) 65432.1; pstMsgPtr->CapacityStatus.NetMinCapacity = 18653.0; pstMsgPtr->AvailabilityStatus.AvailFlags = 1; pstMsgPtr->AvailabilityStatus.TimeToOnline = time (NULL) + 15000; pstMsgPtr->AvailabilityStatus.ReasonForNoLFC = 2; pstMsgPtr->ProvidingReserve = icTrue; /* send the message */ status = icSendTypedMessage (pRemote->linkList->linkId, IC_MSG_TYPE_PL_RT_STATUS_AVAIL, NULL, pRemote->taConditions, message, msgSize); if (status) { ICA_Log_Err2 ("ERROR: icSendTypedMessage status = %d %s", status, icPerror(status)); printf ("\n\nSend PowerPlantStatusAvail Failed %d %s", status, icPerror (status)); } }/************************************************************************//* doPlStatusUnavail: send Power Plant RealTime Status Unavail msg *//************************************************************************/static void doPlStatusUnavail (ICTA_REMOTE_INFO *pRemote) {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 = 600; pstMsgPtr->PlantId = 53238; pstMsgPtr->UnitId = 657; pstMsgPtr->TimeStamp = time (NULL); pstMsgPtr->ReasonUnavailable = 1; pstMsgPtr->ProvidingReserve = icTrue; /* send the message */ status = icSendTypedMessage (pRemote->linkList->linkId, IC_MSG_TYPE_PL_RT_STATUS_UNAVAIL, NULL, pRemote->taConditions, message, msgSize); if (status) { ICA_Log_Err2 ("ERROR: icSendTypedMessage status = %d %s", status, icPerror(status)); printf ("\n\nSend PowerPlantStatusUnavail Failed %d %s", status, icPerror (status)); } }/************************************************************************//* doPlForecast: send Power Plant Forecase message *//************************************************************************/static void doPlForecast (ICTA_REMOTE_INFO *pRemote) {icMsgTypeForecast *ptkMsg;icTypeIccpHeader *pstIccpHdr;icTypeForecast *pstMsgPtr;icInt msgSize, status, anInt;icUChar *message, *tmpMsg;int numPeriods = 3, i;icInt *pMatrix, *pInt;icFloat *pFloat, aFloat; /* figure out message size */ msgSize = sizeof (icMsgTypeForecast) + 2 * sizeof (icInt) + numPeriods * sizeof (icFloat) + numPeriods * sizeof (icInt); /* allocate memory and fill it up */ message = chk_malloc (msgSize); ptkMsg = (icMsgTypeForecast *) message; pstMsgPtr = &ptkMsg->MsgTypeHeader; pstIccpHdr = &ptkMsg->MsgHeader; /* fill up the message struct */ pstMsgPtr->ForecastRefId = 700; pstMsgPtr->PlantId = 4309; pstMsgPtr->UnitId = 983; pstMsgPtr->StartTime = time (NULL) + 52800; pstMsgPtr->PeriodResolution = 6; pstMsgPtr->NumberOfPeriods = numPeriods; pstMsgPtr->ForecastType = 0x80; /* take care of the iccp header *//* pstIccpHdr->RemoteId = _hdrRemoteId; *//* pstIccpHdr->RequestId = _hdrRequestId; *//* pstIccpHdr->DestinationId = _hdrDestId; *//* pstIccpHdr->ReferenceNumber = _hdrRefNum; *//* pstIccpHdr->MessageType = msgType; *//* pstIccpHdr->Conditions = _hdrConditions; */ tmpMsg = message + sizeof (icMsgTypeForecast); pMatrix = (icInt *) tmpMsg; anInt = 1; *pMatrix++ = anInt; anInt = 2; *pMatrix++ = anInt; aFloat = (icFloat) 1.234; tmpMsg += (2 * sizeof (icInt)); for (i=0; i < numPeriods; i++) { pFloat = (icFloat *) tmpMsg; *pFloat = aFloat * i; /* put MwValues here */ tmpMsg += sizeof (icFloat); pInt = (icInt *) tmpMsg; *pInt = i; /* put LFC_Code values here */ tmpMsg += sizeof (icInt); } /* send the message */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -