Commit ce055179 authored by Claes Sjofors's avatar Claes Sjofors

Sev import added

parent 53b70588
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
ifndef link_rule_mk
link_rule_mk := 1
ifndef pwre_cxx
ifeq ($(PWRE_CONF_LIBHDF5),1)
ldsev = mpic++
else
ldsev = $(ldxx)
endif
else
ldsev = $(pwre_cxx)
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)
endif
This diff is collapsed.
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. 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
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR 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 ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#ifndef sev_import_h
#define sev_import_h
#include <vector>
#include "rt_que.h"
#include "rt_sev_net.h"
class sev_import;
class sev_node {
public:
pwr_tNodeId nid;
char name[80];
};
typedef struct {
tree_sNode node;
pwr_tRefId id;
int idx;
} sev_sRefid;
class sev_exportitem {
public:
sev_exportitem();
sev_exportitem(const sev_exportitem& x);
~sev_exportitem() {}
pwr_tOid oid;
pwr_tOName oname;
pwr_tOName aname;
pwr_eType type;
unsigned int size;
unsigned int elem;
pwr_tDlid refid;
pwr_tRefId sevid;
pwr_tString80 description;
pwr_tFloat32 scantime;
pwr_tMask options;
unsigned int idx;
pwr_sClass_SevExpItem* ip;
int deleted;
pwr_tFloat32 mean_value;
pwr_tFloat32 mean_acc_time;
pwr_tFloat32 variance_acc;
int variance_cnt;
};
class sev_import {
public:
sev_import()
: m_refid(0), m_msg_id(0), m_config(0) {}
~sev_import();
pwr_tStatus m_sts;
pwr_tStatus m_import_status;
std::vector<sev_node> m_nodes;
tree_sTable* m_refid;
unsigned int m_msg_id;
pwr_tStatus m_server_status;
pwr_sClass_SevServer* m_config;
pwr_tDlid m_config_dlid;
std::vector<sev_exportitem> m_items;
int init(void);
int connect(void);
int request_items(pwr_tNid nid);
int mainloop(void);
int check_exportitems(sev_sMsgExportItems* msg, unsigned int size);
int tree_update(void);
int receive_exportdata( sev_sMsgExportData* msg, unsigned int size,
pwr_tNid nid);
int store_value(int item_idx, pwr_tTime time, void *buf, int size);
};
#endif
......@@ -263,8 +263,10 @@ int sev_server::init(int noneth)
m_nodes.push_back(n);
}
if (!m_noneth)
if (!m_noneth) {
m_sts = m_db->tree_update();
m_sts = gdh_MountDynClients();
}
if (m_read_threads)
create_garbage_collector_thread();
......
......@@ -47,13 +47,14 @@
#include "sev_dbsqlite.h"
#include "sev_dbhdf5.h"
sev_attr::sev_attr() : type(pwr_eType_), size(0), elem(0)
sev_attr::sev_attr() : type(pwr_eType_), size(0), elem(0), ip(0), refid(pwr_cNRefId)
{
strcpy(aname, "");
strcpy(unit, "");
}
sev_attr::sev_attr(const sev_attr& x) : type(x.type), size(x.size), elem(x.elem)
sev_attr::sev_attr(const sev_attr& x) : type(x.type), size(x.size), elem(x.elem),
ip(x.ip), refid(x.refid)
{
strncpy(aname, x.aname, sizeof(aname));
strncpy(unit, x.unit, sizeof(unit));
......@@ -62,7 +63,7 @@ sev_attr::sev_attr(const sev_attr& x) : type(x.type), size(x.size), elem(x.elem)
sev_item::sev_item()
: deadband_active(0), last_id(0), value_size(0), old_value(0),
first_storage(1), status(0), logged_status(0), cache(0), idx(0),
deleted(0), ip(0), mean_value(0), mean_acc_time(0), variance_acc(0),
deleted(0), mean_value(0), mean_acc_time(0), variance_acc(0),
variance_cnt(0)
{
/*memset( old_value, 0, sizeof(old_value));*/
......@@ -76,7 +77,7 @@ sev_item::sev_item(const sev_item& x)
value_size(x.value_size), old_value(x.old_value),
first_storage(x.first_storage), attrnum(x.attrnum), attr(x.attr),
status(x.status), logged_status(x.logged_status), cache(0), idx(x.idx),
deleted(x.deleted), ip(x.ip), mean_value(x.mean_value),
deleted(x.deleted), mean_value(x.mean_value),
mean_acc_time(x.mean_acc_time), variance_cnt(x.variance_cnt)
{
strncpy(tablename, x.tablename, sizeof(tablename));
......
......@@ -41,6 +41,7 @@
#include "pwr_class.h"
#include "pwr_baseclasses.h"
#include "pwr_sevclasses.h"
#include "rt_mh_net.h"
#include "rt_sev_net.h"
......@@ -107,6 +108,8 @@ public:
unsigned int size;
unsigned int elem;
pwr_tString16 unit;
pwr_sClass_SevItem* ip;
pwr_tDlid refid;
};
class sev_event {
......@@ -150,8 +153,6 @@ public:
sev_valuecache* cache;
unsigned int idx;
int deleted;
pwr_sClass_SevItem* ip;
pwr_tDlid refid;
pwr_tFloat32 mean_value;
pwr_tFloat32 mean_acc_time;
pwr_tFloat32 variance_acc;
......@@ -169,7 +170,7 @@ public:
virtual ~sev_db();
pwr_tStatus tree_update();
pwr_tStatus tree_update_value(int item_idx, pwr_tTime time, void* buf);
pwr_tStatus tree_update_value(int item_idx, int attr_idx, pwr_tTime time, void* buf);
void get_item_idx(pwr_tStatus* sts, unsigned int* item_idx, pwr_tOid oid,
char* attributename);
......
......@@ -45,14 +45,15 @@ pwr_tStatus sev_db::tree_update()
{
int new_item = 0;
int num;
int onum;
pwr_tAName hname;
pwr_tAName aname;
pwr_tStatus sts;
pwr_tOid oid;
pwr_tCid cid = 0;
char* s;
pwr_sClass_SevItem ritem;
char oname_array[20][pwr_cSizObjName + 1];
pwr_tObjName itemname;
char root[] = "pwrNode-sev";
// Check root object
......@@ -68,8 +69,10 @@ pwr_tStatus sev_db::tree_update()
if (m_items[i].deleted)
continue;
printf("Tree update item %s\n", m_items[i].oname);
switch (m_items[i].attr[0].type) {
for (unsigned int j = 0; j < m_items[i].attrnum; j++) {
printf("Tree update item %s.%s\n", m_items[i].oname, m_items[i].attr[j].aname);
switch (m_items[i].attr[j].type) {
case pwr_eType_Float32:
case pwr_eType_Float64:
case pwr_eType_Int8:
......@@ -81,6 +84,8 @@ pwr_tStatus sev_db::tree_update()
case pwr_eType_UInt32:
case pwr_eType_UInt64:
case pwr_eType_Boolean:
case pwr_eType_Time:
case pwr_eType_String:
break;
default:
continue;
......@@ -93,37 +98,52 @@ pwr_tStatus sev_db::tree_update()
else
s = m_items[i].oname;
num = dcli_parse(s, "-", "", (char*)oname_array,
strcpy(aname, s);
strcat(aname, ".");
strcat(aname, m_items[i].attr[j].aname);
onum = dcli_parse(aname, "-", "", (char*)oname_array,
sizeof(oname_array) / sizeof(oname_array[0]), sizeof(oname_array[0]),
0);
num = dcli_parse(aname, "-.", "", (char*)oname_array,
sizeof(oname_array) / sizeof(oname_array[0]), sizeof(oname_array[0]),
0);
strcpy(hname, root);
for (int j = 0; j < num; j++) {
for (int k = 0; k < num - 1; k++) {
strcat(hname, "-");
strcat(hname, oname_array[j]);
strcat(hname, oname_array[k]);
if (!new_item)
sts = gdh_NameToObjid(hname, &oid);
if (new_item || EVEN(sts)) {
// Create object
sts = gdh_CreateObject(
hname, pwr_eClass_NodeHier, 0, &oid, pwr_cNObjid, 0, pwr_cNObjid);
if (k < onum - 1)
cid = pwr_eClass_NodeHier;
else if (k == onum - 1)
cid = pwr_eClass_Block;
else
cid = pwr_eClass_SubBlock;
sts = gdh_CreateObject(hname, cid, 0, &oid, pwr_cNObjid,
0, pwr_cNObjid);
if (EVEN(sts))
return sts;
new_item = 1;
}
}
sprintf(itemname, "%sItem", m_items[i].attrnum > 1 ? "O" : "");
strcat(hname, "-");
strcat(hname, itemname);
strcat(hname, oname_array[num - 1]);
if (!new_item)
sts = gdh_NameToObjid(hname, &oid);
if (new_item || EVEN(sts)) {
switch (m_items[i].attr[0].type) {
switch (m_items[i].attr[j].type) {
case pwr_eType_Float32:
cid = pwr_cClass_SevItemFloat32;
break;
case pwr_eType_Float64:
cid = pwr_cClass_SevItemFloat;
cid = pwr_cClass_SevItemFloat64;
break;
case pwr_eType_Int8:
case pwr_eType_Int16:
......@@ -132,12 +152,20 @@ pwr_tStatus sev_db::tree_update()
case pwr_eType_UInt8:
case pwr_eType_UInt16:
case pwr_eType_UInt32:
cid = pwr_cClass_SevItemInt32;
break;
case pwr_eType_UInt64:
cid = pwr_cClass_SevItemInt;
cid = pwr_cClass_SevItemInt64;
break;
case pwr_eType_Boolean:
cid = pwr_cClass_SevItemBoolean;
break;
case pwr_eType_Time:
cid = pwr_cClass_SevItemTime;
break;
case pwr_eType_String:
cid = pwr_cClass_SevItemString80;
break;
default:;
}
sts = gdh_CreateObject(hname, cid, 0, &oid, pwr_cNObjid, 0, pwr_cNObjid);
......@@ -147,8 +175,8 @@ pwr_tStatus sev_db::tree_update()
memset(&ritem, 0, sizeof(ritem));
strncpy(ritem.TableName, m_items[i].tablename, sizeof(ritem.TableName));
strncpy(ritem.ObjectName, m_items[i].oname, sizeof(ritem.ObjectName));
strncpy(ritem.Attr, m_items[i].attr[0].aname, sizeof(ritem.Attr));
ritem.AttrType = m_items[i].attr[0].type;
strncpy(ritem.Attr, m_items[i].attr[j].aname, sizeof(ritem.Attr));
ritem.AttrType = m_items[i].attr[j].type;
ritem.NoOfAttr = m_items[i].attrnum;
ritem.Oid = m_items[i].oid;
ritem.Id = m_items[i].id;
......@@ -164,71 +192,91 @@ pwr_tStatus sev_db::tree_update()
return sts;
}
if (!m_items[i].ip) {
if (!m_items[i].attr[j].ip) {
// Get pointer to object
pwr_tAttrRef aref = cdh_ObjidToAref(oid);
sts = gdh_DLRefObjectInfoAttrref(
&aref, (void**)&m_items[i].ip, &m_items[i].refid);
&aref, (void**)&m_items[i].attr[j].ip, &m_items[i].attr[j].refid);
if (EVEN(sts))
return sts;
}
}
}
return SEV__SUCCESS;
}
pwr_tStatus sev_db::tree_update_value(int item_idx, pwr_tTime time, void* buf)
pwr_tStatus sev_db::tree_update_value(int item_idx, int attr_idx, pwr_tTime time,
void* buf)
{
float value;
pwr_tTime prev_time;
float interval = 0;
if (!m_items[item_idx].ip)
if (!m_items[item_idx].attr[attr_idx].ip)
return SEV__SUCCESS;
m_items[item_idx].ip->ReceiveCount++;
if (m_items[item_idx].ip->ReceiveCount == 0)
m_items[item_idx].attr[attr_idx].ip->ReceiveCount++;
if (m_items[item_idx].attr[attr_idx].ip->ReceiveCount == 0)
// Wrap around, reset write count
m_items[item_idx].ip->WriteCount = 0;
m_items[item_idx].attr[attr_idx].ip->WriteCount = 0;
else
m_items[item_idx].ip->WriteQuota
= (pwr_tFloat32)m_items[item_idx].ip->WriteCount
/ m_items[item_idx].ip->ReceiveCount * 100;
m_items[item_idx].attr[attr_idx].ip->WriteQuota
= (pwr_tFloat32)m_items[item_idx].attr[attr_idx].ip->WriteCount
/ m_items[item_idx].attr[attr_idx].ip->ReceiveCount * 100;
prev_time = m_items[item_idx].ip->LastTime;
m_items[item_idx].ip->LastTime = time;
prev_time = m_items[item_idx].attr[attr_idx].ip->LastTime;
m_items[item_idx].attr[attr_idx].ip->LastTime = time;
switch (m_items[item_idx].attr[0].type) {
switch (m_items[item_idx].attr[attr_idx].type) {
case pwr_eType_Float32:
((pwr_sClass_SevItemFloat*)m_items[item_idx].ip)->LastValue
((pwr_sClass_SevItemFloat32*)m_items[item_idx].attr[attr_idx].ip)->Value
= *(pwr_tFloat32*)buf;
value = ((pwr_sClass_SevItemFloat*)m_items[item_idx].ip)->LastValue;
value = ((pwr_sClass_SevItemFloat32*)m_items[item_idx].attr[attr_idx].ip)->Value;
break;
case pwr_eType_Float64:
((pwr_sClass_SevItemFloat*)m_items[item_idx].ip)->LastValue
((pwr_sClass_SevItemFloat64*)m_items[item_idx].attr[attr_idx].ip)->Value
= *(pwr_tFloat64*)buf;
value = ((pwr_sClass_SevItemFloat*)m_items[item_idx].ip)->LastValue;
value = ((pwr_sClass_SevItemFloat64*)m_items[item_idx].attr[attr_idx].ip)->Value;
break;
case pwr_eType_Int32:
case pwr_eType_UInt32:
((pwr_sClass_SevItemInt*)m_items[item_idx].ip)->LastValue
((pwr_sClass_SevItemInt32*)m_items[item_idx].attr[attr_idx].ip)->Value
= *(pwr_tInt32*)buf;
value = ((pwr_sClass_SevItemInt*)m_items[item_idx].ip)->LastValue;
value = ((pwr_sClass_SevItemInt32*)m_items[item_idx].attr[attr_idx].ip)->Value;
break;
case pwr_eType_Int64:
case pwr_eType_UInt64:
((pwr_sClass_SevItemInt64*)m_items[item_idx].attr[attr_idx].ip)->Value
= *(pwr_tInt64*)buf;
value = ((pwr_sClass_SevItemInt64*)m_items[item_idx].attr[attr_idx].ip)->Value;
break;
case pwr_eType_Int16:
case pwr_eType_UInt16:
((pwr_sClass_SevItemInt*)m_items[item_idx].ip)->LastValue
((pwr_sClass_SevItemInt32*)m_items[item_idx].attr[attr_idx].ip)->Value
= *(pwr_tInt16*)buf;
value = ((pwr_sClass_SevItemInt*)m_items[item_idx].ip)->LastValue;
value = ((pwr_sClass_SevItemInt32*)m_items[item_idx].attr[attr_idx].ip)->Value;
break;
case pwr_eType_Int8:
case pwr_eType_UInt8:
((pwr_sClass_SevItemInt*)m_items[item_idx].ip)->LastValue
((pwr_sClass_SevItemInt32*)m_items[item_idx].attr[attr_idx].ip)->Value
= *(pwr_tInt8*)buf;
value = ((pwr_sClass_SevItemInt*)m_items[item_idx].ip)->LastValue;
value = ((pwr_sClass_SevItemInt32*)m_items[item_idx].attr[attr_idx].ip)->Value;
break;
case pwr_eType_Boolean:
((pwr_sClass_SevItemBoolean*)m_items[item_idx].ip)->LastValue
((pwr_sClass_SevItemBoolean*)m_items[item_idx].attr[attr_idx].ip)->Value
= *(pwr_tBoolean*)buf;
value = ((pwr_sClass_SevItemInt*)m_items[item_idx].ip)->LastValue;
value = ((pwr_sClass_SevItemBoolean*)m_items[item_idx].attr[attr_idx].ip)->Value;
break;
case pwr_eType_Time:
((pwr_sClass_SevItemTime*)m_items[item_idx].attr[attr_idx].ip)->Value
= *(pwr_tTime*)buf;
value = 0;
break;
case pwr_eType_String:
strncpy(((pwr_sClass_SevItemString80*)m_items[item_idx].attr[attr_idx].ip)->Value,
(const char *)buf, 80);
((pwr_sClass_SevItemString80*)m_items[item_idx].attr[attr_idx].ip)->Value[79] = 0;
value = 0;
break;
default:
return 0;
......@@ -263,14 +311,14 @@ pwr_tStatus sev_db::tree_update_value(int item_idx, pwr_tTime time, void* buf)
if (m_items[item_idx].mean_acc_time
>= (interval - m_items[item_idx].scantime / 2)) {
m_items[item_idx].ip->MeanValue = m_items[item_idx].mean_value;
m_items[item_idx].ip->MeanValueTime = time;
m_items[item_idx].attr[attr_idx].ip->MeanValue = m_items[item_idx].mean_value;
m_items[item_idx].attr[attr_idx].ip->MeanValueTime = time;
if (m_items[item_idx].variance_cnt > 1)
m_items[item_idx].ip->StandardDeviation
m_items[item_idx].attr[attr_idx].ip->StandardDeviation
= sqrt(m_items[item_idx].variance_acc
/ (m_items[item_idx].variance_cnt - 1));
else
m_items[item_idx].ip->StandardDeviation = 0;
m_items[item_idx].attr[attr_idx].ip->StandardDeviation = 0;
m_items[item_idx].mean_acc_time = 0;
m_items[item_idx].variance_acc = 0;
m_items[item_idx].variance_cnt = 0;
......
......@@ -511,7 +511,7 @@ int sev_dbms_env::createSevVersion2Tables(void)
"attributeidx int unsigned not null,"
"attributetype int unsigned not null,"
"attributesize int unsigned not null,"
"PRIMARY KEY(tablename, attributename));");
"PRIMARY KEY(tablename, attributename)) default charset=utf8;");
rc = mysql_query(m_con, query);
if (rc) {
......@@ -1172,7 +1172,7 @@ int sev_dbms::store_value(pwr_tStatus* sts, void* thread, int item_idx,
else
con = m_env->con();
tree_update_value(item_idx, time, buf);
tree_update_value(item_idx, attr_idx, time, buf);
if (m_items[item_idx].options & pwr_mSevOptionsMask_DeadBandLinearRegr) {
void* value;
......@@ -1703,8 +1703,8 @@ int sev_dbms::write_value(pwr_tStatus* sts, int item_idx, int attr_idx,
*sts = SEV__SUCCESS;
if (m_items[item_idx].ip)
m_items[item_idx].ip->WriteCount++;
if (m_items[item_idx].attr[0].ip)
m_items[item_idx].attr[0].ip->WriteCount++;
m_items[item_idx].status = *sts;
m_items[item_idx].logged_status = 1;
return 1;
......@@ -3371,6 +3371,8 @@ int sev_dbms::store_objectvalue(pwr_tStatus* sts, void* thread, int item_idx,
memcpy(oldbuf, buf, size);
for (size_t i = 0; i < m_items[item_idx].attr.size(); i++) {
tree_update_value(item_idx, i, time, buf);
if (m_items[item_idx].attr[i].type == pwr_eType_Time)
*sts = time_AtoAscii((pwr_tTime*)buf, time_eFormat_NumDateAndTime,
bufstr, sizeof(bufstr));
......
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include ../../special.mk
-include ../special.mk
-include special.mk
#include "pwr_baseclasses.hpp"
This diff is collapsed.
......@@ -3715,6 +3715,12 @@ mysql should be used, and that tables should be created with engine innodb
Install mysql-server on the storage station, and add the mysql user pwrp
For MariaDb:
<c>> mysql
<c>MariaDB> create user pwrp@localhost;
<c>MariaDB> grant all privileges on *.* to pwrp@localhost;
For mysql:
<c>> mysql
<c>mysql> grant all privileges on *.* to pwrp@localhost;
......
......@@ -3676,6 +3676,12 @@ att mysql ska anv
Installera mysql-server på lagringstationen och addera användaren pwrp i mysql
För MariaDb:
<c>> mysql
<c>MariaDB> create user pwrp@localhost;
<c>MariaDB> grant all privileges on *.* to pwrp@localhost;
För mysql:
<c>> mysql
<c>mysql> grant all privileges on *.* to pwrp@localhost;
......
......@@ -104,6 +104,9 @@ int CnvWblToH::init(char* first)
<< "#ifndef pwr_class_h\n"
<< "#include \"pwr_class.h\"\n"
<< "#endif\n"
<< "#ifndef pwr_systemclasses_h\n"
<< "#include \"pwr_systemclasses.h\"\n"
<< "#endif\n"
<< '\n'
<< '\n';
......@@ -801,7 +804,12 @@ int CnvWblToH::cixstr_to_classid(char* cix_str, pwr_tClassId* cid)
{ "pwr_eCix_ExternVolume", pwr_eCix_ExternVolume },
{ "pwr_eCix_Hier", pwr_eCix_Hier },
{ "pwr_eCix_Security", pwr_eCix_Security },
{ "pwr_eCix_ReferenceList", pwr_eCix_ReferenceList }, { "", 0 } };
{ "pwr_eCix_ReferenceList", pwr_eCix_ReferenceList },
{ "pwr_eCix_Block", pwr_eCix_Block },
{ "pwr_eCix_BlockAttribute", pwr_eCix_BlockAttribute },
{ "pwr_eCix_SubBlock", pwr_eCix_SubBlock },
{ "pwr_eCix_MountDynObject", pwr_eCix_MountDynObject },
{ "", 0 } };
found = 0;
for (cix_p = cix_array; !streq(cix_p->name, ""); cix_p++) {
......@@ -855,7 +863,9 @@ int CnvWblToH::check_typename(char* type_volume, char* type_name)
"pwr_tString32", "pwr_tString16", "pwr_tString8", "pwr_tString1",
"pwr_tText256", "pwr_tText1024", "pwr_tText8192", "pwr_tURL",
"pwr_tOpSysEnum", "pwr_tPrivMask", "pwr_tProString40", "pwr_tDataRef",
"pwr_tVoid", "pwr_tConfigStatusEnum", "pwr_tSafetyLevelEnum", "" };
"pwr_tVoid", "pwr_tConfigStatusEnum", "pwr_tSafetyLevelEnum", "pwr_tPgmName",
"pwr_tAdefFlags", "pwr_tObjName", "pwr_sClass_BlockAttribute",
"pwr_Class_BlockAttribute", "" };
for (name = valid_names[0]; !streq(name, "");
name += sizeof(valid_names[0])) {
......
This diff is collapsed.
......@@ -65,6 +65,30 @@ class sev_sevhist {
pwr_tBoolean disabled;
};
class sev_sevexport {
public:
pwr_tAttrRef aref;
pwr_tAName aname;
pwr_sClass_SevExport* hsp;
pwr_tRefId hs_refid;
pwr_tRefId refid;
void* datap;
pwr_tMask options;
pwr_eType type;
unsigned int size;
pwr_tRefId sevid;
pwr_tString80 description;
pwr_tFloat32 scantime;
pwr_tBoolean disabled;
sev_sevexport() {}
sev_sevexport(const sev_sevexport& x) : aref(x.aref), hsp(x.hsp), hs_refid(x.hs_refid),
refid(x.refid), datap(x.datap), options(x.options), type(x.type), size(x.size),
sevid(x.sevid), scantime(x.scantime), disabled(x.disabled) {
strcpy(aname, x.aname);
strcpy( description, x.description);
}
};
class sev_sevhistevents {
public:
sev_sevhistevents(rt_sevhistmon* m)
......@@ -137,6 +161,7 @@ class sev_sevhistthread {
int configerror;
std::vector<sev_sevhist> sevhistlist;
std::vector<sev_sevhistobject> sevhistobjectlist;
std::vector<sev_sevexport> sevexportlist;
};
class sev_node {
......@@ -179,12 +204,14 @@ class rt_sevhistmon {
int init_objects();
int init_sevhistobjects();
int init_events();
int init_sevexport();
void insert_sevhistobjectattr(pwr_sAttrRef* aref, pwr_tAName objectname,
int hs_idx, std::vector<sev_sevhistobjectattr>* listP);
int get_sevhistobjectattributes(pwr_tAName objectname,
std::vector<sev_sevhistobjectattr>* listP, int hs_idx,
pwr_tBoolean first);
bool correct_histtype(const pwr_eType type);
bool correct_exporttype(const pwr_eType type);
int close();
int close_objects();
int mainloop();
......@@ -197,6 +224,8 @@ class rt_sevhistmon {
void receive_server_status(sev_sMsgServerStatus* msg, pwr_tNid nid);
int send_itemlist(pwr_tNid nid);
int send_data();
int send_exportitemlist(pwr_tNid nid);
int send_exportdata();
void evbuf_insert(sev_sEvent* ev);
void evbuf_send();
static pwr_tStatus mh_ack_bc(mh_sAck* MsgP);
......
......@@ -109,10 +109,12 @@ typedef struct pwr_s_ExternVolume pwr_sExternVolume;
typedef struct pwr_s_CreateVolume pwr_sCreateVolume;
typedef struct pwr_s_MountVolume pwr_sMountVolume;
typedef struct pwr_s_MountObject pwr_sMountObject;
typedef struct pwr_s_MountDynObject pwr_sMountDynObject;
typedef struct pwr_s_Bit pwr_sBit;
typedef struct pwr_s_Value pwr_sValue;
typedef struct pwr_s_Method pwr_sMethod;
typedef struct pwr_s_Security pwr_sSecurity;
typedef struct pwr_s_BlockAttribute pwr_sBlockAttribute;
typedef union pwr_u_ParDef pwr_uParDef;
typedef union pwr_u_Volume pwr_uVolume;
......@@ -310,6 +312,10 @@ typedef enum {
pwr_eCix_Security = 68,
pwr_eCix_DetachedClassVolume = 69,
pwr_eCix_ReferenceList = 70,
pwr_eCix_Block = 71,
pwr_eCix_BlockAttribute = 72,
pwr_eCix_SubBlock = 73,
pwr_eCix_MountDynObject = 74,
pwr_eCix_
} pwr_eCix;
......@@ -384,6 +390,10 @@ typedef enum {
pwr_eClass_Security = pwr_ClassId(pwr_eCix_Security),
pwr_eClass_DetachedClassVolume = pwr_ClassId(pwr_eCix_DetachedClassVolume),
pwr_eClass_ReferenceList = pwr_ClassId(pwr_eCix_ReferenceList),
pwr_eClass_Block = pwr_ClassId(pwr_eCix_Block),
pwr_eClass_BlockAttribute = pwr_ClassId(pwr_eCix_BlockAttribute),
pwr_eClass_SubBlock = pwr_ClassId(pwr_eCix_SubBlock),
pwr_eClass_MountDynObject = pwr_ClassId(pwr_eCix_MountDynObject),
pwr_eClass_
} pwr_eClass;
......@@ -1220,6 +1230,11 @@ struct pwr_s_MountObject {
pwr_tObjid Object pwr_dAlignW;
};
struct pwr_s_MountDynObject {
pwr_tString80 Description pwr_dAlignLW;
pwr_tString256 Object pwr_dAlignW;
};
struct pwr_s_Security {
pwr_tMask DefaultWebPriv pwr_dAlignLW;
pwr_tMask DefaultXttPriv pwr_dAlignW;
......@@ -1227,6 +1242,10 @@ struct pwr_s_Security {
pwr_tString80 WebSystemGroup pwr_dAlignW;
};
struct pwr_s_BlockAttribute {
pwr_tUInt32 Elements pwr_dAlignLW;
};
union pwr_u_Volume {
pwr_sRootVolume Root;
pwr_sSubVolume Sub;
......
......@@ -6,6 +6,7 @@ remote 0.0.1.4
simul 0.0.0.8
miscellaneous 0.0.0.9
basecomponent 0.0.0.10
sev 0.0.0.11
profibus 0.0.250.7
opc 0.0.250.9
othermanufacturer 0.0.250.1
......
......@@ -57,6 +57,7 @@
#include "rt_sanc.h"
#include "rt_dl.h"
#include "rt_lck.h"
#include "pwr_baseclasses.h"
#if defined(OS_LINUX) || defined OS_MACOS
#define gdh_Lock \
......@@ -5262,6 +5263,51 @@ pwr_tStatus gdh_CheckLocalObject(pwr_tOid oid)
return GDH__SUCCESS;
}
pwr_tStatus gdh_TidToType(pwr_tTid tid, pwr_eType *type)
{
pwr_tOid oid = cdh_TypeIdToObjid(tid);
pwr_eType *p;
gdb_sObject *op;
pwr_tStatus sts = GDH__SUCCESS;
gdh_ScopeLock
{
op = vol_OidToObject(
&sts, oid, gdb_mLo_native, vol_mTrans_all, cvol_eHint_none);
if (op != NULL) {
p = (pwr_eType *)vol_ObjectToAddress(&sts, op);
if ( p != NULL)
*type = *p;
}
}
gdh_ScopeUnlock;
return sts;
}
pwr_tStatus gdh_MountDynClients(void)
{
gdb_sObject *op;
pwr_tOid oid;
pwr_tStatus sts = GDH__SUCCESS;
for (sts = gdh_GetClassList(pwr_eClass_MountDynObject, &oid);
ODD(sts);
sts = gdh_GetNextObject(oid, &oid)) {
gdh_ScopeLock
{
op = vol_OidToObject(&sts, oid, gdb_mLo_native, vol_mTrans_all,
cvol_eHint_none);
if (cdh_ObjidIsNull(op->g.soid))
vol_MountDynObject(&sts, op);
}
gdh_ScopeUnlock;
}
return sts;
}
/**
* @brief Thread save function to fetch a direct linked absolute time value.
* Sets the time lock to ensure that the time is not modified during
......
......@@ -388,7 +388,6 @@ void* gdh_TranslateRtdbPointer(unsigned long rtdbReference);
pwr_tStatus gdh_GetObjectBodyDef(
pwr_tCid cid, gdh_sAttrDef** bodydef, int* rows, pwr_tOid oid);
/** @} */
void gdh_InitialLoadDone(pwr_tObjid systemobject, pwr_tObjid nodeobject);
......@@ -436,6 +435,8 @@ pwr_tStatus gdh_GetLocalClassList(int cidcnt, pwr_tCid* cid, int attrobjects,
pwr_tAttrRef* classlist[], int* listcnt);
pwr_tStatus gdh_CheckLocalObject(pwr_tOid oid);
pwr_tStatus gdh_TidToType(pwr_tTid tid, pwr_eType *type);
pwr_tStatus gdh_MountDynClients(void);
/* Thread safe functions for times and strings */
void gdh_GetTimeDL(pwr_tTime* atp, pwr_tTime* time);
......
......@@ -150,6 +150,25 @@ static gdb_sVolume* mountVolume(pwr_tStatus* sts, gdb_sObject* op)
}
vp = vol_MountVolume(sts, soid.vid);
break;
case pwr_eClass_MountDynObject: {
cdh_sParseName parseName, *pn;
gdb_sObject* sop = NULL;
pn = cdh_ParseName(sts, &parseName, pwr_cNObjid, ((pwr_sMountDynObject*)p)->Object, 0);
if (pn == NULL)
return NULL;
sop = vol_NameToObject(sts, pn, gdb_mLo_global, vol_mTrans_all);
if (sop == NULL || cdh_ObjidIsNull(sop->g.oid)) {
*sts = GDH__NOMOUNTOBJECT;
return NULL;
}
soid = sop->g.oid;
op->g.soid = soid;
vp = vol_MountVolume(sts, soid.vid);
break;
}
case pwr_eClass_MountVolume:
soid.vid = ((pwr_sMountVolume*)p)->Volume;
if (soid.vid == 0) {
......
......@@ -46,6 +46,7 @@ extern "C" {
#define sev_eProcSevClient 121
#define sev_eProcSevServer 122
#define sev_eProcSevImport 123
#define sev_cMsgClass 202
#define sev_cNetVersion 1
......@@ -62,7 +63,11 @@ typedef enum {
sev_eMsgType_ServerStatus,
sev_eMsgType_HistObjectDataGetRequest,
sev_eMsgType_HistObjectDataGet,
sev_eMsgType_EventsStore
sev_eMsgType_EventsStore,
sev_eMsgType_ExportNodeUp,
sev_eMsgType_ExportItemsRequest,
sev_eMsgType_ExportItems,
sev_eMsgType_ExportData
} sev_eMsgType;
typedef enum {
......@@ -165,6 +170,14 @@ typedef struct {
int Data[1];
} sev_sMsgHistDataStoreV0;
typedef struct {
pwr_tUInt16 Type;
pwr_tUInt16 Version;
net_sTime Time;
pwr_tUInt32 ServerThread;
int Data[1];
} sev_sMsgExportData;
typedef struct {
pwr_tUInt16 Type;
pwr_tUInt16 Version;
......@@ -238,6 +251,29 @@ typedef struct {
pwr_tStatus Status;
} sev_sMsgServerStatus;
typedef struct {
pwr_tOid oid;
pwr_tOName oname;
pwr_tRefId sevid;
pwr_tString80 description;
pwr_tFloat32 scantime;
pwr_tMask options;
pwr_tOName aname;
pwr_eType type;
unsigned int size;
unsigned int elem;
} sev_sExportItem;
typedef struct {
pwr_tUInt16 Type;
pwr_tUInt16 Version;
pwr_tStatus Status;
unsigned int NumItems;
unsigned int NumAttributes;
sev_sExportItem Items[1];
} sev_sMsgExportItems;
#ifdef __cplusplus
}
#endif
......
......@@ -280,11 +280,11 @@ static gdb_sNode* testClient(pwr_tStatus* sts, sub_sClient* cp)
break; /* Subscription client no longer exists! */
if (op->g.flags.b.isAliasServer)
cp->aref.Objid = op->g.oid;
cp->aref = cdh_ObjidToAref(op->g.oid);
/* This is a not to ugly fix, but it should be removed, LW.
It's done to make Leif-Gran Hansson happier. I.e. it makes
the linksup program work. */
cp->aref.Objid = op->g.oid;
cp->aref = cdh_ObjidToAref(op->g.oid);
vp = pool_Address(NULL, gdbroot->pool, op->l.vr);
np = hash_Search(&lsts, gdbroot->nid_ht, &vp->g.nid);
......
......@@ -522,6 +522,43 @@ gdb_sVolume* vol_MountVolume(pwr_tStatus* sts, pwr_tVolumeId vid)
return vp;
}
mvol_sAttribute* vol_BlockNameToAttribute(pwr_tStatus* sts, mvol_sAttribute* ap,
cdh_sParseName* pn, gdb_sObject *op, pwr_tBitMask lo_flags, pwr_tBitMask trans)
{
gdb_sObject* nop;
pwr_tAName aname;
int i;
gdb_AssumeLocked;
strcpy(aname, "");
for ( i = 0; i < pn->nObject; i++) {
strcat(aname, pn->object[i].name.orig);
strcat(aname, "-");
}
for ( i = 0; i < pn->nAttribute; i++) {
strcat(aname, pn->attribute[i].name.orig);
if ( i != pn->nAttribute - 1)
strcat(aname, "-");
}
strcat(aname, ".Value");
cdh_ParseName(sts, pn, pn->poid, aname, pn->parseFlags.m);
nop = vol_NameToObject(sts, pn, lo_flags, trans);
if (nop == NULL)
return NULL;
ap = mvol_AnameToAttribute(sts, ap, nop->g.cid, pn, op);
if (ap == NULL)
return NULL;
ap->op = nop;
/* !!! To do !!! Kolla att allt aer ifyllt! */
return ap;
}
/* Get the definition of an attribute denoted by
a full object + attribute name.
......@@ -539,6 +576,10 @@ mvol_sAttribute* vol_NameToAttribute(pwr_tStatus* sts, mvol_sAttribute* ap,
if (op == NULL)
return NULL;
if (op->g.cid == pwr_eClass_Block) {
return vol_BlockNameToAttribute(sts, ap, pn, op, lo_flags, trans);
}
ap = mvol_AnameToAttribute(sts, ap, op->g.cid, pn, op);
if (ap == NULL)
return NULL;
......@@ -1420,3 +1461,52 @@ pwr_tDisableAttr vol_ArefDisabled(pwr_tStatus* sts, pwr_sAttrRef* arp)
return *(pwr_tDisableAttr*)p;
return pwr_cNDisableAttr;
}
void vol_MountDynObject(pwr_tStatus* sts, gdb_sObject* op)
{
gdb_sVolume* vp = NULL;
gdb_sMountServer* msp;
void* p;
pwr_tObjid soid = pwr_cNObjid;
if (op->g.oid.vid != gdbroot->db->vid)
errh_Bugcheck(GDH__WEIRD, "only root volumes can mount");
p = pool_Address(sts, gdbroot->rtdb, op->u.n.body);
if (p == NULL)
return;
if (op->g.cid != pwr_eClass_MountDynObject) {
*sts = GDH__BADARG;
return;
}
cdh_sParseName parseName, *pn;
gdb_sObject* sop = NULL;
pn = cdh_ParseName(sts, &parseName, pwr_cNObjid, ((pwr_sMountDynObject*)p)->Object, 0);
if (pn == NULL)
return;
sop = vol_NameToObject(sts, pn, gdb_mLo_global, vol_mTrans_all);
if (sop == NULL || cdh_ObjidIsNull(sop->g.oid)) {
*sts = GDH__NOMOUNTOBJECT;
return;
}
soid = sop->g.oid;
op->g.soid = soid;
vp = vol_MountVolume(sts, soid.vid);
if (vp == NULL)
return;
pwr_Assert(cdh_ObjidIsEqual(op->g.soid, soid));
if (!op->u.n.flags.b.inMountClientList) {
msp = vol_AddMountClient(sts, op);
if (msp == NULL)
return;
}
}
......@@ -322,4 +322,6 @@ void vol_UnlinkObject(
void vol_UpdateAlarm(pwr_tStatus* sts, gdb_sObject* op, net_sAlarm al);
pwr_tDisableAttr vol_ArefDisabled(pwr_tStatus* sts, pwr_sAttrRef* arp);
void vol_MountDynObject(pwr_tStatus* sts, gdb_sObject* op);
#endif
......@@ -769,6 +769,11 @@ sub build_all_wbl ()
system( "rm $load_dir/*.dbs");
_build("wbl", "mcomp", "src", "lib");
merge();
_module("sev");
my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs");
_build("wbl", "sev", "src", "lib");
merge();
_module("remote");
my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs");
......
......@@ -33,217 +33,129 @@
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_a_sevitem.wb_load -- Defines the class SevItem.
! pwrb_c_sevexport.wb_load -- Defines the class SevExport.
!
SObject pwrb:Class
!/**
! @Version 1.0
! Display of a storage item.
!
! @Version 2.0
! @Group PlantConfiguration,SevHist
! @Summary Configures export to storage station.
! Configures export to storage station.
!
! @b See also
! @classlink SevItemFloat32 pwrb_sevitemfloat32.html
! @classlink SevHist pwrb_sevhist.html
! @classlink SevHistThread pwrb_sevhistthread.html
! @classlink SevHistMonitor pwrb_sevhistmonitor.html
! @classlink SevHistServer pwrb_sevhistserver.html
!*/
Object SevItem $ClassDef 693
Object SevExport $ClassDef 709
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "SevItem"
Attr StructName = "SevExport"
EndBody
!/**
! Description.
! Optional desription.
!*/
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Object name.
! Specifies the complete name of the attribute whose
! value is to be stored.
!*/
Object ObjectName $Attribute 2
Object Attribute $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$String256"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr TypeRef = "pwrs:Type-$AttrRef"
EndBody
EndObject
!/**
! Number of attributes.
! SevHistThread object that specifies the storage scantime
! and in which server the data is stored.
!*/
Object NoOfAttr $Attribute 3
Object ThreadObject $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Attr.
! If serveral attributes, only first attribute is displayed.
!*/
Object Attr $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$String256"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Attribute type.
!*/
Object AttrType $Attribute 5
Body SysBody
Attr TypeRef = "pwrs:Type-$TypeId"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Table name.
!*/
Object TableName $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
!/**
! Scan time.
!*/
Object ScanTime $Attribute 7
Object Options $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr TypeRef = "pwrb:Type-SevExportOptionsMask"
EndBody
EndObject
!/**
! Options.
! Disable storage.
!*/
Object Options $Attribute 8
Object Disable $Attribute 5
Body SysBody
Attr TypeRef = "pwrb:Type-SevHistOptionsMask"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Deadband.
! Trigger a export when event controlled export is configured.
! Trigger can be set from the application or from a process graph,
! and when it has been detected by the rt_sevhistmon process, it
! will be reset by this process.
!
! To configure even controlled storage, set Event in Options.
!*/
Object Deadband $Attribute 9
Object Trigger $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Storage time.
!*/
Object StorageTime $Attribute 10
Body SysBody
Attr TypeRef = "pwrs:Type-$DeltaTime"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Objid.
!*/
Object Oid $Attribute 11
Body SysBody
Attr TypeRef = "pwrs:Type-$Objid"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_RTHIDE
Object Template SevExport
Body RtBody
EndBody
EndObject
!/**
! Item identity.
!*/
Object Id $Attribute 12
Object ThreadObject $ReferenceList
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr ObjectClass[0] = "pwrb:Class-SevHistThread"
Attr Filter = 1
EndBody
EndObject
!/**
! Receive counter.
!*/
Object ReceiveCount $Attribute 13
Object PostCreate $DbCallBack
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr MethodName = "SevHist-PostCreate"
EndBody
EndObject
!/**
! Write counter.
!*/
Object WriteCount $Attribute 14
Object PostMove $DbCallBack
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr MethodName = "SevHist-PostMove"
EndBody
EndObject
!/**
! Write quota in percentage.
!*/
Object WriteQuota $Attribute 15
Object ConfiguratorPosan $Menu
Object Pointed $Menu
Object ConnectAttribute $MenuButton
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr ButtonName = "Connect Attribute"
Attr MethodName = "$Object-ConnectAttribute"
Attr MethodArguments[0] = "Attribute"
Attr FilterName = "$Object-ConnectAttributeFilter"
Attr FilterArguments[0] = "Attribute"
EndBody
EndObject
!/**
! Time for mean value.
!*/
Object MeanValueTime $Attribute 16
Body SysBody
Attr TypeRef = "pwrs:Type-$Time"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Mean value.
!*/
Object MeanValue $Attribute 17
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Standard deviation in last mean value interval.
!*/
Object StandardDeviation $Attribute 18
Object ConfiguratorPoson $Menu
Object Pointed $Menu
Object ConnectThread $MenuButton
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr ButtonName = "Connect SevHistThread"
Attr MethodName = "$Objid-Connect"
Attr MethodArguments[0] = "ThreadObject"
Attr MethodArguments[1] = "SevHistThread"
Attr FilterName = "$Objid-IsOkConnect"
Attr FilterArguments[0] = "ThreadObject"
Attr FilterArguments[1] = "SevHistThread"
EndBody
EndObject
!/**
! Time for last write.
!*/
Object LastTime $Attribute 19
Body SysBody
Attr TypeRef = "pwrs:Type-$Time"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
EndObject
EndObject
......
!
! ProviewR Open Source Process Control.
! Copyright (C) 2005-2019 SSAB EMEA AB.
!
! This file is part of ProviewR.
!
! 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
!
! Linking ProviewR statically or dynamically with other modules is
! making a combined work based on ProviewR. 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
! ProviewR give you permission to, from the build function in the
! ProviewR Configurator, combine ProviewR with modules generated by the
! ProviewR 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 ProviewR (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_sevexportoptionsmask.wb_load -- Defines the mask type SevExportOptionsMask
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Options attribute type in SevExport objects.
!
! @b See also
! @classlink SevExport pwrb_sevexport.html
!*/
Object SevExportOptionsMask $TypeDef 89
Body SysBody
Attr TypeRef = "pwrs:Type-$Mask"
Attr PgmName = "SevExportOptionsMask"
EndBody
!/**
! Event controlled epxort. The attribute will only be exported
! one time when the trigger is activated.
!*/
Object Event $Bit
Body SysBody
Attr PgmName = "Event"
Attr Text = "Event"
Attr Value = 1
EndBody
EndObject
!/**
! Calculate mean value with interval 1.
!*/
Object MeanValue1 $Bit
Body SysBody
Attr PgmName = "MeanValue1"
Attr Text = "MeanValue1"
Attr Value = 2
EndBody
EndObject
!/**
! Calculate mean value with interval 2.
!*/
Object MeanValue2 $Bit
Body SysBody
Attr PgmName = "MeanValue2"
Attr Text = "MeanValue2"
Attr Value = 4
EndBody
EndObject
EndObject
EndSObject
......@@ -33,44 +33,31 @@
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_a_sevitemfloat.wb_load -- Defines the class SevItemFloat.
! pwrs_c_block.wb_load -- Defines the class Block.
!
SObject pwrb:Class
SObject pwrs:Class
!/**
! @Version 1.0
! Display of a storage item of type Float.
! @Group ClassDefinition
! Definition a block.
!
!
! @b See also
! @classlink SevItem pwrb_sevitem.html
!*/
Object SevItemFloat $ClassDef 694
!
Object $Block $ClassDef pwr_eCix_Block
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr Method = pwr_eMethod_SysBody
Attr Flags |= pwr_mClassDef_System
EndBody
Object RtBody $ObjBodyDef 1
Object SysBody $ObjBodyDef 1
Body SysBody
Attr StructName = "SevItemFloat"
Attr StructName = "Block"
EndBody
!/**
! Superclass.
!*/
Object Super $Attribute 1
Body SysBody
Attr TypeRef = "pwrb:Class-SevItem"
Attr Flags |= PWR_MASK_CLASS
Attr Flags |= PWR_MASK_SUPERCLASS
EndBody
EndObject
!/**
! Last value.
! Optional description.
!*/
Object LastValue $Attribute 2
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
EndObject
......
......@@ -33,44 +33,30 @@
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_a_sevitemboolean.wb_load -- Defines the class SevItemBoolean.
! pwrs_c_blockattribute.wb_load -- Defines the class BlockAttribute.
!
SObject pwrb:Class
SObject pwrs:Class
!/**
! @Version 1.0
! Display of a storage item of type Boolean.
!
!
! @b See also
! @classlink SevItem pwrb_sevitem.html
! @Group ClassDefinition
! Definition of a block attribute.
!*/
Object SevItemBoolean $ClassDef 696
!
Object $BlockAttribute $ClassDef pwr_eCix_BlockAttribute
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "SevItemBoolean"
Attr Method = pwr_eMethod_SysBody
Attr Flags |= pwr_mClassDef_System
EndBody
!/**
! Superclass.
!*/
Object Super $Attribute 1
Object SysBody $ObjBodyDef 1
Body SysBody
Attr TypeRef = "pwrb:Class-SevItem"
Attr Flags |= PWR_MASK_CLASS
Attr Flags |= PWR_MASK_SUPERCLASS
Attr StructName = "BlockAttribute"
EndBody
EndObject
!/**
! Last value.
! Number of elements.
!*/
Object LastValue $Attribute 2
Object Elements $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
......
......@@ -33,46 +33,37 @@
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_a_sevitemint.wb_load -- Defines the class SevItemInt.
! pwrs_c_mountdynobject.wb_load -- Defines the class MountDynObject.
!
SObject pwrb:Class
SObject pwrs:Class
!/**
! @Version 1.0
! Display of a storage item of type Int.
!
!
! @b See also
! @classlink SevItem pwrb_sevitem.html
! @Group PlantConfiguration,NodeConfiguration
! Mount a volume.
!*/
Object SevItemInt $ClassDef 697
Object $MountDynObject $ClassDef pwr_eCix_MountDynObject
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr Flags |= pwr_mClassDef_System
Attr Flags |= pwr_mClassDef_TopObject
Attr Flags |= pwr_mClassDef_NoAdopt
EndBody
Object RtBody $ObjBodyDef 1
Object SysBody $ObjBodyDef 1
Body SysBody
Attr StructName = "SevItemInt"
Attr StructName = "MountDynObject"
EndBody
!/**
! Superclass.
!*/
Object Super $Attribute 1
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrb:Class-SevItem"
Attr Flags |= PWR_MASK_CLASS
Attr Flags |= PWR_MASK_SUPERCLASS
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Last value.
!*/
Object LastValue $Attribute 2
Object Object $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
Attr TypeRef = "pwrs:Type-$String256"
EndBody
EndObject
EndObject
Object Template $MountDynObject
Body SysBody
EndBody
EndObject
EndObject
EndSObject
!
! ProviewR Open Source Process Control.
! Copyright (C) 2005-2019 SSAB EMEA AB.
!
! This file is part of ProviewR.
!
! 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
!
! Linking ProviewR statically or dynamically with other modules is
! making a combined work based on ProviewR. 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
! ProviewR give you permission to, from the build function in the
! ProviewR Configurator, combine ProviewR with modules generated by the
! ProviewR 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 ProviewR (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrs_c_subblock.wb_load -- Defines the class SubBlock.
!
SObject pwrs:Class
!/**
! @Group ClassDefinition
! Definition a subblock.
!
!*/
!
Object $SubBlock $ClassDef pwr_eCix_SubBlock
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_SysBody
Attr Flags |= pwr_mClassDef_System
EndBody
Object SysBody $ObjBodyDef 1
Body SysBody
Attr StructName = "SubBlock"
EndBody
!/**
! Optional description.
!*/
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
EndObject
EndObject
EndSObject
......@@ -183,6 +183,7 @@ void wb_dbs::checkObject(sOentry* oep)
case pwr_eClass_MountVolume:
case pwr_eClass_CreateVolume:
case pwr_eClass_MountObject:
case pwr_eClass_MountDynObject:
if (m_volume.cid == pwr_eClass_RootVolume
|| m_volume.cid == pwr_eClass_VolatileVolume) {
// Root volume or cloned volume
......
......@@ -807,6 +807,10 @@ void wb_print_wbl::printClass(wb_volume& vol, ldh_sParDef* par_bd, char* body,
sts = getBody(vol, par_bd->Par->Param.TypeRef, "RtBody",
par_bd->Par->Param.Info.Size / par_bd->Par->Param.Info.Elements, &bd,
&rows, &tb);
if (EVEN(sts))
sts = getBody(vol, par_bd->Par->Param.TypeRef, "SysBody",
par_bd->Par->Param.Info.Size / par_bd->Par->Param.Info.Elements, &bd,
&rows, &tb);
if (EVEN(sts)) {
m_os << "! %WBDUMP-E-Error Unknown sub class: " << par_bd->Par->Buffer.Class
<< '\n';
......
......@@ -248,7 +248,15 @@ static wbl_sSym classes[] = { { "pwr_eClass_ClassDef", pwr_eClass_ClassDef },
{ "pwr_eClass_Security", pwr_eClass_Security },
{ "pwr_eCix_Security", pwr_eCix_Security },
{ "pwr_eClass_ReferenceList", pwr_eClass_ReferenceList },
{ "pwr_eCix_ReferenceList", pwr_eCix_ReferenceList }
{ "pwr_eCix_ReferenceList", pwr_eCix_ReferenceList },
{ "pwr_eClass_Block", pwr_eClass_Block },
{ "pwr_eCix_Block", pwr_eCix_Block },
{ "pwr_eClass_SubBlock", pwr_eClass_SubBlock },
{ "pwr_eCix_SubBlock", pwr_eCix_SubBlock },
{ "pwr_eClass_BlockAttribute", pwr_eClass_BlockAttribute },
{ "pwr_eCix_BlockAttribute", pwr_eCix_BlockAttribute },
{ "pwr_eClass_MountDynObject", pwr_eClass_MountDynObject },
{ "pwr_eCix_MountDynObject", pwr_eCix_MountDynObject }
,
{ "pwr_cClass_ChanDi", pwr_cClass_ChanDi },
......
This diff is collapsed.
......@@ -397,7 +397,7 @@ void GrowBarChart::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
skip = 1;
else {
f_bar_ll_y
-= bar_values[i][j] * (ur_y - ll_y) / (max_value - min_value);
-= (bar_values[i][j] - min_value) * (ur_y - ll_y) / (max_value - min_value);
bar_ll_y = f_bar_ll_y;
if (bar_ll_y < ll_y)
bar_ll_y = ll_y;
......
This diff is collapsed.
......@@ -68,7 +68,12 @@ typedef enum {
xnav_eItemType_ObjectStruct,
xnav_eItemType_AttrObject,
xnav_eItemType_Enum,
xnav_eItemType_Mask
xnav_eItemType_Mask,
xnav_eItemType_Block,
xnav_eItemType_SubBlock,
xnav_eItemType_BlockAttr,
xnav_eItemType_BlockAttrArray,
xnav_eItemType_BlockAttrArrayElem
} xnav_eItemType;
typedef enum {
......@@ -465,4 +470,79 @@ public:
int element;
};
class ItemBlock : public ItemBaseObject {
public:
int has_child;
ItemBlock(XNavBrow* brow, pwr_tObjid item_objid, brow_tNode dest,
flow_eDest dest_code);
virtual ~ItemBlock();
int open_children(XNavBrow* brow, double x, double y);
int open_attributes(XNavBrow* brow, double x, double y);
};
class ItemSubBlock : public Item {
public:
ItemSubBlock(XNavBrow* brow, pwr_tObjid item_objid, brow_tNode dest,
flow_eDest dest_code);
int open_attributes(XNavBrow* brow, double x, double y);
void close(XNavBrow* brow, double x, double y);
};
class ItemBlockAttr : public Item {
public:
pwr_eType type_id;
pwr_tTid tid;
int size;
int noedit;
char old_value[80];
pwr_tRefId subid;
int first_scan;
ItemBlockAttr(XNavBrow* brow, pwr_tObjid item_objid, brow_tNode dest,
flow_eDest dest_code);
int open_children(XNavBrow* brow, double x, double y);
int open_attributes(XNavBrow* brow, double x, double y);
void close(XNavBrow* brow, double x, double y);
virtual ~ItemBlockAttr();
};
class ItemBlockAttrArray : public Item {
public:
pwr_eType type_id;
pwr_tTid tid;
unsigned int size;
unsigned int elements;
unsigned int flags;
int noedit;
char old_value[80];
pwr_tRefId subid;
int first_scan;
ItemBlockAttrArray(XNavBrow* brow, pwr_tObjid item_objid, brow_tNode dest,
flow_eDest dest_code);
int open_attributes(XNavBrow* brow, double x, double y);
int open_children(XNavBrow* brow, double x, double y);
void close(XNavBrow* brow, double x, double y);
virtual ~ItemBlockAttrArray();
};
class ItemBlockAttrArrayElem : public Item {
public:
unsigned int flags;
unsigned int element;
pwr_tTid tid;
pwr_eType type_id;
int size;
int noedit;
char old_value[80];
pwr_tRefId subid;
int first_scan;
ItemBlockAttrArrayElem(XNavBrow* brow, pwr_tObjid item_objid, brow_tNode dest,
flow_eDest dest_code, char *item_name,
unsigned int item_flags, unsigned int item_element,
pwr_tTid item_tid, pwr_eType item_type_id, int item_size);
virtual ~ItemBlockAttrArrayElem();
};
#endif
This diff is collapsed.
......@@ -4306,8 +4306,8 @@ static int xnav_open_func(void* client_data, void* client_flag)
plotgroup = sevhist_aref;
sevplotgroup_found = 1;
break;
case pwr_cClass_SevItemInt:
case pwr_cClass_SevItemFloat:
case pwr_cClass_SevItemInt32:
case pwr_cClass_SevItemFloat32:
case pwr_cClass_SevItemBoolean:
sevitem_found = 1;
break;
......@@ -4493,8 +4493,8 @@ static int xnav_open_func(void* client_data, void* client_flag)
break;
}
case pwr_cClass_SevItemBoolean:
case pwr_cClass_SevItemFloat:
case pwr_cClass_SevItemInt: {
case pwr_cClass_SevItemFloat32:
case pwr_cClass_SevItemInt32: {
pwr_tOName oname;
pwr_tOid oid;
......@@ -5833,8 +5833,8 @@ static int xnav_sevhist_get_select_cb(
sts = gdh_GetObjectClass(sel_aref.Objid, &cid);
switch (cid) {
case pwr_cClass_SevHist:
case pwr_cClass_SevItemFloat:
case pwr_cClass_SevItemInt:
case pwr_cClass_SevItemFloat32:
case pwr_cClass_SevItemInt32:
case pwr_cClass_SevItemBoolean:
break;
case pwr_cClass_SevHistObject:
......@@ -5849,8 +5849,8 @@ static int xnav_sevhist_get_select_cb(
switch (cid) {
case pwr_cClass_SevHist:
case pwr_cClass_SevItemFloat:
case pwr_cClass_SevItemInt:
case pwr_cClass_SevItemFloat32:
case pwr_cClass_SevItemInt32:
case pwr_cClass_SevItemBoolean:
sel_aref = cdh_ObjidToAref(ch);
break;
......@@ -5884,8 +5884,8 @@ static int xnav_sevhist_get_select_cb(
strcpy(aname, s + 1);
*oid = aref.Objid;
break;
case pwr_cClass_SevItemFloat:
case pwr_cClass_SevItemInt:
case pwr_cClass_SevItemFloat32:
case pwr_cClass_SevItemInt32:
case pwr_cClass_SevItemBoolean:
sts = gdh_ArefANameToAref(&sel_aref, "ObjectName", &attr_aref);
if (EVEN(sts))
......@@ -9543,8 +9543,8 @@ static pwr_tStatus xnav_otree_action_cb(void* ctx, pwr_tAttrRef* aref)
break;
case pwr_cClass_SevHist:
case pwr_cClass_SevHistObject:
case pwr_cClass_SevItemFloat:
case pwr_cClass_SevItemInt:
case pwr_cClass_SevItemFloat32:
case pwr_cClass_SevItemInt32:
case pwr_cClass_SevItemBoolean:
case pwr_cClass_SevPlotGroup:
sprintf(cmd, "open history/name=%s/title=\"%s\"", aname, aname);
......
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