Commit 10fade2c authored by Claes Sjofors's avatar Claes Sjofors

Sev database hdf5 added

parent 70a66ffb
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(elinkflags) $(domap) -o $(export_exe) \
ifeq ($(PWRE_CONF_LIBHDF5),1)
ldsev = mpic++
else
ldsev = $(ldxx)
endif
link = $(ldsev) $(elinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o \
$(pwre_conf_libdir) $(pwre_conf_libpwrsev) $(pwre_conf_libpwrrt) $(pwre_conf_lib)
......
......@@ -108,10 +108,14 @@ int sev_server::init( int noneth)
exit(0);
}
pwr_sAttrRef aref = cdh_ObjidToAref( conf_oid);
sts = gdh_DLRefObjectInfoAttrref( &aref, (void **)&m_config, &m_config_dlid);
if ( EVEN(sts))
m_config = 0;
// Get configured database
pwr_tAttrRef daref;
pwr_eSevDatabaseEnum db_enum;
pwr_tAttrRef aref = cdh_ObjidToAref( conf_oid);
sts = gdh_ArefANameToAref( &aref, "Database", &daref);
if ( ODD(sts)) {
sts = gdh_GetObjectInfoAttrref( &daref, (void *)&db_enum, sizeof(db_enum));
......@@ -123,6 +127,9 @@ int sev_server::init( int noneth)
case pwr_eSevDatabaseEnum_SQLite:
set_dbtype( sev_eDbType_Sqlite);
break;
case pwr_eSevDatabaseEnum_HDF5:
set_dbtype( sev_eDbType_HDF5);
break;
}
}
}
......@@ -444,6 +451,16 @@ int sev_server::mainloop()
m_stat.medium_storage_rate = a * m_stat.medium_storage_rate + (1.0-a) * m_stat.storage_rate;
m_storage_cnt = 0;
m_db->store_stat( &m_stat);
if ( m_config) {
m_config->Stat.CurrentLoad = m_stat.current_load;
m_config->Stat.MediumLoad = m_stat.medium_load;
m_config->Stat.StorageRate = m_stat.storage_rate;
m_config->Stat.MediumStorageRate = m_stat.medium_storage_rate;
m_config->Stat.DataStoreMsgCnt = m_stat.datastore_msg_cnt;
m_config->Stat.DataGetMsgCnt = m_stat.dataget_msg_cnt;
m_config->Stat.ItemsMsgCnt = m_stat.items_msg_cnt;
m_config->Stat.EventStoreMsgCnt = m_stat.eventstore_msg_cnt;
}
time_Aadd( &next_stat, &next_stat, &stat_interval);
busy = pwr_cNDeltaTime;
idle = pwr_cNDeltaTime;
......@@ -576,6 +593,8 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size)
buffP->scantime,
buffP->deadband,
buffP->options,
buffP->attrnum,
buffP->attr,
&idx)) {
m_db->add_objectitem( &m_sts,
tablename,
......@@ -587,6 +606,8 @@ int sev_server::check_histitems( sev_sMsgHistItems *msg, unsigned int size)
buffP->scantime,
buffP->deadband,
buffP->options,
buffP->attrnum,
buffP->attr,
&idx);
if ( EVEN(m_sts)) return m_sts;
newobject = true;
......@@ -986,6 +1007,8 @@ int main (int argc, char *argv[])
dbtype = sev_eDbType_Sqlite;
else if ( argc > 2 + noneth && strcmp( argv[1+noneth], "-d") == 0 && strcmp( argv[2+noneth], "mysql") == 0)
dbtype = sev_eDbType_Mysql;
else if ( argc > 2 + noneth && strcmp( argv[1+noneth], "-d") == 0 && strcmp( argv[2+noneth], "hdf5") == 0)
dbtype = sev_eDbType_HDF5;
if ( dbtype == sev_eDbType_) {
char type[80];
......@@ -994,6 +1017,8 @@ int main (int argc, char *argv[])
dbtype = sev_eDbType_Sqlite;
else if ( cdh_NoCaseStrcmp( type, "mysql") == 0)
dbtype = sev_eDbType_Mysql;
else if ( cdh_NoCaseStrcmp( type, "hdf5") == 0)
dbtype = sev_eDbType_HDF5;
}
}
......
......@@ -42,6 +42,7 @@
#include "pwr.h"
#include "pwr_class.h"
#include "pwr_baseclasses.h"
#include "rt_sev_net.h"
#include "sev_db.h"
......@@ -72,7 +73,7 @@ class sev_server {
public:
sev_server() : m_server_status(0), m_refid(0), m_msg_id(0), m_storage_cnt(0),
m_db_type(sev_eDbType_Sqlite) {memset(&m_stat,0,sizeof(m_stat));}
m_db_type(sev_eDbType_Sqlite), m_config(0) {memset(&m_stat,0,sizeof(m_stat));}
pwr_tStatus m_sts;
pwr_tStatus m_server_status;
......@@ -84,6 +85,8 @@ class sev_server {
unsigned int m_storage_cnt;
sev_sStat m_stat;
sev_eDbType m_db_type;
pwr_sClass_SevServer *m_config;
pwr_tDlid m_config_dlid;
int init( int noneth);
int connect();
......
......@@ -37,10 +37,17 @@
#include "sev_db.h"
#include "sev_dbms.h"
#include "sev_dbsqlite.h"
#include "sev_dbhdf5.h"
#include "co_syi.h"
#include "pwr_names.h"
#include "rt_load.h"
#include "co_dcli.h"
sev_db *sev_db::open_database( sev_eDbType type)
{
if ( type == sev_eDbType_Mysql) {
#if defined PWRE_CONF_MYSQL
return sev_dbms::open_database();
......@@ -55,8 +62,58 @@ sev_db *sev_db::open_database( sev_eDbType type)
#else
printf( "** Release is not built with sqlite3\n");
return 0;
#endif
}
else if ( type == sev_eDbType_HDF5) {
#if defined PWRE_CONF_HDF5
return sev_dbhdf5::open_database();
#else
printf( "** Release is not built with HDF5\n");
return 0;
#endif
}
else
return 0;
}
int sev_db::get_systemname( char *name)
{
FILE *file;
pwr_tFileName fname;
char nodename[40];
char *bus_str;
int bus;
char line[200];
pwr_tStatus sts;
static char system_name[80] = "";
if ( strcmp( system_name, "") == 0) {
syi_NodeName( &sts, nodename, sizeof(nodename));
if ( EVEN(sts)) return 0;
bus_str = getenv( "PWR_BUS_ID");
if ( !bus_str)
return 0;
if ( sscanf( bus_str, "%d", &bus) != 1)
return 0;
sprintf( fname, pwr_cNameBoot, load_cDirectory, cdh_Low(nodename), bus);
dcli_translate_filename( fname, fname);
file = fopen( fname, "r");
if ( file == 0) {
printf("In %s row %d:\n", __FILE__, __LINE__);
printf("** Warning, systemname not found\n");
return 0;
}
if ( !dcli_read_line( line, sizeof(line), file))
return 0;
if ( !dcli_read_line( line, sizeof(line), file))
return 0;
strcpy( system_name, line);
}
strcpy( name, system_name);
return 1;
}
......@@ -42,6 +42,7 @@
#include "pwr.h"
#include "pwr_class.h"
#include "rt_mh_net.h"
#include "rt_sev_net.h"
using namespace std;
......@@ -50,7 +51,8 @@ using namespace std;
typedef enum {
sev_eDbType_,
sev_eDbType_Mysql,
sev_eDbType_Sqlite
sev_eDbType_Sqlite,
sev_eDbType_HDF5
} sev_eDbType;
typedef struct {
......@@ -66,6 +68,12 @@ typedef struct {
class sev_attr {
public:
sev_attr() : type(pwr_eType_), size(0), elem(0) {
strcpy( aname, ""); strcpy( unit, "");
}
sev_attr( const sev_attr& x) : type(x.type), size(x.size), elem(x.elem) {
strncpy( aname, x.aname, sizeof(aname)); strncpy( unit, x.unit, sizeof(unit));
}
pwr_tOName aname;
pwr_eType type;
unsigned int size;
......@@ -86,8 +94,17 @@ class sev_event {
class sev_item {
public:
sev_item() : deadband_active(0), last_id(0), value_size(0), old_value(0), first_storage(1), status(0), logged_status(0),
deleted(0)
idx(0), deleted(0)
{ /*memset( old_value, 0, sizeof(old_value));*/}
sev_item( const sev_item& x) : id(x.id), oid(x.oid), creatime(x.creatime), modtime(x.modtime),
storagetime(x.storagetime), sevid(x.sevid), scantime(x.scantime), deadband(x.deadband), options(x.options),
deadband_active(x.deadband_active), last_id(x.last_id), value_size(x.value_size), first_storage(x.first_storage),
attrnum(x.attrnum), attr(x.attr), status(x.status), logged_status(x.logged_status),
idx(x.idx), deleted(x.deleted) {
strncpy( tablename, x.tablename, sizeof(tablename));
strncpy( oname, x.oname, sizeof(oname));
strncpy( description, x.description, sizeof(description));
}
unsigned int id;
char tablename[256];
pwr_tOid oid;
......@@ -110,6 +127,7 @@ class sev_item {
vector<sev_attr> attr;
pwr_tStatus status;
pwr_tStatus logged_status;
unsigned int idx;
int deleted;
};
......@@ -124,54 +142,58 @@ class sev_db {
pwr_tDeltaTime storatetime, pwr_eType type, unsigned int size,
char *description, char *unit, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx)
{ return 0;}
{ *sts = 0; return 0;}
virtual int add_item( pwr_tStatus *sts, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, pwr_eType type, unsigned int size,
char *description, char *unit, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx)
{ return 0;}
virtual int delete_item( pwr_tStatus *sts, pwr_tOid oid, char *aname) { return 0;}
{ *sts = 0; return 0;}
virtual int delete_item( pwr_tStatus *sts, pwr_tOid oid, char *aname) { *sts = 0; return 0;}
virtual int store_value( pwr_tStatus *sts, int item_idx, int attr_idx,
pwr_tTime time, void *buf, unsigned int size) { return 0;}
pwr_tTime time, void *buf, unsigned int size) { *sts = 0; return 0;}
virtual int get_values( pwr_tStatus *sts, pwr_tOid oid, pwr_tMask options, float deadband,
char *aname, pwr_eType type,
unsigned int size, pwr_tFloat32 scantime, pwr_tTime *creatime, pwr_tTime *starttime,
pwr_tTime *endtime, int maxsize, pwr_tTime **tbuf, void **vbuf,
unsigned int *bsize) { return 0;}
virtual int get_items( pwr_tStatus *sts) { return 0;}
unsigned int *bsize) { *sts = 0; return 0;}
virtual int get_items( pwr_tStatus *sts) { *sts = 0; return 0;}
virtual int delete_old_data( pwr_tStatus *sts, char *tablename,
pwr_tMask options, pwr_tTime limit, pwr_tFloat32 scantime, pwr_tFloat32 garbagecycle) { return 0;}
pwr_tMask options, pwr_tTime limit, pwr_tFloat32 scantime, pwr_tFloat32 garbagecycle)
{ *sts = 0; return 0;}
virtual int check_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx) { return 0;}
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx) { *sts = 0; return 0;}
virtual int add_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx) { return 0;}
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx) { *sts = 0; return 0;}
virtual int store_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, char *description, pwr_tFloat32 scantime, pwr_tFloat32 deadband, pwr_tMask options) { return 0;}
virtual int store_event( pwr_tStatus *sts, int item_idx, sev_event *ep) { return 0;}
virtual int get_item( pwr_tStatus *sts, sev_item *item, pwr_tOid oid, char *attributename) { return 0;}
virtual int get_objectitem( pwr_tStatus *sts, sev_item *item, pwr_tOid oid, char *attributename) { return 0;}
virtual int get_objectitems( pwr_tStatus *sts) { return 0;}
virtual int store_event( pwr_tStatus *sts, int item_idx, sev_event *ep) { *sts = 0; return 0;}
virtual int get_item( pwr_tStatus *sts, sev_item *item, pwr_tOid oid, char *attributename) { *sts = 0; return 0;}
virtual int get_objectitem( pwr_tStatus *sts, sev_item *item, pwr_tOid oid, char *attributename) { *sts = 0; return 0;}
virtual int get_objectitems( pwr_tStatus *sts) { *sts = 0; return 0;}
virtual int check_objectitemattr( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *aname, char *oname,
pwr_eType type, unsigned int size, unsigned int *idx) { return 0;}
pwr_eType type, unsigned int size, unsigned int *idx) { *sts = 0; return 0;}
virtual int delete_old_objectdata( pwr_tStatus *sts, char *tablename,
pwr_tMask options, pwr_tTime limit, pwr_tFloat32 scantime, pwr_tFloat32 garbagecycle) { return 0;}
pwr_tMask options, pwr_tTime limit, pwr_tFloat32 scantime, pwr_tFloat32 garbagecycle) { *sts = 0; return 0;}
virtual int get_objectvalues( pwr_tStatus *sts, sev_item *item,
unsigned int size, pwr_tTime *starttime, pwr_tTime *endtime,
int maxsize, pwr_tTime **tbuf, void **vbuf, unsigned int *bsize) { return 0;}
virtual int handle_objectchange(pwr_tStatus *sts, char *tablename, unsigned int item_idx, bool newObject) { return 0;}
virtual int repair_table( pwr_tStatus *sts, char *tablename) { return 0;}
virtual int alter_engine( pwr_tStatus *sts, char *tablename) { return 0;}
virtual int optimize( pwr_tStatus *sts, char *tablename) { return 0;}
int maxsize, pwr_tTime **tbuf, void **vbuf, unsigned int *bsize) { *sts = 0; return 0;}
virtual int handle_objectchange(pwr_tStatus *sts, char *tablename, unsigned int item_idx, bool newObject) { *sts = 0; return 0;}
virtual int repair_table( pwr_tStatus *sts, char *tablename) { *sts = 0; return 0;}
virtual int alter_engine( pwr_tStatus *sts, char *tablename) { *sts = 0; return 0;}
virtual int optimize( pwr_tStatus *sts, char *tablename) { *sts = 0; return 0;}
virtual int store_stat( sev_sStat *stat) { return 0;}
virtual int begin_transaction() { return 0;}
virtual int commit_transaction() { return 0;}
virtual char *dbName() { return 0;}
static sev_db *open_database( sev_eDbType type);
static int get_systemname( char *name);
};
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2014 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#ifndef sev_dbhdf5_h
#define sev_dbhdf5_h
#if defined PWRE_CONF_HDF5
#include <vector>
#include "pwr.h"
#include "pwr_class.h"
#include "sev_db.h"
#include <hdf5.h>
using namespace std;
typedef struct {
int items_alloc;
int objectitems_alloc;
int objectitemattr_alloc;
int next_items_idx;
int next_objectitems_idx;
int next_objectitemattr_idx;
int next_item_id;
int dum[3];
} sev_sCmn;
typedef struct {
unsigned int data_size;
int data_type;
int first_idx;
int last_idx;
unsigned first_time;
unsigned last_time;
} sev_sHeader;
typedef struct {
unsigned int time;
unsigned int ntime;
int eventtype;
int eventprio;
unsigned int eventid_nix;
unsigned int eventid_birthtime;
unsigned int eventid_idx;
char eventtext[80];
char eventname[80];
} sev_sEventDb;
typedef struct {
float current_load;
float medium_load;
float storage_rate;
float medium_storage_rate;
unsigned int datastore_msg_cnt;
unsigned int dataget_msg_cnt;
unsigned int items_msg_cnt;
unsigned int eventstore_msg_cnt;
} sev_sStatDb;
typedef enum {
sev_eDataType_,
sev_eDataType_Boolean,
sev_eDataType_BooleanHt,
sev_eDataType_BooleanDb,
sev_eDataType_BooleanHtDb,
sev_eDataType_Int8,
sev_eDataType_Int8Ht,
sev_eDataType_Int8Db,
sev_eDataType_Int8HtDb,
sev_eDataType_Int16,
sev_eDataType_Int16Ht,
sev_eDataType_Int16Db,
sev_eDataType_Int16HtDb,
sev_eDataType_Int32,
sev_eDataType_Int32Ht,
sev_eDataType_Int32Db,
sev_eDataType_Int32HtDb,
sev_eDataType_Int64,
sev_eDataType_Int64Ht,
sev_eDataType_Int64Db,
sev_eDataType_Int64HtDb,
sev_eDataType_UInt8,
sev_eDataType_UInt8Ht,
sev_eDataType_UInt8Db,
sev_eDataType_UInt8HtDb,
sev_eDataType_UInt16,
sev_eDataType_UInt16Ht,
sev_eDataType_UInt16Db,
sev_eDataType_UInt16HtDb,
sev_eDataType_UInt32,
sev_eDataType_UInt32Ht,
sev_eDataType_UInt32Db,
sev_eDataType_UInt32HtDb,
sev_eDataType_UInt64,
sev_eDataType_UInt64Ht,
sev_eDataType_UInt64Db,
sev_eDataType_UInt64HtDb,
sev_eDataType_Float32,
sev_eDataType_Float32Ht,
sev_eDataType_Float32Db,
sev_eDataType_Float32HtDb,
sev_eDataType_Float64,
sev_eDataType_Float64Ht,
sev_eDataType_Float64Db,
sev_eDataType_Float64HtDb,
sev_eDataType_Time,
sev_eDataType_TimeHt,
sev_eDataType_TimeDb,
sev_eDataType_TimeHtDb,
sev_eDataType_DeltaTime,
sev_eDataType_DeltaTimeHt,
sev_eDataType_DeltaTimeDb,
sev_eDataType_DeltaTimeHtDb,
sev_eDataType_String8,
sev_eDataType_String8Ht,
sev_eDataType_String8Db,
sev_eDataType_String8HtDb,
sev_eDataType_String16,
sev_eDataType_String16Ht,
sev_eDataType_String16Db,
sev_eDataType_String16HtDb,
sev_eDataType_String32,
sev_eDataType_String32Ht,
sev_eDataType_String32Db,
sev_eDataType_String32HtDb,
sev_eDataType_String40,
sev_eDataType_String40Ht,
sev_eDataType_String40Db,
sev_eDataType_String40HtDb,
sev_eDataType_String80,
sev_eDataType_String80Ht,
sev_eDataType_String80Db,
sev_eDataType_String80HtDb,
sev_eDataType_String132,
sev_eDataType_String132Ht,
sev_eDataType_String132Db,
sev_eDataType_String132HtDb,
sev_eDataType_String256,
sev_eDataType_String256Ht,
sev_eDataType_String256Db,
sev_eDataType_String256HtDb,
sev_eDataType__,
sev_eDataType_Unknown = 10001
} sev_eDataType;
typedef struct {
pwr_tUInt32 time;
} sev_sDataType_Any;
typedef struct {
pwr_tUInt32 time;
pwr_tBoolean value;
} sev_sDataType_Boolean;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tBoolean value;
} sev_sDataType_BooleanHt;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tBoolean value;
} sev_sDataType_BooleanDb;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tBoolean value;
} sev_sDataType_BooleanHtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tInt8 value;
} sev_sDataType_Int8;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tInt8 value;
} sev_sDataType_Int8Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tInt8 value;
} sev_sDataType_Int8Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tInt8 value;
} sev_sDataType_Int8HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tInt16 value;
} sev_sDataType_Int16;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tInt16 value;
} sev_sDataType_Int16Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tInt16 value;
} sev_sDataType_Int16Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tInt16 value;
} sev_sDataType_Int16HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tInt32 value;
} sev_sDataType_Int32;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tInt32 value;
} sev_sDataType_Int32Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tInt32 value;
} sev_sDataType_Int32Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tInt32 value;
} sev_sDataType_Int32HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tInt64 value;
} sev_sDataType_Int64;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tInt64 value;
} sev_sDataType_Int64Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tInt64 value;
} sev_sDataType_Int64Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tInt64 value;
} sev_sDataType_Int64HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt8 value;
} sev_sDataType_UInt8;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt8 value;
} sev_sDataType_UInt8Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tUInt8 value;
} sev_sDataType_UInt8Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tUInt8 value;
} sev_sDataType_UInt8HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt16 value;
} sev_sDataType_UInt16;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt16 value;
} sev_sDataType_UInt16Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tUInt16 value;
} sev_sDataType_UInt16Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tUInt16 value;
} sev_sDataType_UInt16HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 value;
} sev_sDataType_UInt32;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 value;
} sev_sDataType_UInt32Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tUInt32 value;
} sev_sDataType_UInt32Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tUInt32 value;
} sev_sDataType_UInt32HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt64 value;
} sev_sDataType_UInt64;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt64 value;
} sev_sDataType_UInt64Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tUInt64 value;
} sev_sDataType_UInt64Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tUInt64 value;
} sev_sDataType_UInt64HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tFloat32 value;
} sev_sDataType_Float32;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tFloat32 value;
} sev_sDataType_Float32Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tFloat32 value;
} sev_sDataType_Float32Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tFloat32 value;
} sev_sDataType_Float32HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tFloat64 value;
} sev_sDataType_Float64;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tFloat64 value;
} sev_sDataType_Float64Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tFloat64 value;
} sev_sDataType_Float64Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tFloat64 value;
} sev_sDataType_Float64HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 value;
} sev_sDataType_Time;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 value;
pwr_tUInt32 nvalue;
} sev_sDataType_TimeHt;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tUInt32 value;
} sev_sDataType_TimeDb;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tUInt32 value;
pwr_tUInt32 nvalue;
} sev_sDataType_TimeHtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tInt64 value;
} sev_sDataType_DeltaTime;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tInt64 value;
pwr_tInt64 nvalue;
} sev_sDataType_DeltaTimeHt;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tInt64 value;
} sev_sDataType_DeltaTimeDb;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tInt64 value;
pwr_tInt64 nvalue;
} sev_sDataType_DeltaTimeHtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tString8 value;
} sev_sDataType_String8;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tString8 value;
} sev_sDataType_String8Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tString8 value;
} sev_sDataType_String8Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tString8 value;
} sev_sDataType_String8HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tString16 value;
} sev_sDataType_String16;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tString16 value;
} sev_sDataType_String16Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tString16 value;
} sev_sDataType_String16Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tString16 value;
} sev_sDataType_String16HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tString32 value;
} sev_sDataType_String32;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tString32 value;
} sev_sDataType_String32Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tString32 value;
} sev_sDataType_String32Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tString32 value;
} sev_sDataType_String32HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tString40 value;
} sev_sDataType_String40;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tString40 value;
} sev_sDataType_String40Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tString40 value;
} sev_sDataType_String40Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tString40 value;
} sev_sDataType_String40HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tString80 value;
} sev_sDataType_String80;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tString80 value;
} sev_sDataType_String80Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tString80 value;
} sev_sDataType_String80Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tString80 value;
} sev_sDataType_String80HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tString132 value;
} sev_sDataType_String132;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tString132 value;
} sev_sDataType_String132Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tString132 value;
} sev_sDataType_String132Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tString132 value;
} sev_sDataType_String132HtDb;
typedef struct {
pwr_tUInt32 time;
pwr_tString256 value;
} sev_sDataType_String256;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tString256 value;
} sev_sDataType_String256Ht;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 jump;
pwr_tString256 value;
} sev_sDataType_String256Db;
typedef struct {
pwr_tUInt32 time;
pwr_tUInt32 ntime;
pwr_tUInt32 jump;
pwr_tString256 value;
} sev_sDataType_String256HtDb;
typedef union {
sev_sDataType_Any dtAny;
sev_sDataType_Boolean dtBoolean;
sev_sDataType_BooleanHt dtBooleanHt;
sev_sDataType_BooleanDb dtBooleanDb;
sev_sDataType_BooleanHtDb dtBooleanHtDb;
sev_sDataType_Int8 dtInt8;
sev_sDataType_Int8Ht dtInt8Ht;
sev_sDataType_Int8Db dtInt8Db;
sev_sDataType_Int8HtDb dtInt8HtDb;
sev_sDataType_Int16 dtInt16;
sev_sDataType_Int16Ht dtInt16Ht;
sev_sDataType_Int16Db dtInt16Db;
sev_sDataType_Int16HtDb dtInt16HtDb;
sev_sDataType_Int32 dtInt32;
sev_sDataType_Int32Ht dtInt32Ht;
sev_sDataType_Int32Db dtInt32Db;
sev_sDataType_Int32HtDb dtInt32HtDb;
sev_sDataType_Int64 dtInt64;
sev_sDataType_Int64Ht dtInt64Ht;
sev_sDataType_Int64Db dtInt64Db;
sev_sDataType_Int64HtDb dtInt64HtDb;
sev_sDataType_UInt8 dtUInt8;
sev_sDataType_UInt8Ht dtUInt8Ht;
sev_sDataType_UInt8Db dtUInt8Db;
sev_sDataType_UInt8HtDb dtUInt8HtDb;
sev_sDataType_UInt16 dtUInt16;
sev_sDataType_UInt16Ht dtUInt16Ht;
sev_sDataType_UInt16Db dtUInt16Db;
sev_sDataType_UInt16HtDb dtUInt16HtDb;
sev_sDataType_UInt32 dtUInt32;
sev_sDataType_UInt32Ht dtUInt32Ht;
sev_sDataType_UInt32Db dtUInt32Db;
sev_sDataType_UInt32HtDb dtUInt32HtDb;
sev_sDataType_UInt64 dtUInt64;
sev_sDataType_UInt64Ht dtUInt64Ht;
sev_sDataType_UInt64Db dtUInt64Db;
sev_sDataType_UInt64HtDb dtUInt64HtDb;
sev_sDataType_Float32 dtFloat32;
sev_sDataType_Float32Ht dtFloat32Ht;
sev_sDataType_Float32Db dtFloat32Db;
sev_sDataType_Float32HtDb dtFloat32HtDb;
sev_sDataType_Float64 dtFloat64;
sev_sDataType_Float64Ht dtFloat64Ht;
sev_sDataType_Float64Db dtFloat64Db;
sev_sDataType_Float64HtDb dtFloat64HtDb;
sev_sDataType_Time dtTime;
sev_sDataType_TimeHt dtTimeHt;
sev_sDataType_TimeDb dtTimeDb;
sev_sDataType_TimeHtDb dtTimeHtDb;
sev_sDataType_DeltaTime dtDeltaTime;
sev_sDataType_DeltaTimeHt dtDeltaTimeHt;
sev_sDataType_DeltaTimeDb dtDeltaTimeDb;
sev_sDataType_DeltaTimeHtDb dtDeltaTimeHtDb;
sev_sDataType_String8 dtString8;
sev_sDataType_String8Ht dtString8Ht;
sev_sDataType_String8Db dtString8Db;
sev_sDataType_String8HtDb dtString8HtDb;
sev_sDataType_String16 dtString16;
sev_sDataType_String16Ht dtString16Ht;
sev_sDataType_String16Db dtString16Db;
sev_sDataType_String16HtDb dtString16HtDb;
sev_sDataType_String32 dtString32;
sev_sDataType_String32Ht dtString32Ht;
sev_sDataType_String32Db dtString32Db;
sev_sDataType_String32HtDb dtString32HtDb;
sev_sDataType_String40 dtString40;
sev_sDataType_String40Ht dtString40Ht;
sev_sDataType_String40Db dtString40Db;
sev_sDataType_String40HtDb dtString40HtDb;
sev_sDataType_String80 dtString80;
sev_sDataType_String80Ht dtString80Ht;
sev_sDataType_String80Db dtString80Db;
sev_sDataType_String80HtDb dtString80HtDb;
sev_sDataType_String132 dtString132;
sev_sDataType_String132Ht dtString132Ht;
sev_sDataType_String132Db dtString132Db;
sev_sDataType_String132HtDb dtString132HtDb;
sev_sDataType_String256 dtString256;
sev_sDataType_String256Ht dtString256Ht;
sev_sDataType_String256Db dtString256Db;
sev_sDataType_String256HtDb dtString256HtDb;
} sev_uDataType;
class sev_dbhdf5 : public sev_db {
public:
static const unsigned int constMaxColNameLength = 64;
static const unsigned int m_cItemsInitSize = 50;
static const unsigned int m_cItemsExtendSize = 50;
hid_t m_file;
hid_t m_item_mtype;
hid_t m_objectitem_mtype;
hid_t m_objectattributes_mtype;
hid_t m_event_mtype;
hid_t m_stat_mtype;
hid_t m_header_mtype;
hid_t m_value_mtype[sev_eDataType__];
sev_sCmn m_cmn;
sev_dbhdf5() { memset(&m_cmn,0,sizeof(m_cmn)); memset(m_value_mtype, 0, sizeof(m_value_mtype));}
~sev_dbhdf5();
int open_db();
int check_item( pwr_tStatus *sts, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, pwr_eType type, unsigned int size,
char *description, char *unit, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx);
int add_item( pwr_tStatus *sts, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, pwr_eType type, unsigned int size,
char *description, char *unit, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx);
int store_value( pwr_tStatus *sts, int item_idx, int attr_idx,
pwr_tTime time, void *buf, unsigned int size);
int get_values( pwr_tStatus *sts, pwr_tOid oid, pwr_tMask options, float deadband, char *aname,
pwr_eType type, unsigned int size, pwr_tFloat32 scantime, pwr_tTime *creatime,
pwr_tTime *starttime,
pwr_tTime *endtime, int maxsize, pwr_tTime **tbuf, void **vbuf, unsigned int *bsize);
int delete_old_data( pwr_tStatus *sts, char *tablename,
pwr_tMask options, pwr_tTime limit, pwr_tFloat32 scantime, pwr_tFloat32 garbagecycle);
int delete_item( pwr_tStatus *sts, pwr_tOid oid, char *aname);
int get_items( pwr_tStatus *sts);
int store_item( pwr_tStatus *sts, char *tabelname, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, pwr_eType vtype, unsigned int vsize,
char *description, char *unit, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx);
int update_item( sev_item *item);
int remove_item( pwr_tStatus *sts, pwr_tOid oid, char *aname);
static sev_db *open_database();
static char *oid_to_table( pwr_tOid oid, char *aname);
int check_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx);
int add_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx);
int store_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx);
int create_objecttable( pwr_tStatus *sts, char *tablename, pwr_tMask options, float deadband,
pwr_tDeltaTime storage_time, pwr_tFloat32 scantime,
unsigned int attrnum, sev_sHistAttr *attr);
int store_objectvalue( pwr_tStatus *sts, int item_idx, int attr_idx,
pwr_tTime time, void *buf, void *oldbuf, unsigned int size);
int get_item( pwr_tStatus *sts, sev_item *item, pwr_tOid oid, char *attributename);
int get_item( pwr_tStatus *sts, unsigned int *idx, pwr_tOid oid, char *attributename);
int get_objectitem( pwr_tStatus *sts, sev_item *item, pwr_tOid oid, char *attributename);
int get_objectitems( pwr_tStatus *sts);
int get_objectitemattributes( pwr_tStatus *sts, sev_item *item, char *tablename);
int check_objectitemattr( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *aname, char *oname,
pwr_eType type, unsigned int size, unsigned int *idx);
int delete_old_objectdata( pwr_tStatus *sts, char *tablename,
pwr_tMask options, pwr_tTime limit, pwr_tFloat32 scantime, pwr_tFloat32 garbagecycle);
int check_deadband(pwr_eType type, unsigned int size, pwr_tFloat32 deadband, void *value, void *oldvalue);
int get_objectvalues( pwr_tStatus *sts, sev_item *item, unsigned int size, pwr_tTime *starttime, pwr_tTime *endtime,
int maxsize, pwr_tTime **tbuf, void **vbuf, unsigned int *bsize);
int delete_event_table( pwr_tStatus *sts, char *tablename);
int create_event_table( pwr_tStatus *sts, char *tablename, pwr_tMask options,
pwr_tDeltaTime storage_time, pwr_tFloat32 scantime);
int store_event( pwr_tStatus *sts, int item_idx, sev_event *ep);
int checkAndUpdateVersion(unsigned int version);
int create_table( pwr_tStatus *sts, char *tablename, pwr_eType type,
unsigned int size, pwr_tMask options, float deadband,
pwr_tDeltaTime storage_time, pwr_tFloat32 scantime);
int delete_table( pwr_tStatus *sts, char *tablename);
int handle_objectchange(pwr_tStatus *sts, char *tablename, unsigned int item_idx, bool newObject);
int handle_itemchange(pwr_tStatus *sts, char *tablename, unsigned int item_idx);
int store_stat( sev_sStat *stat);
int create_db( char *dbname);
int create_types();
int read_cmn();
int write_cmn();
int items_extend();
int objectitems_extend();
int objectitemattr_extend();
sev_eDataType get_datatype( pwr_eType type, pwr_tMask options, unsigned int size);
int get_mdatatype( sev_eDataType type, unsigned int size, hid_t *mtype);
int get_fdatatype( sev_eDataType type, unsigned int size, hid_t *ftype);
void free_mdatatype();
int time_to_idx( hid_t dataset_id, hid_t memspace_id, hid_t dataspace_id,
hid_t mtype, unsigned int stime, int size, int low_idx, int high_idx, unsigned int low_time,
unsigned int high_time, int resolution, unsigned int prev_time, int *iter, int *ridx);
int get_time( hid_t dataset_id, hid_t memspace_id, hid_t dataspace_id,
hid_t mtype, int idx, unsigned int *time);
int get_objectitem_datatype( int item_idx, hid_t *atype, unsigned int *size, int *value_offset);
};
#endif
#endif
......@@ -2246,9 +2246,10 @@ char *sev_dbms::pwrtype_to_type( pwr_eType type, unsigned int size)
int sev_dbms::check_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx)
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx)
{
char timestr[40];
pwr_tTime uptime;
......@@ -2303,9 +2304,10 @@ int sev_dbms::check_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid,
}
int sev_dbms::add_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx)
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx)
{
store_objectitem( sts, tablename, oid, oname, aname, storagetime, description,
......
......@@ -163,12 +163,14 @@ class sev_dbms : public sev_db {
static int timestr_to_time( char *tstr, pwr_tTime *ts);
int check_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx);
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx);
int add_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx);
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx);
int store_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options);
......
......@@ -1887,9 +1887,10 @@ char *sev_dbsqlite::pwrtype_to_type( pwr_eType type, unsigned int size)
int sev_dbsqlite::check_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx)
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx)
{
char timestr[40];
pwr_tTime uptime;
......@@ -1946,9 +1947,10 @@ int sev_dbsqlite::check_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid
}
int sev_dbsqlite::add_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx)
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx)
{
store_objectitem( sts, tablename, oid, oname, aname, storagetime, description,
......
......@@ -100,13 +100,15 @@ class sev_dbsqlite : public sev_db {
char *pwrtype_to_type( pwr_eType type, unsigned int size);
static int timestr_to_time( char *tstr, pwr_tTime *ts);
int check_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx);
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx);
int add_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int *idx);
pwr_tDeltaTime storagetime,
char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options, unsigned int attrnum,
sev_sHistAttr *attr, unsigned int *idx);
int store_objectitem( pwr_tStatus *sts, char *tablename, pwr_tOid oid, char *oname, char *aname,
pwr_tDeltaTime storagetime, char *description, pwr_tFloat32 scantime,
pwr_tFloat32 deadband, pwr_tMask options);
......
......@@ -996,7 +996,8 @@ int rt_sevhistmon::send_itemlist( pwr_tNid nid)
m_sevhistevents->description,
sizeof(((sev_sMsgHistItems *)put.data)->Items[0].description));
strcpy( ((sev_sMsgHistItems *)put.data)->Items[k].attr[0].unit, "");
((sev_sMsgHistItems *)put.data)->Items[k].scantime = 0;
// Put the table size in scan time. Only used for hdf5 databases.
((sev_sMsgHistItems *)put.data)->Items[k].scantime = m_sevhistevents->table_size;
k++;
}
......@@ -1352,6 +1353,7 @@ int rt_sevhistmon::init_events()
h->storagetime = h->hsp->StorageTime;
h->options = h->hsp->Options;
h->table_size = h->hsp->TableSize;
strcpy( h->description, h->hsp->Description);
h->disabled = h->hsp->Disable;
h->event_thread_idx = hs_idx;
......
......@@ -77,6 +77,7 @@ class sev_sevhistevents {
pwr_tRefId hs_refid;
pwr_tDeltaTime storagetime;
pwr_tMask options;
pwr_tUInt32 table_size;
pwr_tBoolean disabled;
unsigned int event_thread_idx;
sev_sEvent event_buffer[20];
......
......@@ -50,6 +50,7 @@ exportfile <Unable to open export file> /error
repair_failed <Repair failed> /error
nyi <Not yet implemented> /error
nopoints <No points found in this interval> /error
nosuchattr <No such attribute exist> /error
.end
......
......@@ -458,6 +458,8 @@ else
pwre_config_check_lib mysql MYSQL lib lib 1 "/usr/lib/libmysqlclient.so:/usr/lib/mysql/libmysqlclient.so:/usr/lib/$hwpl-linux-$gnu/libmysqlclient.so"
pwre_config_check_include sqlite3 SQLITE3 1 "/usr/include/sqlite3.h"
pwre_config_check_lib libsqlite3 LIBSQLITE3 lib lib 0 "/usr/lib/libsqlite3.so:/usr/lib/$hwpl-linux-$gnu/libsqlite3.so"
pwre_config_check_include hdf5 HDF5 1 "/usr/lib/openmpi/include/mpi.h"
pwre_config_check_lib libhdf5 LIBHDF5 lib lib 0 "/usr/lib/libhdf5.so:/usr/lib/$hwpl-linux-$gnu/libhdf5.so"
pwre_config_check_lib mq MQ lib mq 1 "/usr/lib/libdmq.so:/usr/local/dmq/lib/libdmq.so"
pwre_config_check_lib wmq WMQ lib wmq 1 "/usr/lib/libmqic.so"
pwre_config_check_lib libpnioif PNAK lib pnak 1 "/usr/lib/libpnioif.a:/usr/local/lib/libpnioif.a"
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_a_sevstatistics.wb_load -- Defines the class SevStatistics.
!
SObject pwrb:Class
!/**
! @Version 1.0
! Displays sev server statistics.
!
! @b See also
! @classlink SevServer pwrb_sevserver.html
!*/
Object SevStatistics $ClassDef 657
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "SevStatistics"
EndBody
!/**
! Current load in percentage.
!*/
Object CurrentLoad $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Medium load in percentage.
!*/
Object MediumLoad $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Storage rate. Values per second.
!*/
Object StorageRate $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Medium storage rate. Values per second.
!*/
Object MediumStorageRate $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Data store message count.
!*/
Object DataStoreMsgCnt $Attribute 5
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Data get message count.
!*/
Object DataGetMsgCnt $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Items message count.
!*/
Object ItemsMsgCnt $Attribute 7
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Event store message count.
!*/
Object EventStoreMsgCnt $Attribute 8
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
EndObject
EndObject
EndSObject
......@@ -134,11 +134,20 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Size of event table. Only used for hdf5 databases.
!*/
Object TableSize $Attribute 9
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
Object Template SevHistEvents
Body RtBody
Attr EventTypes = 3
Attr Options = 0
Attr TableSize = 10000
EndBody
EndObject
Object PostCreate $DbCallBack
......
......@@ -81,6 +81,15 @@ SObject pwrb:Class
Attr TypeRef = "pwrb:Type-SevDatabaseEnum"
EndBody
EndObject
!/**
! Statistics.
!*/
Object Stat $Attribute 3
Body SysBody
Attr TypeRef = "pwrb:Class-SevStatistics"
Attr Flags |= PWR_MASK_CLASS
EndBody
EndObject
EndObject
EndObject
EndSObject
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