Commit 59fe4ea9 authored by Claes Sjofors's avatar Claes Sjofors

Maintenance supervision server added

parent 42fd1bb6
This source diff could not be displayed because it is too large. You can view the blob instead.
<topic> __DocumentTitlePage
<image> pwr_logga_doc.png
<h1> Multivariate analysis
<hr>
2019-05-28
Version 5.7.0
<hr>
</topic>
<topic> __DocumentInfoPage
Copyright 2005-2019 SSAB EMEA AB
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts.
</topic>
<option> printdisable
<topic> index
Multivariate Analysis
<image> pwr_logga.gif
<h1>Multivariate Analysis
Introduction <link> mva_introduction
Fetch data <link> mva_get_data
Linear Regression Model <link> mva_linreg_model
Index <index>
</topic>
<option> printenable
<chapter>
<topic> mva_introduction
Introduction
ProviewR Multivariate Analyses is utilities to analyse data stored or generated by a
ProviewR system.
</topic>
</chapter>
<chapter>
<topic> mva_get_data
Get data
<h1>Get data
Data can be fetch from an Sev server or read from a csv file generated for example by
the Xtt logging function.
<option> printdisable
<b>Fetch from sev <link>mva_fetch_from_sev
<b>Xtt logging <link>mva_xtt_logging
<option> printenable
</topic>
<headerlevel>
<topic> mva_fetch_from_sev
Fetch data from Sev
...
</topic>
<topic> mva_xtt_logging
Xtt logging
...
</topic>
</headerlevel>
</chapter>
<chapter>
<topic> mva_linreg_model
Linear Regression Model
<h1>Create Model
<option> printdisable
<b>Create model <link>mva_create_model
<b>Apply model <link>mva_apply_model
<option> printenable
</topic>
<headerlevel>
<topic> mva_create_model
Create model
...
</topic>
<topic> mva_apply_model
Apply model
...
</topic>
</headerlevel>
</chapter>
......@@ -35,9 +35,9 @@ silent :
.SUFFIXES:
$(exe_dir)/pwrrt.so : pwrrtmodule.c
@ if [ $(PWRE_CONF_PYDEV) -eq 1 ]; then\
@ if [ "$(PWRE_CONF_PYDEV)" == "1" ]; then\
echo "Bulding Python c extension pwrrt";\
python setup_pwrrt.py -q build --build-base $(bld_dir);\
python setup_pwrrt.py build --build-base $(bld_dir);\
if [ "$(pwre_hw)" == "hw_x86_64" ]; then \
mv $(bld_dir)/lib.linux-x86_64-2.7/pwrrt.so $(pwr_exe); \
elif [ "$(pwre_hw)" == "hw_x86" ]; then \
......
......@@ -3011,7 +3011,7 @@ Appl_mainloop(ApplObject *self, PyObject *args)
int swap = 0;
int first_scan = 1;
arglist = Py_BuildValue("(O)", self->ctx);
arglist = Py_BuildValue("()", self->ctx);
PyEval_CallObject(self->open, arglist);
......@@ -3491,6 +3491,8 @@ static PyObject *pwrrt_getSevItemsDataFrame(PyObject *self, PyObject *args)
char *server, *fromstr, *tostr;
pwr_tOName *oidvect;
pwr_tOName *anamevect;
pwr_tOName cond_oid;
pwr_tOName cond_aname;
int *isobjectvect;
int oidcnt, anamecnt, isobjectcnt;
pwr_tTime from, to;
......@@ -3501,6 +3503,7 @@ static PyObject *pwrrt_getSevItemsDataFrame(PyObject *self, PyObject *args)
PyObject *oidobj, *anameobj, *isobjectobj;
pwr_tFloat32 *vbuf;
int maxrows = 0;
int options = 0;
int rows;
pwr_eType vtype;
unsigned int vsize;
......@@ -3513,7 +3516,7 @@ static PyObject *pwrrt_getSevItemsDataFrame(PyObject *self, PyObject *args)
int valcnt;
pwr_tDeltaTime dt;
pwr_tFloat32 **vvect;
float *tbuf;
float *tbuf;
if ( !pwrrt_scctx) {
sevcli_init( &sts, &pwrrt_scctx);
......@@ -3521,8 +3524,8 @@ static PyObject *pwrrt_getSevItemsDataFrame(PyObject *self, PyObject *args)
return set_error(sts);
}
if ( !PyArg_ParseTuple(args, "sOOOssf|Is", &server, &oidobj, &anameobj, &isobjectobj,
&fromstr, &tostr, &tdiff, &maxrows, &time_format))
if ( !PyArg_ParseTuple(args, "sOOOssf|IsI", &server, &oidobj, &anameobj, &isobjectobj,
&fromstr, &tostr, &tdiff, &maxrows, &time_format, &options))
return NULL;
if ( time_format) {
......@@ -3554,8 +3557,6 @@ static PyObject *pwrrt_getSevItemsDataFrame(PyObject *self, PyObject *args)
if ( EVEN(sts))
return set_error(sts);
}
time_Adiff(&dt, &to, &from);
valcnt = (int)time_DToFloat(NULL, &dt)/tdiff;
if ( PyTuple_Check(oidobj))
oidcnt = PyTuple_Size(oidobj);
......@@ -3611,8 +3612,79 @@ static PyObject *pwrrt_getSevItemsDataFrame(PyObject *self, PyObject *args)
isobjectvect[i] = PyInt_AsLong(pystr);
}
for ( i = 0; i < oidcnt; i++)
printf("arg %s.%s\n", oidvect[i], anamevect[i]);
if (options & 1) {
/* First objid is condition */
strcpy(cond_oid, oidvect[0]);
strcpy(cond_aname, anamevect[0]);
for (i = 0; i < oidcnt - 1; i++) {
strcpy(oidvect[i], oidvect[i+1]);
strcpy(anamevect[i], anamevect[i+1]);
isobjectvect[i] = isobjectvect[i+1];
}
oidcnt -= 1;
anamecnt -= 1;
isobjectcnt -= 1;
if (oidcnt <= 0)
return set_error(GDH__ARGCOUNT);
/* Get condition data */
if ( strncmp("_O", cond_oid, 2) == 0)
sts = cdh_StringToObjid(cond_oid, &oid);
else
sts = gdh_NameToObjid(cond_oid, &oid);
if ( EVEN(sts))
return set_error(sts);
sevcli_get_itemdata( &sts, pwrrt_scctx, oid, cond_aname, from, to, maxrows, &ttbuf,
(void **)&vbuf, &rows, &vtype, &vsize);
if ( sts == SEV__NOPOINTS)
Py_RETURN_NONE;
else if (EVEN(sts))
return set_error(sts);
//for (i = 0; i < rows; i++) {
// char timstr[40];
// time_AtoAscii(&ttbuf[i], time_eFormat_DateAndTime, timstr, sizeof(timstr));
// printf("%d %s %d\n", i, timstr, ((pwr_tBoolean *)vbuf)[i]);
//}
/* Find longest continuous interval where condition is high */
pwr_tBoolean last_value = 0;
pwr_tFloat32 max_time = 0.0f;
int last_idx;
int start_idx;
int end_idx;
for (i = 0; i < rows; i++) {
if (((pwr_tBoolean *)vbuf)[i] == 1 && last_value == 0) {
last_value = 1;
last_idx = i;
}
else if ((((pwr_tBoolean *)vbuf)[i] == 0 && last_value == 1) ||
(((pwr_tBoolean *)vbuf)[i] == 1 && last_value == 1 && i == rows - 1)) {
last_value = 0;
time_Adiff(&dt, &ttbuf[i], &ttbuf[last_idx]);
if (time_DToFloat(0, &dt) > max_time) {
max_time = time_DToFloat(0, &dt);
start_idx = last_idx;
end_idx = i;
}
}
}
if (max_time > 0.0f) {
from = ttbuf[start_idx];
to = ttbuf[end_idx];
}
free(ttbuf);
free(vbuf);
}
time_Adiff(&dt, &to, &from);
valcnt = (int)time_DToFloat(NULL, &dt)/tdiff;
//for ( i = 0; i < oidcnt; i++)
// printf("arg %s.%s\n", oidvect[i], anamevect[i]);
vvect = calloc(oidcnt, sizeof(float *));
......@@ -3624,7 +3696,6 @@ static PyObject *pwrrt_getSevItemsDataFrame(PyObject *self, PyObject *args)
if ( EVEN(sts))
return set_error(sts);
if (!isobjectvect[i]) {
sevcli_get_itemdata( &sts, pwrrt_scctx, oid, anamevect[i], from, to, maxrows, &ttbuf,
(void **)&vbuf, &rows, &vtype, &vsize);
......@@ -3633,7 +3704,7 @@ static PyObject *pwrrt_getSevItemsDataFrame(PyObject *self, PyObject *args)
else if (EVEN(sts))
return set_error(sts);
/* Create data rows for panda with interpolation */
/* Create data rows for pandas with interpolation */
tbuf = malloc(rows * sizeof(float));
for ( j = 0; j < rows; j++) {
......@@ -3646,10 +3717,10 @@ static PyObject *pwrrt_getSevItemsDataFrame(PyObject *self, PyObject *args)
for ( j = 0; j < valcnt; j++) {
if ( j*tdiff < tbuf[0])
vvect[i][j] = vbuf[0];
else if ( j*tdiff > tbuf[rows - 1])
else if ( j*tdiff >= tbuf[rows - 1])
vvect[i][j] = vbuf[rows-1];
else {
while( tbuf[k] <= j*tdiff)
while( tbuf[k] <= j*tdiff && k < rows - 1)
k++;
vvect[i][j] = vbuf[k-1] + (vbuf[k] - vbuf[k-1])/(tbuf[k] - tbuf[k-1]) * (j*tdiff - tbuf[k-1]);
}
......@@ -3701,12 +3772,12 @@ static PyObject *pwrrt_getSevItemsDataFrame(PyObject *self, PyObject *args)
vp1 = (float *)(((char*)vbuf) + lineoffs);
vvect[l][j] = *vp1;
}
else if ( j*tdiff > tbuf[rows - 1]) {
else if ( j*tdiff >=tbuf[rows - 1]) {
vp1 = (float *)(((char*)vbuf) + (rows - 1)*linesize + lineoffs);
vvect[l][j] = *vp1;
}
else {
while( tbuf[k] <= j*tdiff)
while( tbuf[k] <= j*tdiff && k < rows)
k++;
vp1 = (float *)(((char *)vbuf) + (k - 1)*linesize + lineoffs);
vp2 = (float *)(((char *)vp1) + linesize);
......@@ -4109,6 +4180,8 @@ PyMODINIT_FUNC initpwrrt(void)
Py_INCREF(&ApplType);
PyModule_AddObject(m, "Appl", (PyObject *)&ApplType);
PyModule_AddIntConstant(m, "FRAME_OPTIONS_CONDITION", 1);
PyDateTime_IMPORT;
gdh_Init("Python");
......
include $(pwre_dir_symbols)
ifndef variables_mk
include $(pwre_kroot)/tools/bld/src/variables.mk
endif
ifndef rules_mk
include $(pwre_kroot)/tools/bld/src/rules.mk
endif
vpath %.py $(co_source)
source_dirs := $(co_source)
py_sources := $(sort \
$(foreach file, \
$(foreach dir, \
$(source_dirs), \
$(wildcard $(dir)/*.py) \
), $(notdir $(file)) \
) \
)
png_sources := $(sort \
$(foreach file, \
$(foreach dir, \
$(source_dirs), \
$(wildcard $(dir)/*.png) \
), $(notdir $(file)) \
) \
)
export_py := $(patsubst %.py, $(exe_dir)/%.py, $(py_sources))
export_png := $(patsubst %.png, $(exe_dir)/%.png, $(png_sources))
clean_py := $(patsubst %.py, clean_%.py, $(py_sources))
clean_png := $(patsubst %.png, clean_%.png, $(png_sources))
.PHONY : all init copy lib exe clean realclean\
$(clean_py)
all : init copy | silent
init : silent
copy : $(export_py) $(export_png) | silent
lib : silent
exe : silent
clean :
realclean : clean $(clean_py) $(clean_png)
silent :
@ :
$(export_py) : $(exe_dir)/%.py : %.py
@ echo "Exporting $< ..."
@ $(cp) $(cpflags) $(source) $(target)
$(export_png) : $(exe_dir)/%.png : %.png
@ echo "Exporting $< ..."
@ $(cp) $(cpflags) $(source) $(target)
$(clean_py) : clean_%.py : %.py
@ rm $(exe_dir)/$*.py
$(clean_png) : clean_%.png : %.png
@ rm $(exe_dir)/$*.png
#
# 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.
#
import pwrrt
import datetime
class DSup:
"""DSup class, handling of a DSupComp object.
"""
def __init__(self, name):
self.name = name
a = pwrrt.attribute(self.name + '.DetectCheck')
if a.value():
self.active = False
else:
self.active = True
def setDetect(self):
"""Set alarm detect."""
a = pwrrt.attribute(self.name + '.DetectCheck')
if a.value():
a = pwrrt.attribute(self.name + '.DetectTime')
a.setValue(datetime.datetime.now().strftime('%d-%b-%Y %H:%M:%S'))
a = pwrrt.attribute(self.name + '.DetectSend')
a.setValue(1)
a = pwrrt.attribute(self.name + '.DetectCheck')
a.setValue(0)
a = pwrrt.attribute(self.name + '.ReturnCheck')
a.setValue(1)
self.active = True
def setReturn(self):
"""Set alarm return."""
a = pwrrt.attribute(self.name + '.ReturnCheck')
if a.value():
a = pwrrt.attribute(self.name + '.ReturnTime')
a.setValue(datetime.datetime.now().strftime('%d-%b-%Y %H:%M:%S'))
a = pwrrt.attribute(self.name + '.ReturnSend')
a.setValue(1)
a = pwrrt.attribute(self.name + '.ReturnCheck')
a.setValue(0)
a = pwrrt.attribute(self.name + '.DetectCheck')
a.setValue(1)
self.active = False
#!/usr/bin/python
#
# 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.
#
# Maintenance supervision server
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
from scipy.interpolate import interp1d
import sys
import math
import time
import datetime
import getopt
import os
import pwrrt
import co
import rt
from rt_mva import *
from rt_mva_msg import *
class SupObj:
def __init__(self, sup):
global scantime
self.sup = sup
self.name = sup.name()
self.sts = 0
self.limitsts = [None] * 10
aname = sup.fullName() + '.ScanTime'
a = pwrrt.attribute(aname)
self.scantime = a.value()
self.cnt = 0
self.interval = self.scantime/scantime
self.dsup = []
i = 0
while i < 10:
dsup = rt.DSup(sup.fullName() + '.Limits[' + str(i) + '].Sup')
self.dsup.append(dsup)
i += 1
def setSts(self, sts):
if self.sts != sts:
self.sts = sts
a = pwrrt.attribute(self.sup.fullName() + '.Status')
a.setValue(sts)
def evenSts(self):
return (self.sts & 1) == 0
def oddSts(self):
return (self.sts & 1) != 0
def setLimitSts(self, idx, sts):
if self.limitsts[idx] != sts:
self.limitsts[idx] = sts
a = pwrrt.attribute(self.sup.fullName() + '.Limits[' + str(idx) + '].Status')
a.setValue(sts)
#
# Open function, backcall from application
#
def open_cb():
global olist
pwrrt.login('pwrp', 'pwrp')
olist = []
cid = pwrrt.Cid('LinRegSup')
for attr in cid.attrObjects():
o = SupObj(attr)
olist.append(o)
o.setSts(MVA__NORMAL)
#
# Close function, backcall from application
#
def close_cb():
print 'Closing down'
#
# Scan function, backcall from application
#
def scan_cb():
global olist
for o in olist:
if o.cnt < o.interval:
o.cnt += 1
continue
o.cnt = 0
process(o)
#
# Handling of a LinRegSup object
#
def process(o):
if o.evenSts() and o.sts != MVA__STDLOW and o.sts != MVA__SCORELOW and \
o.sts != MVA__SERVERTIMEOUT and o.sts != MVA__SERVERREAD:
return
a = pwrrt.attribute(o.sup.fullName() + '.Server')
server = a.value()
a = pwrrt.attribute(o.sup.fullName() + '.FormulaFile')
formulafile = co.translateFilename(a.value())
a = pwrrt.attribute(o.sup.fullName() + '.MeasuringTime')
measuringtime = a.value()
a = pwrrt.attribute(o.sup.fullName() + '.PointInterval')
pointinterval = a.value()
a = pwrrt.attribute(o.sup.fullName() + '.MaxNoOfPoints')
maxnoofpoints = a.value()
a = pwrrt.attribute(o.sup.fullName() + '.StdDeviationMinLimit')
stdmin = a.value()
a = pwrrt.attribute(o.sup.fullName() + '.ScoreMinLimit')
scoremin = a.value()
a = pwrrt.attribute(o.sup.fullName() + '.CondAttr')
condattr = a.value().strip()
i = 0
options = 0
dataoid = []
dataattr = []
dataname = []
origcol = ['Time']
datacol = []
isobject = []
# If condition attribute, insert attribute first in list
if condattr != '':
options = pwrrt.FRAME_OPTIONS_CONDITION
idx = condattr.find('.')
dataoid.append(condattr[:idx])
dataattr.append(condattr[idx+1:])
isobject.append(False)
# Insert other attributes
while i < 10:
a = pwrrt.attribute(o.sup.fullName() + '.Attributes[' + str(i) + ']')
attr = a.value().strip()
if attr == '':
break;
idx = attr.find('.')
dataname.append(attr)
origcol.append(attr)
dataoid.append(attr[:idx])
dataattr.append(attr[idx+1:])
datacol.append('A' + str(i+1))
isobject.append(False)
i += 1
# Fetch data from server
try:
result = pwrrt.getSevItemsDataFrame( server, dataoid, dataattr, isobject,
measuringtime, 'now', pointinterval, maxnoofpoints, '-', options)
except RuntimeError as e:
print str(e), e
if str(e) == '%QCOM-E-TMO, time out':
o.setSts(MVA__SERVERTIMEOUT)
else:
o.setSts(MVA__SERVERREAD)
return
if result == None:
o.setSts(MVA__NODATA)
return
sts = MVA__NORMAL
origdata = pd.DataFrame(data=result)
origdata.columns = origcol
wf = WData()
wf.set_data(origdata, datacol, dataname)
# Check standard deviation
if stdmin > 0:
std = wf.wd[datacol[0]].std()
a = pwrrt.attribute(o.sup.fullName() + '.CurrentStdDeviation')
a.setValue(std)
if std < stdmin:
o.setSts(MVA__STDLOW)
a = pwrrt.attribute(o.sup.fullName() + '.CurrentScore')
a.setValue(0.0)
return
try:
wf.apply_formula(formulafile)
except co.Error as e:
o.setSts(e.status)
return
# Fit linear regression model
slr = LinearRegression()
reg = slr.fit(wf.wd.iloc[:,1:], wf.wd.iloc[:,0:1])
#print "coef ", slr.coef_
#print "intercept ", slr.intercept_
# Check score
if scoremin > 0:
pred = slr.predict(wf.wd.iloc[:,1:])
score = r2_score(pred, wf.wd.iloc[:,0:1])
a = pwrrt.attribute(o.sup.fullName() + '.CurrentScore')
a.setValue(score)
if score < scoremin:
sts = MVA__SCORELOW
if (sts & 1) != 0:
a = pwrrt.attribute(o.sup.fullName() + '.LastScan')
a.setValue(datetime.datetime.now().strftime('%d-%b-%Y %H:%M:%S'))
# Check coefficient limits
i = 0
while i < len(slr.coef_[0]):
a = pwrrt.attribute(o.sup.fullName() + '.Limits[' + str(i) + '].InitCoef')
initcoef = a.value()
a = pwrrt.attribute(o.sup.fullName() + '.Limits[' + str(i) + '].LastCoef')
a.setValue(slr.coef_[0][i])
a = pwrrt.attribute(o.sup.fullName() + '.Limits[' + str(i) + '].Deviation')
a.setValue(slr.coef_[0][i] - initcoef)
a = pwrrt.attribute(o.sup.fullName() + '.Limits[' + str(i) + '].MinLimit')
minlimit = a.value()
a = pwrrt.attribute(o.sup.fullName() + '.Limits[' + str(i) + '].MaxLimit')
maxlimit = a.value()
if (sts & 1) != 0:
if slr.coef_[0][i] >= maxlimit or slr.coef_[0][i] <= minlimit:
o.setLimitSts(i, MVA__COEFLIMIT)
if not o.dsup[i].active:
o.dsup[i].setDetect()
else:
o.setLimitSts(i, MVA__COEF)
if o.dsup[i].active:
o.dsup[i].setReturn()
i += 1
o.setSts(sts)
# Get server object
cid = pwrrt.Cid('MaintSupServer')
server = None
for o in cid.objects():
server = o
break
if server == None:
exit()
a = o.attribute('ScanTime')
scantime = a.value()
# Create application
a = pwrrt.application('MaintSupServer',o.fullName(), 29, scantime,
open_cb, scan_cb, close_cb, None)
a.mainloop()
This diff is collapsed.
......@@ -117,6 +117,7 @@ typedef enum {
errh_eAnix_videomgm = 26,
errh_eAnix_redcom = 27,
errh_eAnix_websocketserver = 28,
errh_eAnix_maintsupserver = 29,
errh_eAnix_plc1 = 41,
errh_eAnix_plc2 = 42,
errh_eAnix_plc3 = 43,
......
!
! 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.
!
.facility MVA,28 /prefix = MVA__ !
success <successful completion> /succ
normal <Normal operating state> /info
nodata <No data received in requested interval> /info
nofrm <Formula file not found> /error
coeflimit <Coefficient limit exceeded> /error
coef <Coefficient in range> /info
stdlow <Low value of standard deviation> /error
scorelow <Low value of score> /error
servertimeout <Server timeout> /error
serverread <Error when reading data from server> /error
......@@ -17,6 +17,7 @@
25 SEV
26 SIM
27 REDU
28 MVA
50 HD
100 CDH
101 NDC
......
!
! 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_c_a_linregsuplimit.wb_load -- Internal limit class for LinRegSup.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Supervision,NodeConfiguration
! @Summary
! Internal limit class for LinRegSup.
!
! @b See Also
! @classlink LinRegSup pwrb_linregsup.html
!*/
Object LinRegSupLimit $ClassDef 712
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "LinRegSupLimit"
EndBody
!/**
! Optional description.
!*/
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Disable limit supervision.
!*/
Object Disable $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Initial coefficient value.
!*/
Object InitCoef $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Last coefficient value.
!*/
Object LastCoef $Attribute 4
Body SysBody
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Deviation of last value from initial value.
!*/
Object Deviation $Attribute 5
Body SysBody
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Mininum limit.
! If the last coefficient value is below the MinLimit,
! an alarm message is sent.
!*/
Object MinLimit $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Maximum limit.
! If the last coefficient value exceeds the MaxLimit,
! an alarm message is sent.
!*/
Object MaxLimit $Attribute 7
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Min coefficient value for display.
!*/
Object MinShow $Attribute 8
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Max coefficient value for display.
!*/
Object MaxShow $Attribute 9
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Number of decimals of coefficient value in display.
!*/
Object NoOfDecimals $Attribute 10
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! Current status of the limit check.
!*/
Object Status $Attribute 11
Body SysBody
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Status"
EndBody
EndObject
!/**
! DSupComp object for alarm message.
!*/
Object Sup $Attribute 12
Body SysBody
Attr Flags |= PWR_MASK_CLASS
Attr TypeRef = "pwrb:Class-DSupComp"
EndBody
EndObject
EndObject
Object Template LinRegSupLimit
Body RtBody
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.
!
! pwrb_c_linregsup.wb_load -- Supervision with linear regression.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Supervision,NodeConfiguration
! @Summary Supervision of process parameters with linear regression.
! Supervision of process parameters with linear regression.
!
! @b See Also
! @classlink MaintSupServer pwrb_maintsupserver.html
!*/
Object LinRegSup $ClassDef 713
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "LinRegSup"
EndBody
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object Server $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
Object CondAttr $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$String256"
EndBody
EndObject
Object Attributes $Attribute 4
Body SysBody
Attr Flags |= PWR_MASK_ARRAY
Attr Elements = 10
Attr TypeRef = "pwrs:Type-$String256"
EndBody
EndObject
Object Limits $Attribute 5
Body SysBody
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_CLASS
Attr Elements = 10
Attr TypeRef = "pwrb:Class-LinRegSupLimit"
EndBody
EndObject
Object FormulaFile $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object ScanTime $Attribute 7
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object MeasuringTime $Attribute 8
Body SysBody
Attr TypeRef = "pwrs:Type-$DeltaTime"
EndBody
EndObject
Object PointInterval $Attribute 9
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object MaxNoOfPoints $Attribute 10
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object StdDeviationMinLimit $Attribute 11
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object ScoreMinLimit $Attribute 12
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object CurrentStdDeviation $Attribute 13
Body SysBody
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object CurrentScore $Attribute 14
Body SysBody
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
Object LastScan $Attribute 15
Body SysBody
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Time"
EndBody
EndObject
Object Status $Attribute 16
Body SysBody
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Status"
EndBody
EndObject
EndObject
Object Template LinRegSup
Body RtBody
Attr Limits[0].Sup.DetectText = "Deviation detected"
Attr Limits[0].Sup.EventType = 128
Attr Limits[0].Sup.EventPriority = 67
Attr Limits[0].Sup.EventFlags = 7
Attr Limits[0].Sup.Attribute = "pwrb:Class-LinRegSup-Template.Limits[0]"
Attr Limits[0].Sup.CtrlPosition = 1
Attr Limits[0].Sup.LockAttribute = 1
Attr Limits[1].Sup.DetectText = "Deviation detected"
Attr Limits[1].Sup.EventType = 128
Attr Limits[1].Sup.EventPriority = 67
Attr Limits[1].Sup.EventFlags = 7
Attr Limits[1].Sup.Attribute = "pwrb:Class-LinRegSup-Template.Limits[1]"
Attr Limits[1].Sup.CtrlPosition = 1
Attr Limits[1].Sup.LockAttribute = 1
Attr Limits[2].Sup.DetectText = "Deviation detected"
Attr Limits[2].Sup.EventType = 128
Attr Limits[2].Sup.EventPriority = 67
Attr Limits[2].Sup.EventFlags = 7
Attr Limits[2].Sup.Attribute = "pwrb:Class-LinRegSup-Template.Limits[2]"
Attr Limits[2].Sup.CtrlPosition = 1
Attr Limits[3].Sup.DetectText = "Deviation detected"
Attr Limits[3].Sup.EventType = 128
Attr Limits[3].Sup.EventPriority = 67
Attr Limits[3].Sup.EventFlags = 7
Attr Limits[3].Sup.Attribute = "pwrb:Class-LinRegSup-Template.Limits[3]"
Attr Limits[3].Sup.CtrlPosition = 1
Attr Limits[4].Sup.DetectText = "Deviation detected"
Attr Limits[4].Sup.EventType = 128
Attr Limits[4].Sup.EventPriority = 67
Attr Limits[4].Sup.EventFlags = 7
Attr Limits[4].Sup.Attribute = "pwrb:Class-LinRegSup-Template.Limits[4]"
Attr Limits[4].Sup.CtrlPosition = 1
Attr Limits[5].Sup.DetectText = "Deviation detected"
Attr Limits[5].Sup.EventType = 128
Attr Limits[5].Sup.EventPriority = 67
Attr Limits[5].Sup.EventFlags = 7
Attr Limits[5].Sup.Attribute = "pwrb:Class-LinRegSup-Template.Limits[5]"
Attr Limits[5].Sup.CtrlPosition = 1
Attr Limits[6].Sup.DetectText = "Deviation detected"
Attr Limits[6].Sup.EventType = 128
Attr Limits[6].Sup.EventPriority = 67
Attr Limits[6].Sup.EventFlags = 7
Attr Limits[6].Sup.Attribute = "pwrb:Class-LinRegSup-Template.Limits[6]"
Attr Limits[6].Sup.CtrlPosition = 1
Attr Limits[7].Sup.DetectText = "Deviation detected"
Attr Limits[7].Sup.EventType = 128
Attr Limits[7].Sup.EventPriority = 67
Attr Limits[7].Sup.EventFlags = 7
Attr Limits[7].Sup.Attribute = "pwrb:Class-LinRegSup-Template.Limits[7]"
Attr Limits[7].Sup.CtrlPosition = 1
Attr Limits[8].Sup.DetectText = "Deviation detected"
Attr Limits[8].Sup.EventType = 128
Attr Limits[8].Sup.EventPriority = 67
Attr Limits[8].Sup.EventFlags = 7
Attr Limits[8].Sup.Attribute = "pwrb:Class-LinRegSup-Template.Limits[8]"
Attr Limits[8].Sup.CtrlPosition = 1
Attr Limits[9].Sup.DetectText = "Deviation detected"
Attr Limits[9].Sup.EventType = 128
Attr Limits[9].Sup.EventPriority = 67
Attr Limits[9].Sup.EventFlags = 7
Attr Limits[9].Sup.Attribute = "pwrb:Class-LinRegSup-Template.Limits[9]"
Attr Limits[9].Sup.CtrlPosition = 1
Attr ScanTime = 8.640000e+04
Attr MeasuringTime = "0:30:00.00"
Attr PointInterval = 1.000000e+00
Attr MaxNoOfPoints = 2000
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.
!
! pwrb_c_maintsupserver.wb_load -- Maintainence supervision server.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Supervision,NodeConfiguration
! @Summary Mantainence supervision server.
! Maintainence supervision server.
!
! @b See Also
! @classlink LinRegSup pwrb_linregsup.html
!*/
Object MaintSupServer $ClassDef 714
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "MaintSupServer"
EndBody
Object Description $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object ScanTime $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
EndObject
Object Template MaintSupServer
Body RtBody
Attr ScanTime = 2.000000e+00
EndBody
EndObject
EndObject
EndSObject
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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