Welcome, Guest
Username: Password: Remember me

TOPIC: Add Date and Time to ASUP->DetectText attribute

Add Date and Time to ASUP->DetectText attribute 5 years 5 months ago #9893

  • barnes
  • barnes's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 92
  • Karma: 0
looks like this is working now.
Thanks, for the help


File Attachment:

File Name: xtt_evlist.cpp
File Size: 98 KB


although now the date and time show up twice in the event list
Last Edit: 5 years 5 months ago by barnes.
The administrator has disabled public write access.

Add Date and Time to ASUP->DetectText attribute 5 years 5 months ago #9895

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3178
  • Thank you received: 502
  • Karma: 133
I think you should use item_time instead of the current time. Current time can be when the event list is loaded, that is rt_xtt is started. item_time though is the detect time.

/Claes
The administrator has disabled public write access.

Add Date and Time to ASUP->DetectText attribute 5 years 5 months ago #9898

  • barnes
  • barnes's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 92
  • Karma: 0
Yes, I noticed a difference in the time when the event happened and the current time. Typically 1 to 6 seconds. I agree, item_time is the correct time to use, thank you.


Also, now that the time is being concatenated with the DetectText it shows up twice in the event list. Once in the normal spot, and then again in the DetectText location. This is not really a huge deal but is just a little annoying.



So my thinking is that a new operator displayed concatenated string should be created from the item_time and the DetectText so that the original strings stay unchanged in the database. That way the event list is display is unchanged.

Where does the EventText get stored into the database? It's obviously after it gets displayed in the Operator place.

I can strip the time back out of the EventText before it gets stored into the database for use in the Event List.

BTW, notice the first Alarm, System status error, I am getting this error when the time changes on the computer.
Last Edit: 5 years 5 months ago by barnes.
The administrator has disabled public write access.

Add Date and Time to ASUP->DetectText attribute 5 years 5 months ago #9901

  • barnes
  • barnes's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 92
  • Karma: 0
I have the date and time printing just fine.
I have moved on to trying to print the value.
I found this function formatSupEvent in pwrsrc_5.5.0-1/src/exe/rt_emon/src/rt_emon.c
static void formatSupEvent (mh_eEvent event, char *text, sSupActive *sp, uEvent *up,pwr_tUInt32 *size)

I type casted this as show above in other functions.
pwr_sClass_ASup *o = (pwr_sClass_ASup *) sp->op;


if(sp->supType==mh_eSupType_Digital) {
snprintf(catstr001, sizeof(catstr001), "%s %d", sup->DetectText, (int)o->In);
} else {
snprintf(catstr001, sizeof(catstr001), "%s %.3f", sup->DetectText, o->In);
}

strncpy(mp->EventText, catstr001, sizeof(mp->EventText));


Im trying to get the ".In" value of the Asup object with no luck. It just prints 0.0000.


It looks like I am in the correct file, but the data does not seen to be present.

Any help getting to the ".In" value of the Asup object would be greatly appreciated.
The administrator has disabled public write access.

Add Date and Time to ASUP->DetectText attribute 5 years 5 months ago #9903

  • barnes
  • barnes's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 92
  • Karma: 0
I have it working now.

When I put the ASup in the plant hierarchy instead of in the graphical PLC code the code inside pwrsrc_5.5.0-1/src/exe/rt_emon/src/rt_emon.c is being executed. It looks like the PLC has macros in *.h files. It does not appear the *.h files are being compiled with make after I change them.

I put printf's everywhere in the *.h files with no luck.

There are many different macros and codes all over the place for the ASup and Dsup.

I will test it for awhile then post if anyone is interested. Seems the site is a tad bit slow.

Claes, Are you the only one working on Proview or do you have many programmers?
The administrator has disabled public write access.

Add Date and Time to ASUP->DetectText attribute 5 years 5 months ago #9904

  • barnes
  • barnes's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 92
  • Karma: 0
Here is the function where I did the strcat, notice the hint of the rt_plc_macro_sup.h file.

/* Detect an ASup object.

!!! NOTE: This should be the same as the macro used by PLC,
in rt_plc_macro_sup.h */

static void
aSup_exec (
sSupActive *sp
)
{
pwr_sClass_ASup *o = (pwr_sClass_ASup *) sp->op;
pwr_tFloat32 In = *(pwr_tFloat32 *) sp->actualValue;
//char catstr001[160]="";

//printf("pwr_sClass_ASup In = %.3f\n", In);



if ((o->High && In <= o->CtrlLimit - o->Hysteres)
|| (!o->High && In >= o->CtrlLimit + o->Hysteres)
) {
if (o->Action) o->Action = FALSE;
if (o->ReturnCheck) {
time_GetTime(&o->ReturnTime);
o->ReturnCheck = FALSE;
o->ReturnSend = TRUE;
}
if (o->AlarmCheck && !o->DetectCheck) {
o->TimerFlag = FALSE;
o->DetectCheck = TRUE;
}
} else if ((o->High && In > o->CtrlLimit) || (!o->High && In < o->CtrlLimit)) {
if (!o->Action) {
o->Action = TRUE;

}
if (o->Suppressed) {
if (o->ReturnCheck) {
time_GetTime( &o->ReturnTime);
o->ReturnCheck = FALSE;
o->ReturnSend = TRUE;
}
else if (o->DetectSend)
o->DetectSend = FALSE;
}
if (o->AlarmCheck && o->DetectOn && !o->Blocked && !o->Suppressed) {
if (o->DetectCheck) {
o->ActualValue = In;
timerIn(sp, (sTimer *)&o->TimerFlag);
time_GetTime(&o->DetectTime);
o->DetectCheck = FALSE;
}
if (!o->TimerFlag) {
o->DetectSend = TRUE;
o->ReturnCheck = TRUE;
o->Acked = FALSE;
o->AlarmCheck = FALSE;

}
}
}

//*******************************************
// cat here
if(o->Action && !o->Acked) {
char catstr[80];

strcpy(catstr,"");
sprintf(catstr, " %.1f", In);
strcat(o->DetectText, catstr);
}
//*********************************************
}
Last Edit: 5 years 5 months ago by barnes.
The administrator has disabled public write access.
Time to create page: 7.874 seconds