Commit 69394212 authored by claes's avatar claes

*** empty log message ***

parent 863c699d
...@@ -37,8 +37,7 @@ JNIEXPORT void JNICALL Java_jpwr_rt_Mh_initIDs ...@@ -37,8 +37,7 @@ JNIEXPORT void JNICALL Java_jpwr_rt_Mh_initIDs
} }
//hmta pekare till staticmetoden messReceived //hmta pekare till staticmetoden messReceived
Mh_messReceived_id = (*env)->GetStaticMethodID( env, Mh_id, "messReceived", Mh_messReceived_id = (*env)->GetStaticMethodID( env, Mh_id, "messReceived",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIIILjava/lang/String;IILjpwr/rt/PwrtObjid;)V"); "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIIILjava/lang/String;IILjava/lang/String;IILjpwr/rt/PwrtObjid;)V");
sts = (*env)->GetJavaVM(env, &jvm); sts = (*env)->GetJavaVM(env, &jvm);
if(sts) if(sts)
{ {
...@@ -285,11 +284,19 @@ pwr_tStatus ev_mh_ack_bc( mh_sAck *MsgP) ...@@ -285,11 +284,19 @@ pwr_tStatus ev_mh_ack_bc( mh_sAck *MsgP)
jstring jevName; jstring jevName;
jstring jevTime; jstring jevTime;
jstring jevBirthTime; jstring jevBirthTime;
jint jevFlags; jint jevFlags;
jint jevPrio; jint jevPrio;
jint jevStatus; jint jevStatus;
jint jevNix; jint jevNix;
jint jevIdx; jint jevIdx;
jstring jevTargetBirthTime;
jint jevTargetNix;
jint jevTargetIdx;
char targetBirthTime_str[40];
jint jevType; jint jevType;
jint oix, vid; jint oix, vid;
char time_str[40]; char time_str[40];
...@@ -298,6 +305,7 @@ pwr_tStatus ev_mh_ack_bc( mh_sAck *MsgP) ...@@ -298,6 +305,7 @@ pwr_tStatus ev_mh_ack_bc( mh_sAck *MsgP)
pwr_tTime time = MsgP->Info.EventTime; pwr_tTime time = MsgP->Info.EventTime;
pwr_tTime birthTime = MsgP->Info.Id.BirthTime; pwr_tTime birthTime = MsgP->Info.Id.BirthTime;
pwr_tTime targetBirthTime = MsgP->TargetId.BirthTime;
//hmta enviormentpekaren //hmta enviormentpekaren
(*jvm)->AttachCurrentThread(jvm,(void **)&env,NULL); (*jvm)->AttachCurrentThread(jvm,(void **)&env,NULL);
...@@ -318,23 +326,31 @@ pwr_tStatus ev_mh_ack_bc( mh_sAck *MsgP) ...@@ -318,23 +326,31 @@ pwr_tStatus ev_mh_ack_bc( mh_sAck *MsgP)
time_AtoAscii( &time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str)); time_AtoAscii( &time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str));
time_AtoAscii( &birthTime, time_eFormat_ComprDateAndTime, birthTime_str, sizeof(birthTime_str)); time_AtoAscii( &birthTime, time_eFormat_ComprDateAndTime, birthTime_str, sizeof(birthTime_str));
time_AtoAscii( &targetBirthTime, time_eFormat_ComprDateAndTime, targetBirthTime_str, sizeof(targetBirthTime_str));
//gr om till Java-strngar //gr om till Java-strngar
jevText = (*env)->NewStringUTF( env, " "); //eventText anvnds inte vid ack jevText = (*env)->NewStringUTF( env, " "); //eventText anvnds inte vid ack
jevName = (*env)->NewStringUTF( env, MsgP->Info.EventName); jevName = (*env)->NewStringUTF( env, MsgP->Info.EventName);
jevTime = (*env)->NewStringUTF( env, time_str); jevTime = (*env)->NewStringUTF( env, time_str);
jevBirthTime = (*env)->NewStringUTF( env, birthTime_str); jevBirthTime = (*env)->NewStringUTF( env, birthTime_str);
jevTargetBirthTime = (*env)->NewStringUTF( env, targetBirthTime_str);
//gr om till Java-int //gr om till Java-int
jevFlags = (jint)MsgP->Info.EventFlags; jevFlags = (jint)MsgP->Info.EventFlags;
jevPrio = (jint)MsgP->Info.EventPrio; jevPrio = (jint)MsgP->Info.EventPrio;
jevStatus = (jint)1; //finns ej i mh_sAck och anvnds ej heller jevStatus = (jint)1; //finns ej i mh_sAck och anvnds ej heller
jevNix = (jint)MsgP->Info.Id.Nix; jevNix = (jint)MsgP->Info.Id.Nix;
jevIdx = (jint)MsgP->Info.Id.Idx; jevIdx = (jint)MsgP->Info.Id.Idx;
jevTargetNix = (jint)MsgP->TargetId.Nix;
jevTargetIdx = (jint)MsgP->TargetId.Idx;
jevType = (jint)MsgP->Info.EventType; jevType = (jint)MsgP->Info.EventType;
//anropa callback metoden i Mh-klassen //anropa callback metoden i Mh-klassen
(*env)->CallStaticVoidMethod( env, Mh_id, Mh_messReceived_id, jevText, jevName, (*env)->CallStaticVoidMethod( env, Mh_id, Mh_messReceived_id, jevText, jevName,
jevTime, jevFlags, jevPrio, jevStatus, jevNix, jevBirthTime, jevIdx, jevType, objid_obj); jevTime, jevFlags, jevPrio, jevStatus, jevNix, jevBirthTime, jevIdx,
jevTargetNix, jevTargetBirthTime, jevTargetIdx,
jevType, objid_obj);
//important:check if an exception was raised //important:check if an exception was raised
if ((*env)->ExceptionCheck(env)) if ((*env)->ExceptionCheck(env))
{ {
...@@ -362,6 +378,13 @@ pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP) ...@@ -362,6 +378,13 @@ pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP)
jint jevIdx; jint jevIdx;
jint jevType; jint jevType;
jint oix, vid; jint oix, vid;
jstring jevTargetBirthTime;
jint jevTargetNix;
jint jevTargetIdx;
char targetBirthTime_str[40];
char time_str[40]; char time_str[40];
char birthTime_str[40]; char birthTime_str[40];
...@@ -369,6 +392,7 @@ pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP) ...@@ -369,6 +392,7 @@ pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP)
pwr_tObjid objid = MsgP->Info.Object; pwr_tObjid objid = MsgP->Info.Object;
pwr_tTime time = MsgP->Info.EventTime; pwr_tTime time = MsgP->Info.EventTime;
pwr_tTime birthTime = MsgP->Info.Id.BirthTime; pwr_tTime birthTime = MsgP->Info.Id.BirthTime;
pwr_tTime targetBirthTime = MsgP->TargetId.BirthTime;
//hmta enviormentpekaren //hmta enviormentpekaren
(*jvm)->AttachCurrentThread(jvm,(void **)&env,NULL); (*jvm)->AttachCurrentThread(jvm,(void **)&env,NULL);
...@@ -386,12 +410,15 @@ pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP) ...@@ -386,12 +410,15 @@ pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP)
time_AtoAscii( &time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str)); time_AtoAscii( &time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str));
time_AtoAscii( &birthTime, time_eFormat_ComprDateAndTime, birthTime_str, sizeof(birthTime_str)); time_AtoAscii( &birthTime, time_eFormat_ComprDateAndTime, birthTime_str, sizeof(birthTime_str));
time_AtoAscii( &targetBirthTime, time_eFormat_ComprDateAndTime, targetBirthTime_str, sizeof(targetBirthTime_str));
//gr om till Java-strngar //gr om till Java-strngar
jevText = (*env)->NewStringUTF( env, MsgP->EventText); jevText = (*env)->NewStringUTF( env, MsgP->EventText);
jevName = (*env)->NewStringUTF( env, MsgP->Info.EventName); jevName = (*env)->NewStringUTF( env, MsgP->Info.EventName);
jevTime = (*env)->NewStringUTF( env, time_str); jevTime = (*env)->NewStringUTF( env, time_str);
jevBirthTime = (*env)->NewStringUTF( env, birthTime_str); jevBirthTime = (*env)->NewStringUTF( env, birthTime_str);
jevTargetBirthTime = (*env)->NewStringUTF( env, targetBirthTime_str);
//gr om till Java-int //gr om till Java-int
jevFlags = (jint)MsgP->Info.EventFlags; jevFlags = (jint)MsgP->Info.EventFlags;
...@@ -399,10 +426,17 @@ pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP) ...@@ -399,10 +426,17 @@ pwr_tStatus ev_mh_return_bc( mh_sReturn *MsgP)
jevStatus = (jint)1;//mh_sReturn har ingen status jevStatus = (jint)1;//mh_sReturn har ingen status
jevNix = (jint)MsgP->Info.Id.Nix; jevNix = (jint)MsgP->Info.Id.Nix;
jevIdx = (jint)MsgP->Info.Id.Idx; jevIdx = (jint)MsgP->Info.Id.Idx;
jevTargetNix = (jint)MsgP->TargetId.Nix;
jevTargetIdx = (jint)MsgP->TargetId.Idx;
jevType = (jint)MsgP->Info.EventType; jevType = (jint)MsgP->Info.EventType;
//anropa callback metoden i Mh-klassen //anropa callback metoden i Mh-klassen
(*env)->CallStaticVoidMethod( env, Mh_id, Mh_messReceived_id, jevText, jevName, (*env)->CallStaticVoidMethod( env, Mh_id, Mh_messReceived_id, jevText, jevName,
jevTime, jevFlags, jevPrio, jevStatus, jevNix, jevBirthTime, jevIdx, jevType, objid_obj); jevTime, jevFlags, jevPrio, jevStatus, jevNix, jevBirthTime, jevIdx,
jevTargetNix, jevTargetBirthTime, jevTargetIdx,
jevType, objid_obj);
//important:check if an exception was raised //important:check if an exception was raised
if ((*env)->ExceptionCheck(env)) if ((*env)->ExceptionCheck(env))
{ {
...@@ -430,6 +464,12 @@ pwr_tStatus ev_mh_alarm_bc( mh_sMessage *MsgP) ...@@ -430,6 +464,12 @@ pwr_tStatus ev_mh_alarm_bc( mh_sMessage *MsgP)
jint jevIdx; jint jevIdx;
jint jevType; jint jevType;
jint oix, vid; jint oix, vid;
jstring jevTargetBirthTime;
jint jevTargetNix = (jint) 0;
jint jevTargetIdx = (jint) 0;
char time_str[40]; char time_str[40];
char birthTime_str[40]; char birthTime_str[40];
...@@ -460,6 +500,9 @@ pwr_tStatus ev_mh_alarm_bc( mh_sMessage *MsgP) ...@@ -460,6 +500,9 @@ pwr_tStatus ev_mh_alarm_bc( mh_sMessage *MsgP)
jevName = (*env)->NewStringUTF( env, MsgP->Info.EventName); jevName = (*env)->NewStringUTF( env, MsgP->Info.EventName);
jevTime = (*env)->NewStringUTF( env, time_str); jevTime = (*env)->NewStringUTF( env, time_str);
jevBirthTime = (*env)->NewStringUTF( env, birthTime_str); jevBirthTime = (*env)->NewStringUTF( env, birthTime_str);
jevTargetBirthTime = (*env)->NewStringUTF( env, " ");
//gr om till Java-int //gr om till Java-int
jevFlags = (jint)MsgP->Info.EventFlags; jevFlags = (jint)MsgP->Info.EventFlags;
...@@ -470,7 +513,9 @@ pwr_tStatus ev_mh_alarm_bc( mh_sMessage *MsgP) ...@@ -470,7 +513,9 @@ pwr_tStatus ev_mh_alarm_bc( mh_sMessage *MsgP)
jevType = (jint)MsgP->Info.EventType; jevType = (jint)MsgP->Info.EventType;
//anropa callback metoden i Mh-klassen //anropa callback metoden i Mh-klassen
(*env)->CallStaticVoidMethod( env, Mh_id, Mh_messReceived_id, jevText, jevName, (*env)->CallStaticVoidMethod( env, Mh_id, Mh_messReceived_id, jevText, jevName,
jevTime, jevFlags, jevPrio, jevStatus, jevNix, jevBirthTime, jevIdx, jevType, objid_obj); jevTime, jevFlags, jevPrio, jevStatus, jevNix, jevBirthTime, jevIdx,
jevTargetNix, jevTargetBirthTime, jevTargetIdx,
jevType, objid_obj);
//important:check if an exception was raised //important:check if an exception was raised
if ((*env)->ExceptionCheck(env)) if ((*env)->ExceptionCheck(env))
{ {
...@@ -498,6 +543,11 @@ pwr_tStatus ev_mh_info_bc( mh_sMessage *MsgP) ...@@ -498,6 +543,11 @@ pwr_tStatus ev_mh_info_bc( mh_sMessage *MsgP)
jint jevIdx; jint jevIdx;
jint jevType; jint jevType;
jint oix, vid; jint oix, vid;
jstring jevTargetBirthTime;
jint jevTargetNix = (jint) 0;
jint jevTargetIdx = (jint) 0;
char time_str[40]; char time_str[40];
char birthTime_str[40]; char birthTime_str[40];
...@@ -528,6 +578,8 @@ pwr_tStatus ev_mh_info_bc( mh_sMessage *MsgP) ...@@ -528,6 +578,8 @@ pwr_tStatus ev_mh_info_bc( mh_sMessage *MsgP)
jevName = (*env)->NewStringUTF( env, MsgP->Info.EventName); jevName = (*env)->NewStringUTF( env, MsgP->Info.EventName);
jevTime = (*env)->NewStringUTF( env, time_str); jevTime = (*env)->NewStringUTF( env, time_str);
jevBirthTime = (*env)->NewStringUTF( env, birthTime_str); jevBirthTime = (*env)->NewStringUTF( env, birthTime_str);
jevTargetBirthTime = (*env)->NewStringUTF( env, " ");
//gr om till Java-int //gr om till Java-int
jevFlags = (jint)MsgP->Info.EventFlags; jevFlags = (jint)MsgP->Info.EventFlags;
...@@ -538,7 +590,9 @@ pwr_tStatus ev_mh_info_bc( mh_sMessage *MsgP) ...@@ -538,7 +590,9 @@ pwr_tStatus ev_mh_info_bc( mh_sMessage *MsgP)
jevType = (jint)MsgP->Info.EventType; jevType = (jint)MsgP->Info.EventType;
//anropa callback metoden i Mh-klassen //anropa callback metoden i Mh-klassen
(*env)->CallStaticVoidMethod( env, Mh_id, Mh_messReceived_id, jevText, jevName, (*env)->CallStaticVoidMethod( env, Mh_id, Mh_messReceived_id, jevText, jevName,
jevTime, jevFlags, jevPrio, jevStatus, jevNix, jevBirthTime, jevIdx, jevType, objid_obj); jevTime, jevFlags, jevPrio, jevStatus, jevNix, jevBirthTime, jevIdx,
jevTargetNix, jevTargetBirthTime, jevTargetIdx,
jevType, objid_obj);
//important:check if an exception was raised //important:check if an exception was raised
if ((*env)->ExceptionCheck(env)) if ((*env)->ExceptionCheck(env))
{ {
...@@ -564,7 +618,8 @@ pwr_tStatus ev_mh_clear_alarmlist_bc( pwr_tNodeIndex nix) ...@@ -564,7 +618,8 @@ pwr_tStatus ev_mh_clear_alarmlist_bc( pwr_tNodeIndex nix)
jevType = (jint)66; jevType = (jint)66;
//anropa callback metoden i Mh-klassen //anropa callback metoden i Mh-klassen
(*env)->CallStaticVoidMethod( env, Mh_id, Mh_messReceived_id, NULL, NULL, (*env)->CallStaticVoidMethod( env, Mh_id, Mh_messReceived_id, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, jevType, NULL); NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, jevType, NULL);
//printf("C-kod: efter callback\n"); //printf("C-kod: efter callback\n");
//important:check if an exception was raised //important:check if an exception was raised
if ((*env)->ExceptionCheck(env)) if ((*env)->ExceptionCheck(env))
......
...@@ -133,7 +133,7 @@ Init () ...@@ -133,7 +133,7 @@ Init ()
exit(1); exit(1);
} }
/*open the database*/ /*open the database*/
if((ret = dataBaseP->open(dataBaseP, fname, NULL, DATABASETYPE, DB_CREATE, 0664)) != 0) if((ret = dataBaseP->open(dataBaseP, 0, fname, NULL, DATABASETYPE, DB_CREATE, 0664)) != 0)
{ {
/*error opening/creating db send the mess to errh, then exit*/ /*error opening/creating db send the mess to errh, then exit*/
sprintf(msg, "db_open: %s, no eventlogger will run", db_strerror(ret)); sprintf(msg, "db_open: %s, no eventlogger will run", db_strerror(ret));
......
...@@ -710,14 +710,18 @@ void ccm_float_to_string( char *string, float f) ...@@ -710,14 +710,18 @@ void ccm_float_to_string( char *string, float f)
int i; int i;
/* If value is close to integer, round it */ /* If value is close to integer, round it */
if ( fabs( f - floor( f)) <= FLT_EPSILON) if ( fabs( f - floor( f)) <= FLT_EPSILON) {
{ if ( f >= 0)
i = f + FLT_EPSILON; i = f + FLT_EPSILON;
else
i = f - FLT_EPSILON;
sprintf( string, "%d", i); sprintf( string, "%d", i);
} }
else if ( fabs( f - floor( f) + 1) <= FLT_EPSILON) else if ( fabs( f - floor( f) + 1) <= FLT_EPSILON) {
{ if ( f >= 0)
i = f + FLT_EPSILON; i = f + FLT_EPSILON;
else
i = f - FLT_EPSILON;
sprintf( string, "%d", i); sprintf( string, "%d", i);
} }
else else
......
#ifndef co_dcli_h #ifndef co_dcli_h
#define co_dcli_h #define co_dcli_h
#include <stdio.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
......
...@@ -42,10 +42,11 @@ int GeUser::load( char *filename) ...@@ -42,10 +42,11 @@ int GeUser::load( char *filename)
int end_found = 0; int end_found = 0;
char dummy[40]; char dummy[40];
strcpy( fname, filename);
if ( !check_file( filename)) if ( !check_file( filename))
return USER__FILEOPEN; return USER__FILEOPEN;
strcpy( fname, filename);
fp.open( filename); fp.open( filename);
#ifndef OS_VMS #ifndef OS_VMS
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#ifndef OS_LINUX #ifndef OS_LINUX
# error This file is only for Linux # error This file is only for Linux
#endif #endif
#include <unistd.h>
#include <sys/times.h> #include <sys/times.h>
#include <string.h> #include <string.h>
#include "pwr.h" #include "pwr.h"
...@@ -30,22 +31,48 @@ time_Uptime ( ...@@ -30,22 +31,48 @@ time_Uptime (
pwr_tDeltaTime time; pwr_tDeltaTime time;
long tics; long tics;
struct tms buff; struct tms buff;
static int tics_per_sec = 0;
static pwr_tTime boot_time = {0,0};
static pwr_tDeltaTime max_diff = {0,20000000};
pwr_tDeltaTime uptime_tics;
pwr_tTime current_time;
pwr_tDeltaTime diff;
pwr_dStatus(sts, status, TIME__SUCCESS); pwr_dStatus(sts, status, TIME__SUCCESS);
if ( !tics_per_sec)
tics_per_sec = sysconf(_SC_CLK_TCK);
if (tp == NULL) if (tp == NULL)
tp = &time; tp = &time;
tics = times(&buff); tics = times(&buff);
tp->tv_sec = tics / CLK_TCK; uptime_tics.tv_sec = tics / tics_per_sec;
tp->tv_nsec = (tics % CLK_TCK) * (1000000000 / CLK_TCK); uptime_tics.tv_nsec = (tics % tics_per_sec) * (1000000000 / tics_per_sec);
pwr_Assert(tp->tv_sec >= 0 && tp->tv_nsec >= 0); // pwr_Assert(tp->tv_sec >= 0 && tp->tv_nsec >= 0);
clock_gettime( CLOCK_REALTIME, &current_time);
if ( !boot_time.tv_sec) {
time_Asub( &boot_time, &current_time, &uptime_tics);
*tp = uptime_tics;
}
else {
time_Adiff( tp, &current_time, &boot_time);
time_Dsub( &diff, tp, &uptime_tics);
time_Dabs(NULL, &diff);
if ( time_Dcomp(&diff, &max_diff) > 0) {
time_Asub( &boot_time, &current_time, &uptime_tics);
*tp = uptime_tics;
*status = TIME__CLKCHANGE;
}
}
if (ap != NULL) if (ap != NULL)
return time_Dadd(tp, tp, ap); return time_Dadd(tp, tp, ap);
else else
return tp; return tp;
} }
/* Return number of clock ticks since system start. /* Return number of clock ticks since system start.
Add number of tics corresponding to delta time 'add'. */ Add number of tics corresponding to delta time 'add'. */
......
...@@ -252,9 +252,9 @@ static pwr_tStatus IoCardRead ( ...@@ -252,9 +252,9 @@ static pwr_tStatus IoCardRead (
} }
/* Check max/min */ /* Check max/min */
if (actvalue > cop->ActValRangeHigh) if (actvalue > cop->ActValRangeHigh && cop->ActValRangeHigh > cop->ActValRangeLow)
actvalue = cop->ActValRangeHigh; actvalue = cop->ActValRangeHigh;
if (actvalue < cop->ActValRangeLow) if (actvalue < cop->ActValRangeLow && cop->ActValRangeHigh > cop->ActValRangeLow)
actvalue = cop->ActValRangeLow; actvalue = cop->ActValRangeLow;
/* Filter */ /* Filter */
......
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
#define cNanoSec 1.0e-9 #define cNanoSec 1.0e-9
/**
@aref plcthread PlcThread
*/
pwr_sClass_PlcThread * pwr_sClass_PlcThread *
pwrb_PlcThread_Init ( pwrb_PlcThread_Init (
pwr_tStatus *sts, pwr_tStatus *sts,
...@@ -55,49 +58,6 @@ pwrb_PlcThread_Init ( ...@@ -55,49 +58,6 @@ pwrb_PlcThread_Init (
} }
void void
pwrb_PlcThread_Zero (
plc_sThread *tp
)
{
pwr_sClass_PlcThread *o;
o = tp->PlcThread;
o->Limit_1_8 = o->ScanTime / 8.0;
o->Limit_1_4 = o->ScanTime / 4.0;
o->Limit_1_2 = o->ScanTime / 2.0;
o->Limit_1_1 = o->ScanTime;
o->Limit_2_1 = o->ScanTime * 2.0;
o->Limit_4_1 = o->ScanTime * 4.0;
o->Limit_8_1 = o->ScanTime * 8.0;
o->ScanTimeMin = 1.0e30;
o->ScanTimeMean = 0.0;
o->ScanTimeMax = 0.0;
/* Update ScanTimeMean after 100 loops or after 10 seconds */
o->ScanTimeMeanCount = MIN(100., MAX(10./o->ScanTime, 1)) +.5;
o->ScanTimeStart.tv_sec = 0;
o->ScanTimeStart.tv_nsec = 0;
o->Count = 0;
o->Sum = 0.0;
o->Min = 1.0e30;
o->Mean = 0.0;
o->Coverage = 0.0;
o->Max = 0.0;
o->Count_1_8 = 0;
o->Count_1_4 = 0;
o->Count_1_2 = 0;
o->Count_1_1 = 0;
o->Count_2_1 = 0;
o->Count_4_1 = 0;
o->Count_8_1 = 0;
o->CountHigh = 0;
o->SlipCount = 0;
}
void
pwrb_PlcThread_Exec ( pwrb_PlcThread_Exec (
plc_sThread *tp plc_sThread *tp
) )
...@@ -168,3 +128,48 @@ pwrb_PlcThread_Exec ( ...@@ -168,3 +128,48 @@ pwrb_PlcThread_Exec (
} }
void
pwrb_PlcThread_Zero (
plc_sThread *tp
)
{
pwr_sClass_PlcThread *o;
o = tp->PlcThread;
o->Limit_1_8 = o->ScanTime / 8.0;
o->Limit_1_4 = o->ScanTime / 4.0;
o->Limit_1_2 = o->ScanTime / 2.0;
o->Limit_1_1 = o->ScanTime;
o->Limit_2_1 = o->ScanTime * 2.0;
o->Limit_4_1 = o->ScanTime * 4.0;
o->Limit_8_1 = o->ScanTime * 8.0;
o->ScanTimeMin = 1.0e30;
o->ScanTimeMean = 0.0;
o->ScanTimeMax = 0.0;
/* Update ScanTimeMean after 100 loops or after 10 seconds */
o->ScanTimeMeanCount = MIN(100., MAX(10./o->ScanTime, 1)) +.5;
o->ScanTimeStart.tv_sec = 0;
o->ScanTimeStart.tv_nsec = 0;
o->Count = 0;
o->Sum = 0.0;
o->Min = 1.0e30;
o->Mean = 0.0;
o->Coverage = 0.0;
o->Max = 0.0;
o->Count_1_8 = 0;
o->Count_1_4 = 0;
o->Count_1_2 = 0;
o->Count_1_1 = 0;
o->Count_2_1 = 0;
o->Count_4_1 = 0;
o->Count_8_1 = 0;
o->CountHigh = 0;
o->SlipCount = 0;
}
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
#include "rt_errh.h" #include "rt_errh.h"
/**
@aref cyclesup CycleSup
*/
lst_sEntry * lst_sEntry *
csup_Init ( csup_Init (
pwr_tStatus *status, pwr_tStatus *status,
......
...@@ -13,11 +13,8 @@ ...@@ -13,11 +13,8 @@
*/ */
/** @defgroup GDH Global Data Handler /** @addtogroup GDH */
* This module contains the access routines to the Global Data /*@{*/
* Handler. Those routines are callable from application level.
* @{
*/
#ifndef pwr_h #ifndef pwr_h
#include "pwr.h" #include "pwr.h"
......
...@@ -8,9 +8,8 @@ ...@@ -8,9 +8,8 @@
<Description>. */ <Description>. */
/** @defgroup MSGH Message Handler /** @addtogroup MSGH */
* @{ /*@{*/
*/
#define RS_MH_APPL_VERSION "X2.3.1" #define RS_MH_APPL_VERSION "X2.3.1"
......
...@@ -508,7 +508,7 @@ void adelay_exec( ...@@ -508,7 +508,7 @@ void adelay_exec(
object->StoInd++; object->StoInd++;
if ((object->StoInd >= maxindex) || (object->StoInd < 0)) if ((object->StoInd >= maxindex) || (object->StoInd < 0))
object->StoInd = 0; object->StoInd = 0;
if (object->StoredNumbers <= maxindex) if (object->StoredNumbers < maxindex)
object->StoredNumbers++; object->StoredNumbers++;
object->Count = 0; object->Count = 0;
object->TimVect[object->StoInd] = object->In; object->TimVect[object->StoInd] = object->In;
...@@ -519,7 +519,7 @@ void adelay_exec( ...@@ -519,7 +519,7 @@ void adelay_exec(
/* Calculate position for output /* Calculate position for output
*/ */
actoff = (object->Tim / *object->ScanTime - object->Count) actoff = (object->Tim / tp->f_scan_time - object->Count)
/ object->MaxCount; / object->MaxCount;
if (actoff >= object->StoredNumbers) if (actoff >= object->StoredNumbers)
actoff = object->StoredNumbers - 1; actoff = object->StoredNumbers - 1;
......
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
/** /**
STRCAT STRCAT
@aref strcat STRCAT @aref strcat Strcat
*/ */
#define Strcat_exec(obj,str1,str2) \ #define Strcat_exec(obj,str1,str2) \
strcpy(obj->ActVal, str1); \ strcpy(obj->ActVal, str1); \
......
...@@ -367,11 +367,11 @@ ddiff = ((object->PidAlg & DAVV) != 0) ? ...@@ -367,11 +367,11 @@ ddiff = ((object->PidAlg & DAVV) != 0) ?
(object->ControlDiff - eold) / *object->ScanTime: (object->ControlDiff - eold) / *object->ScanTime:
(object->ProcVal - xold) / *object->ScanTime; (object->ProcVal - xold) / *object->ScanTime;
if ((object->DerGain < 1.0) || if ((object->DerGain < 1.0) ||
(object->DerGain * *object->ScanTime >= object->DerTime)) (object->DerGain * *object->ScanTime >= object->DerTime))
object->FiltDer = ddiff; /* No Filter */ object->FiltDer = ddiff * object->DerTime; /* No Filter */
else else
object->FiltDer += (ddiff - derold) * object->FiltDer += (ddiff - derold) *
object->DerGain * *object->ScanTime / object->DerTime; /* Filter */ object->DerGain * *object->ScanTime; /* Filter */
if ( object->Force ) if ( object->Force )
/* Force */ /* Force */
...@@ -399,7 +399,7 @@ else ...@@ -399,7 +399,7 @@ else
{ {
/* Derivative-part */ /* Derivative-part */
if ((object->PidAlg & DALG) != 0) if ((object->PidAlg & DALG) != 0)
dut += (object->FiltDer-derold) * object->DerTime; dut += (object->FiltDer-derold);
/* P-part */ /* P-part */
dut += ((object->PidAlg & PAVV) != 0) ? dut += ((object->PidAlg & PAVV) != 0) ?
object->ControlDiff - eold : object->ControlDiff - eold :
...@@ -442,7 +442,7 @@ else ...@@ -442,7 +442,7 @@ else
ut = object->ControlDiff; ut = object->ControlDiff;
/* Derivative-part */ /* Derivative-part */
if ((object->PidAlg & DALG) != 0) if ((object->PidAlg & DALG) != 0)
ut += object->FiltDer * object->DerTime; ut += object->FiltDer;
/* Gain */ /* Gain */
ut *= object->Gain; ut *= object->Gain;
if (object->Inverse != 0) ut = - ut; if (object->Inverse != 0) ut = - ut;
......
...@@ -119,10 +119,13 @@ scan ( ...@@ -119,10 +119,13 @@ scan (
plc_sProcess *pp = tp->pp; plc_sProcess *pp = tp->pp;
int delay_action = 0; int delay_action = 0;
time_Uptime(&sts, &tp->before_scan, NULL); time_Uptime(&sts, &tp->before_scan, NULL);
clock_gettime(CLOCK_REALTIME, &tp->before_scan_abs); clock_gettime(CLOCK_REALTIME, &tp->before_scan_abs);
if (tp->loops > 0) { if (tp->loops > 0) {
if (sts == TIME__CLKCHANGE) {
time_Dadd(&tp->before_scan, &tp->one_before_scan, &tp->scan_time);
}
time_Dsub(&tp->delta_scan, &tp->before_scan, &tp->one_before_scan); time_Dsub(&tp->delta_scan, &tp->before_scan, &tp->one_before_scan);
time_DToFloat(&tp->ActualScanTime, &tp->delta_scan); time_DToFloat(&tp->ActualScanTime, &tp->delta_scan);
if (tp->ActualScanTime < MIN_SCANTIME) if (tp->ActualScanTime < MIN_SCANTIME)
...@@ -162,6 +165,9 @@ scan ( ...@@ -162,6 +165,9 @@ scan (
} }
time_Uptime(&sts, &tp->after_scan, NULL); time_Uptime(&sts, &tp->after_scan, NULL);
if (sts == TIME__CLKCHANGE) {
tp->after_scan = tp->before_scan;
}
clock_gettime(CLOCK_REALTIME, &tp->after_scan_abs); clock_gettime(CLOCK_REALTIME, &tp->after_scan_abs);
if (tp->log) if (tp->log)
pwrb_PlcThread_Exec(tp); pwrb_PlcThread_Exec(tp);
......
...@@ -9,10 +9,8 @@ ...@@ -9,10 +9,8 @@
This include file contains the internal datastructures and This include file contains the internal datastructures and
data entities in GDH. */ data entities in GDH. */
/** @defgroup QCOM Queue communication /** @addtogroup QCOM */
* This module ... /*@{*/
* @{
*/
#include <rpc/rpc.h> #include <rpc/rpc.h>
......
...@@ -34,7 +34,7 @@ copy : $(inc_dir)/pwr_ssabclasses.h ...@@ -34,7 +34,7 @@ copy : $(inc_dir)/pwr_ssabclasses.h
lib : $(load_dir)/ssab.dbs lib : $(load_dir)/ssab.dbs
exe : $(doc_dir)/ssab_allclasses.html \ exe : $(doc_dir)/orm/ssab_allclasses.html \
$(exe_dir)/ssab_xtthelp.dat $(exe_dir)/ssab_xtthelp.dat
clean : clean :
...@@ -50,14 +50,14 @@ $(inc_dir)/pwr_ssabclasses.h : ...@@ -50,14 +50,14 @@ $(inc_dir)/pwr_ssabclasses.h :
@ echo "Generating struct files for ssab classes..." @ echo "Generating struct files for ssab classes..."
@ co_convert -sv -d $(inc_dir) "$(pwre_sroot)/wbl/ssab/src/ssab_c_*.wb_load" @ co_convert -sv -d $(inc_dir) "$(pwre_sroot)/wbl/ssab/src/ssab_c_*.wb_load"
$(doc_dir)/ssab_allclasses.html : $(doc_dir)/orm/ssab_allclasses.html :
@ echo "Generating html files for ssab classes..." @ echo "Generating html files for ssab classes..."
@ co_convert -w -d $(doc_dir) "$(pwre_sroot)/wbl/ssab/src/ssab_c_*.wb_load" @ co_convert -w -d $(doc_dir)/orm "$(pwre_sroot)/wbl/ssab/src/ssab_c_*.wb_load"
@ echo "Generating html files for ssab structs..." @ echo "Generating html files for ssab structs..."
@ co_convert -c -d $(doc_dir) $(inc_dir)/pwr_ssabclasses.h @ co_convert -c -d $(doc_dir)/orm $(inc_dir)/pwr_ssabclasses.h
@ echo "Generating html files for ssab code..." @ echo "Generating html files for ssab code..."
@ co_convert -c -d $(doc_dir) "$(pwre_sroot)/lib/rs/src/rs_plc_macro_ssab.h" @ co_convert -c -d $(doc_dir)/orm "$(pwre_sroot)/lib/rs/src/rs_plc_macro_ssab.h"
@ co_convert -c -d $(doc_dir) "$(pwre_sroot)/lib/rs/src/rs_plc_ssab*.c" @ co_convert -c -d $(doc_dir)/orm "$(pwre_sroot)/lib/rs/src/rs_plc_ssab*.c"
$(exe_dir)/ssab_xtthelp.dat : $(exe_dir)/ssab_xtthelp.dat :
@ echo "Generating xtt help files for ssab classes" @ echo "Generating xtt help files for ssab classes"
......
! ssab_c_BuffStr80.wb_load -- Defines the class BuffStr80.
!
! PROVIEW/R
!
! <Description>.
!
SObject SSAB:Class
!
! BuffStr80 Transbuffer
!
Object BuffStr80 $ClassDef 24
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
!
! BuffStr80 Runtime Body
!
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "BuffStr80"
EndBody
!
! Parameter Data
!
Object Data $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
EndObject
!
! Template fr BuffStr80
!
Object Template BuffStr80
Body RtBody
EndBody
EndObject
!
! End BuffStr80
!
EndObject
EndSObject
...@@ -35,7 +35,7 @@ copy : $(inc_dir)/pwr_tlogclasses.h ...@@ -35,7 +35,7 @@ copy : $(inc_dir)/pwr_tlogclasses.h
lib : $(load_dir)/tlog.dbs lib : $(load_dir)/tlog.dbs
exe : $(doc_dir)/tlog_allclasses.html \ exe : $(doc_dir)/orm/tlog_allclasses.html \
$(exe_dir)/tlog_xtthelp.dat $(exe_dir)/tlog_xtthelp.dat
clean : clean :
...@@ -51,14 +51,14 @@ $(inc_dir)/pwr_tlogclasses.h : ...@@ -51,14 +51,14 @@ $(inc_dir)/pwr_tlogclasses.h :
@ echo "Generating struct files for tlog classes..." @ echo "Generating struct files for tlog classes..."
@ co_convert -sv -d $(inc_dir) "$(pwre_sroot)/wbl/tlog/src/tlog_c_*.wb_load" @ co_convert -sv -d $(inc_dir) "$(pwre_sroot)/wbl/tlog/src/tlog_c_*.wb_load"
$(doc_dir)/tlog_allclasses.html : $(doc_dir)/orm/tlog_allclasses.html :
@ echo "Generating html files for tlog classes..." @ echo "Generating html files for tlog classes..."
@ co_convert -w -d $(doc_dir) "$(pwre_sroot)/wbl/tlog/src/tlog_c_*.wb_load" @ co_convert -w -d $(doc_dir)/orm "$(pwre_sroot)/wbl/tlog/src/tlog_c_*.wb_load"
@ echo "Generating html files for tlog structs..." @ echo "Generating html files for tlog structs..."
@ co_convert -c -d $(doc_dir) $(inc_dir)/pwr_tlogclasses.h @ co_convert -c -d $(doc_dir)/orm $(inc_dir)/pwr_tlogclasses.h
@ echo "Generating html files for tlog code..." @ echo "Generating html files for tlog code..."
@ co_convert -c -d $(doc_dir) "$(pwre_sroot)/lib/rs/src/rs_plc_macro_tlog.h" @ co_convert -c -d $(doc_dir)/orm "$(pwre_sroot)/lib/rs/src/rs_plc_macro_tlog.h"
@ co_convert -c -d $(doc_dir) "$(pwre_sroot)/lib/rs/src/rs_plc_tlog*.c" @ co_convert -c -d $(doc_dir)/orm "$(pwre_sroot)/lib/rs/src/rs_plc_tlog*.c"
$(exe_dir)/tlog_xtthelp.dat : $(exe_dir)/tlog_xtthelp.dat :
@ echo "Generating xtt help files for tlog classes" @ echo "Generating xtt help files for tlog classes"
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include "wb_env.h"
#include "flow.h" #include "flow.h"
#include "flow_ctx.h" #include "flow_ctx.h"
#include "flow_api.h" #include "flow_api.h"
...@@ -46,7 +47,6 @@ extern "C" { ...@@ -46,7 +47,6 @@ extern "C" {
#include "co_xhelp.h" #include "co_xhelp.h"
#include "wb_wtt.h" #include "wb_wtt.h"
#include "wb_env.h"
#include "wb_erep.h" #include "wb_erep.h"
#include "wb_vrepwbl.h" #include "wb_vrepwbl.h"
#include "wb_vrepdbs.h" #include "wb_vrepdbs.h"
...@@ -239,12 +239,12 @@ void pwr_login_success() ...@@ -239,12 +239,12 @@ void pwr_login_success()
if ( login_prv.priv & pwr_mPrv_DevRead ) if ( login_prv.priv & pwr_mPrv_DevRead )
{ {
utl_get_systemname( systemname, systemgroup); utl_get_systemname( systemname, systemgroup);
strcpy( title, "PROVIEW/R Navigator: "); strcpy( title, "PwR Navigator: ");
strcat( title, login_prv.username); strcat( title, login_prv.username);
strcat( title, " on "); strcat( title, " on ");
strcat( title, systemname); strcat( title, systemname);
appl_count++; appl_count++;
new WVsel( &sts, NULL, mainwindow, "PROVIEW/R Volumes", new WVsel( &sts, NULL, mainwindow, "PwR Volumes",
wbctx, NULL, wbctx, NULL,
&pwr_vsel_success, &pwr_vsel_cancel, &pwr_time_to_exit, 0, wb_eType_Volume); &pwr_vsel_success, &pwr_vsel_cancel, &pwr_time_to_exit, 0, wb_eType_Volume);
} }
...@@ -284,12 +284,12 @@ void pwr_wtt_open_volume( void *wttctx, wb_eType type, char *filename, wow_eFile ...@@ -284,12 +284,12 @@ void pwr_wtt_open_volume( void *wttctx, wb_eType type, char *filename, wow_eFile
{ {
if ( !filename) { if ( !filename) {
utl_get_systemname( systemname, systemgroup); utl_get_systemname( systemname, systemgroup);
strcpy( title, "PROVIEW/R Navigator: "); strcpy( title, "PwR Navigator: ");
strcat( title, login_prv.username); strcat( title, login_prv.username);
strcat( title, " on "); strcat( title, " on ");
strcat( title, systemname); strcat( title, systemname);
appl_count++; appl_count++;
new WVsel( &sts, NULL, mainwindow, "PROVIEW/R Volumes", wbctx, NULL, new WVsel( &sts, NULL, mainwindow, "PwR Volumes", wbctx, NULL,
&pwr_vsel_success, &pwr_vsel_cancel, &pwr_time_to_exit, 1, &pwr_vsel_success, &pwr_vsel_cancel, &pwr_time_to_exit, 1,
type); type);
} }
...@@ -555,7 +555,7 @@ int main( int argc, char *argv[]) ...@@ -555,7 +555,7 @@ int main( int argc, char *argv[])
sprintf( msg, "User %s logged in", login_prv.username); sprintf( msg, "User %s logged in", login_prv.username);
MsgWindow::message( 'I', msg); MsgWindow::message( 'I', msg);
strcpy( title, "PROVIEW/R Development "); strcpy( title, "PwR Development ");
strcat( title, login_prv.username); strcat( title, login_prv.username);
strcat( title, " on "); strcat( title, " on ");
strcat( title, systemname); strcat( title, systemname);
...@@ -590,23 +590,23 @@ int main( int argc, char *argv[]) ...@@ -590,23 +590,23 @@ int main( int argc, char *argv[])
{ {
if ( login_prv.priv & pwr_mPrv_DevRead ) if ( login_prv.priv & pwr_mPrv_DevRead )
{ {
strcpy( title, "PROVIEW/R Navigator: "); strcpy( title, "PwR Navigator: ");
strcat( title, login_prv.username); strcat( title, login_prv.username);
strcat( title, " on "); strcat( title, " on ");
strcat( title, systemname); strcat( title, systemname);
appl_count++; appl_count++;
new WVsel( &sts, NULL, mainwindow, "PROVIEW/R Volumes", wbctx, volumename, new WVsel( &sts, NULL, mainwindow, "PwR Volumes", wbctx, volumename,
&pwr_vsel_success, &pwr_vsel_cancel, &pwr_time_to_exit, 0, wb_eType_Volume); &pwr_vsel_success, &pwr_vsel_cancel, &pwr_time_to_exit, 0, wb_eType_Volume);
} }
else else
exit(LOGIN__NOPRIV); exit(LOGIN__NOPRIV);
} }
else if ( login_display) else if ( login_display)
login_new(NULL, mainwindow, "PROVIEW/R Login", systemgroup, login_new(NULL, mainwindow, "PwR Login", systemgroup,
&pwr_login_success, &pwr_login_cancel); &pwr_login_success, &pwr_login_cancel);
strcpy( title, "PROVIEW/R Development "); strcpy( title, "PwR Development ");
strcat( title, login_prv.username); strcat( title, login_prv.username);
strcat( title, " on "); strcat( title, " on ");
strcat( title, systemname); strcat( title, systemname);
......
...@@ -60,6 +60,7 @@ all : init copy lib exe ...@@ -60,6 +60,7 @@ all : init copy lib exe
init : init :
copy : $(export_h) $(export_c) $(export_dat) $(exe_dir)/wtt_help.dat \ copy : $(export_h) $(export_c) $(export_dat) $(exe_dir)/wtt_help.dat \
$(exe_dir)/ge_help.dat \
$(exe_dir)/pwr_wb_palette.cnf $(load_dir)/pwr_volumelist.dat $(exe_dir)/pwr_wb_palette.cnf $(load_dir)/pwr_volumelist.dat
lib : lib :
...@@ -75,6 +76,10 @@ $(exe_dir)/wtt_help.dat : wtt_help.dat ...@@ -75,6 +76,10 @@ $(exe_dir)/wtt_help.dat : wtt_help.dat
@ echo "Copying wtt_help.dat" @ echo "Copying wtt_help.dat"
@ $(cp) $(cpflags) $(source) $(target) @ $(cp) $(cpflags) $(source) $(target)
$(exe_dir)/ge_help.dat : ge_help.dat
@ echo "Copying ge_help.dat"
@ $(cp) $(cpflags) $(source) $(target)
$(exe_dir)/pwr_wb_palette.cnf : ../../pwr_wb_palette.cnf $(exe_dir)/pwr_wb_palette.cnf : ../../pwr_wb_palette.cnf
@ echo "Copying pwr_wb_palette.cnf" @ echo "Copying pwr_wb_palette.cnf"
@ $(cp) $(cpflags) $(source) $(target) @ $(cp) $(cpflags) $(source) $(target)
......
...@@ -2,11 +2,11 @@ ifndef link_rule_mk ...@@ -2,11 +2,11 @@ ifndef link_rule_mk
link_rule_mk := 1 link_rule_mk := 1
link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) \ link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(rt_msg_objs) \ $(export_obj) $(objects) $(wb_msg_objs) $(rt_msg_objs) \
$(pwr_obj)/rt_io_user.o -L/usr/X11R6/lib -L/usr/lib/mysql \ $(pwr_obj)/rt_io_user.o -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-lpwr_ge -lpwr_wb -lpwr_rt -lpwr_co -lpwr_flow -lpwr_glow \ -lpwr_ge -lpwr_wb -lpwr_flow -lpwr_glow -lpwr_rt -lpwr_co \
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\ -lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lXmu -lSM -lICE\ -lXmu -lSM -lICE\
-lrpcsvc -lpthread -ldb_cxx-4.0 -lm -lmysqlclient -lz -lrpcsvc -lpthread -lm -ldb_cxx-4.0 -lz
endif endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment