Commit adedcb65 authored by Claes Sjofors's avatar Claes Sjofors

Sev import server added, and GetExt... fix for dynamic objects

parent bbe2e951
...@@ -119,7 +119,7 @@ int sev_import::init(void) ...@@ -119,7 +119,7 @@ int sev_import::init(void)
if (EVEN(m_sts)) if (EVEN(m_sts))
throw co_error(m_sts); throw co_error(m_sts);
sts = gdh_GetClassList(pwr_cClass_SevServer, &conf_oid); sts = gdh_GetClassList(pwr_cClass_SevImportServer, &conf_oid);
if (EVEN(sts)) { if (EVEN(sts)) {
errh_CErrLog(PWR__SRVNOTCONF, 0); errh_CErrLog(PWR__SRVNOTCONF, 0);
exit(0); exit(0);
......
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
tree_sTable* m_refid; tree_sTable* m_refid;
unsigned int m_msg_id; unsigned int m_msg_id;
pwr_tStatus m_server_status; pwr_tStatus m_server_status;
pwr_sClass_SevServer* m_config; pwr_sClass_SevImportServer* m_config;
pwr_tDlid m_config_dlid; pwr_tDlid m_config_dlid;
std::vector<sev_exportitem> m_items; std::vector<sev_exportitem> m_items;
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
#define cPrio_report (cPrio_base + 5) #define cPrio_report (cPrio_base + 5)
#define cPrio_sevhistmon (cPrio_base + 15) #define cPrio_sevhistmon (cPrio_base + 15)
#define cPrio_sev_server (cPrio_base + 15) #define cPrio_sev_server (cPrio_base + 15)
#define cPrio_sev_import (cPrio_base + 15)
#define cPrio_powerlink (cPrio_base + 15) #define cPrio_powerlink (cPrio_base + 15)
#define cPrio_plc_init (cPrio_base + 5) #define cPrio_plc_init (cPrio_base + 5)
#define cPrio_remh (cPrio_base + 5) #define cPrio_remh (cPrio_base + 5)
...@@ -201,6 +202,10 @@ void ini_ProcTable(pwr_tStatus* status, ini_sContext* cp) ...@@ -201,6 +202,10 @@ void ini_ProcTable(pwr_tStatus* status, ini_sContext* cp)
"sev_server", cPrio_sev_server, 0, pwr_cClass_SevServer, "", 0); "sev_server", cPrio_sev_server, 0, pwr_cClass_SevServer, "", 0);
pp->proc.flags.b.system = 1; pp->proc.flags.b.system = 1;
pp = ini_ProcInsert(sts, cp, "pwr_sev_import", "pwr_sev_import_%d", 0, 1,
"sev_import", cPrio_sev_import, 0, pwr_cClass_SevImportServer, "", 0);
pp->proc.flags.b.system = 1;
pp = ini_ProcInsert(sts, cp, "pwr_powerlink", "pwr_powerlink_%d", 0, 1, pp = ini_ProcInsert(sts, cp, "pwr_powerlink", "pwr_powerlink_%d", 0, 1,
"rt_powerlink", cPrio_powerlink, 0, pwr_cClass_EplHandler, "", 0); "rt_powerlink", cPrio_powerlink, 0, pwr_cClass_EplHandler, "", 0);
pp->proc.flags.b.system = 1; pp->proc.flags.b.system = 1;
......
...@@ -509,11 +509,11 @@ static void link_io_base_areas(plc_sProcess* pp) ...@@ -509,11 +509,11 @@ static void link_io_base_areas(plc_sProcess* pp)
pp->IOHandler->IiCount * sizeof(pwr_tUInt64)); pp->IOHandler->IiCount * sizeof(pwr_tUInt64));
dlink_area((plc_sDlink*)&pp->base.io_i, "pwrNode-active-io-io_init", dlink_area((plc_sDlink*)&pp->base.io_i, "pwrNode-active-io-io_init",
pp->IOHandler->IoCount * sizeof(pwr_tUInt64)); pp->IOHandler->IoCount * sizeof(pwr_tUInt64));
dlink_area((plc_sDlink*)&pp->base.atv_i, "pwrNode-active-io-iatv_init", dlink_area((plc_sDlink*)&pp->base.atv_i, "pwrNode-active-io-atv_init",
pp->IOHandler->ATvCount * sizeof(pwr_tTime)); pp->IOHandler->ATvCount * sizeof(pwr_tTime));
dlink_area((plc_sDlink*)&pp->base.dtv_i, "pwrNode-active-io-idtv_init", dlink_area((plc_sDlink*)&pp->base.dtv_i, "pwrNode-active-io-dtv_init",
pp->IOHandler->DTvCount * sizeof(pwr_tDeltaTime)); pp->IOHandler->DTvCount * sizeof(pwr_tDeltaTime));
dlink_area((plc_sDlink*)&pp->base.sv_i, "pwrNode-active-io-isv_init", dlink_area((plc_sDlink*)&pp->base.sv_i, "pwrNode-active-io-sv_init",
pp->IOHandler->SvCount * sizeof(pwr_tString80)); pp->IOHandler->SvCount * sizeof(pwr_tString80));
dlink_area((plc_sDlink*)&pp->base.bi_i, "pwrNode-active-io-bi_init", dlink_area((plc_sDlink*)&pp->base.bi_i, "pwrNode-active-io-bi_init",
pp->IOHandler->BiCount * sizeof(pwr_tUInt64)); pp->IOHandler->BiCount * sizeof(pwr_tUInt64));
......
...@@ -3236,6 +3236,11 @@ pwr_tStatus gdh_RefObjectInfoList( ...@@ -3236,6 +3236,11 @@ pwr_tStatus gdh_RefObjectInfoList(
char* s; char* s;
pwr_tStatus lsts; pwr_tStatus lsts;
if ( sts == GDH__NODYNLOCOBJ) {
rsts = sts;
continue;
}
dl = 0; dl = 0;
/* Check if this is an erroneous local attribute */ /* Check if this is an erroneous local attribute */
......
...@@ -172,6 +172,8 @@ struct plc_sThread { ...@@ -172,6 +172,8 @@ struct plc_sThread {
redu_tCtx redu; redu_tCtx redu;
int tim_copy_lock; int tim_copy_lock;
int str_copy_lock; int str_copy_lock;
unsigned int ext_retry_connect;
unsigned int ext_retry_connect_cnt;
}; };
struct plc_sProcess { struct plc_sProcess {
......
This diff is collapsed.
...@@ -535,6 +535,15 @@ static void scan(plc_sThread* tp) ...@@ -535,6 +535,15 @@ static void scan(plc_sThread* tp)
plc_sProcess* pp = tp->pp; plc_sProcess* pp = tp->pp;
int delay_action = 0; int delay_action = 0;
if ( tp->ext_retry_connect_cnt > (int)(5.0/tp->f_scan_time)) {
tp->ext_retry_connect = 1;
tp->ext_retry_connect_cnt = 0;
}
else {
tp->ext_retry_connect = 0;
tp->ext_retry_connect_cnt++;
}
// time_Uptime(&sts, &tp->before_scan, NULL); // time_Uptime(&sts, &tp->before_scan, NULL);
time_GetTimeMonotonic(&tp->before_scan); time_GetTimeMonotonic(&tp->before_scan);
time_GetTime(&tp->before_scan_abs); time_GetTime(&tp->before_scan_abs);
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "rt_vol.h" #include "rt_vol.h"
#include "rt_cvolc.h" #include "rt_cvolc.h"
#include "rt_sub.h" #include "rt_sub.h"
#include "pwr_systemclasses.h"
gdb_sAliasServer* vol_AddAliasClient(pwr_tStatus* sts, gdb_sObject* op) gdb_sAliasServer* vol_AddAliasClient(pwr_tStatus* sts, gdb_sObject* op)
{ {
...@@ -532,16 +533,18 @@ mvol_sAttribute* vol_BlockNameToAttribute(pwr_tStatus* sts, mvol_sAttribute* ap, ...@@ -532,16 +533,18 @@ mvol_sAttribute* vol_BlockNameToAttribute(pwr_tStatus* sts, mvol_sAttribute* ap,
gdb_AssumeLocked; gdb_AssumeLocked;
strcpy(aname, ""); strcpy(aname, "");
for ( i = 0; i < pn->nObject; i++) { for (i = 0; i < pn->nObject; i++) {
strcat(aname, pn->object[i].name.orig); strcat(aname, pn->object[i].name.orig);
strcat(aname, "-"); strcat(aname, "-");
} }
for ( i = 0; i < pn->nAttribute; i++) { for (i = 0; i < pn->nAttribute; i++) {
strcat(aname, pn->attribute[i].name.orig); strcat(aname, pn->attribute[i].name.orig);
if ( i != pn->nAttribute - 1) if ( i != pn->nAttribute - 1)
strcat(aname, "-"); strcat(aname, "-");
} }
strcat(aname, ".Value"); strcat(aname, ".Value");
if (pn->hasIndex[pn->nAttribute-1])
sprintf(&aname[strlen(aname)], "[%d]", pn->index[pn->nAttribute-1]);
cdh_ParseName(sts, pn, pn->poid, aname, pn->parseFlags.m); cdh_ParseName(sts, pn, pn->poid, aname, pn->parseFlags.m);
...@@ -668,8 +671,11 @@ gdb_sObject* vol_NameToObject(pwr_tStatus* sts, cdh_sParseName* pn, ...@@ -668,8 +671,11 @@ gdb_sObject* vol_NameToObject(pwr_tStatus* sts, cdh_sParseName* pn,
vp = pool_Address(NULL, gdbroot->pool, pop->l.vr); vp = pool_Address(NULL, gdbroot->pool, pop->l.vr);
if (vp->l.flags.b.isMounted && vp->l.flags.b.isCached) if (vp->l.flags.b.isMounted && vp->l.flags.b.isCached)
return cvolc_NameToObject(sts, pop, pn, i, trans); return cvolc_NameToObject(sts, pop, pn, i, trans);
else else {
if ( vp->g.cid == pwr_cClass_SystemVolume)
*sts = GDH__NODYNLOCOBJ;
return NULL; return NULL;
}
} }
} }
...@@ -1269,6 +1275,10 @@ gdb_sObject* vol_TranslateObject(pwr_tStatus* sts, gdb_sObject* op, ...@@ -1269,6 +1275,10 @@ gdb_sObject* vol_TranslateObject(pwr_tStatus* sts, gdb_sObject* op,
if (op != NULL && op->g.flags.b.isMountClient && trans.b.mount) { if (op != NULL && op->g.flags.b.isMountClient && trans.b.mount) {
vp = pool_Address(NULL, gdbroot->pool, op->l.vr); vp = pool_Address(NULL, gdbroot->pool, op->l.vr);
if (vp->l.flags.b.transMount) { if (vp->l.flags.b.transMount) {
if (cdh_ObjidIsNull(op->g.soid) && op->g.cid == pwr_cClass_MountDynObject) {
*sts = GDH__NODYNLOCOBJ;
return NULL;
}
op = vol_OidToObject(sts, op->g.soid, lo_flags, trans.m, cvol_eHint_none); op = vol_OidToObject(sts, op->g.soid, lo_flags, trans.m, cvol_eHint_none);
} }
} }
......
...@@ -103,6 +103,7 @@ readonly <Object or attribute is read only> /error ...@@ -103,6 +103,7 @@ readonly <Object or attribute is read only> /error
remotemount <Remotly mounted object> /error remotemount <Remotly mounted object> /error
dblock <Unable to map db lock> /error dblock <Unable to map db lock> /error
connlost <Connection lost> /error connlost <Connection lost> /error
nodynlocobj <noexisting dynamic local object> /error
.end .end
!
! 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_sevimportserver.wb_load -- Defines the class SevImportServer.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group Servers,NodeConfiguration
! Configures the Sev import server process.
!
! Configures the server import process.
!
! @b See also
! @classlink SevHistThread pwrb_sevhistthread.html
! @classlink SevHistMonitor pwrb_sevhistmonitor.html
! @classlink SevExport pwrb_sevexport.html
!*/
Object SevImportServer $ClassDef 710
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "SevImportServer"
EndBody
!/**
! Optional description.
!*/
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Calculate mean value on all items.
!*/
Object MeanValueAll $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Interval for calcuation of mean value for items
! with the MeanValue1 bit set in options.
!*/
Object MeanValueInterval1 $Attribute 7
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! Interval for calcuation of mean value for items
! with the MeanValue2 bit set in options.
!*/
Object MeanValueInterval2 $Attribute 8
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
EndObject
Object Template SevImportServer
Body RtBody
Attr MeanValueInterval1 = 10
Attr MeanValueInterval2 = 30
EndBody
EndObject
EndObject
EndSObject
...@@ -13825,8 +13825,8 @@ int gcg_comp_m64(gcg_ctx gcgctx, vldh_t_node node) ...@@ -13825,8 +13825,8 @@ int gcg_comp_m64(gcg_ctx gcgctx, vldh_t_node node)
return sts; return sts;
/* Print the execute command */ /* Print the execute command */
IF_PR fprintf(gcgctx->files[GCGM1_CODE_FILE], "%s_exec( %c%s);\n", name, IF_PR fprintf(gcgctx->files[GCGM1_CODE_FILE], "%s_exec( %c%s, \"%s\");\n", name,
GCG_PREFIX_REF, vldh_IdToStr(0, node->ln.oid)); GCG_PREFIX_REF, vldh_IdToStr(0, node->ln.oid), extattr_ptr);
/* Print the init command */ /* Print the init command */
IF_PR fprintf(gcgctx->files[GCGM1_REF_FILE], "%s_init( %c%s, \"%s\");\n", IF_PR fprintf(gcgctx->files[GCGM1_REF_FILE], "%s_init( %c%s, \"%s\");\n",
......
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 glow_growbararc_h
#define glow_growbararc_h
#include "glow_growarc.h"
/*! \file glow_growbararc.h
\brief Contains the GrowBarArc class. */
/*! \addtogroup Glow */
/*@{*/
//! Class for drawing an axis object.
/*! A GrowBarArc object is an object that displays a circular bar.
The GrowBarArc class contains function for drawing the object, and handle
events when the
object is clicked on, moved etc.
*/
class GrowBarArc : public GrowArc {
public:
//! Constuctor
/*!
\param glow_ctx The glow context.
\param name Name (max 31 char).
\param x1 x coordinate for first corner.
\param y1 y coordinate for first corner.
\param x2 x coordinate for second corner.
\param y2 y coordinate for second corner.
\param border_d_type Border color.
\param line_w Linewidth of border.
\param t_size Text size.
\param t_drawtype Drawtype for text.
\param nodraw Don't draw the object now.
*/
GrowBarArc(GrowCtx* glow_ctx, const char* name, double x1 = 0, double y1 = 0,
double x2 = 0, double y2 = 0, int ang1 = 0, int ang2 = 0, double width = 1, int border = 0,
glow_eDrawType border_d_type = glow_eDrawType_Line, int line_w = 1,
glow_eDrawType fill_d_type = glow_eDrawType_Line, int nodraw = 0);
//! Destructorx
/*! Remove the object from context, and erase it from the screen.
*/
~GrowBarArc();
//! Save the content of the object to file.
/*!
\param fp Ouput file.
\param mode Not used.
*/
void save(std::ofstream& fp, glow_eSaveMode mode);
//! Read the content of the object from file.
/*!
\param fp Input file.
*/
void open(std::ifstream& fp);
//! Erase the object
void erase(GlowWind* w)
{
erase(w, (GlowTransform*)NULL, hot, NULL);
}
//! Draw the objects if any part is inside the drawing area.
/*!
\param ll_x Lower left x coordinate of drawing area.
\param ll_y Lower left y coordinate of drawing area.
\param ur_x Upper right x coordinate of drawing area.
\param ur_y Upper right y coordinate of drawing area.
*/
void draw(GlowWind* w, int ll_x, int ll_y, int ur_x, int ur_y);
//! Draw the objects if any part is inside the drawing area, and extends the
//! drawing area.
/*!
\param ll_x Lower left x coordinate of drawing area.
\param ll_y Lower left y coordinate of drawing area.
\param ur_x Upper right x coordinate of drawing area.
\param ur_y Upper right y coordinate of drawing area.
If some part of object is inside the drawing area, and also outside the
drawing area,
the drawingarea is extended so it contains the whole objects.
*/
void draw(GlowWind* w, int* ll_x, int* ll_y, int* ur_x, int* ur_y);
//! Set object highlight.
/*!
\param on If 1, set highlight. If 0, reset highlight.
*/
void set_highlight(int on);
//! Get the object type
/*!
\return The type of the object.
*/
glow_eObjectType type()
{
return glow_eObjectType_GrowBarArc;
}
double max_value; //!< Max value for the scale.
double min_value; //!< Min value for the scale.
double bar_width; //!< Bar width.
double bar_value; //!< Bar value.
glow_eDrawType bar_drawtype; //!< Color the bar is drawn with.
glow_eDrawType
bar_bordercolor; //!< Color the border of the bar is drawn with.
int bar_borderwidth; //!< With of the border of the bar.
int bar_direction; //!< Bar direction.
GlowTraceData trace; //!< Almost obsolete
//! Erase the object.
/*!
\param t Transform of parent node.
\param hot Draw as hot, with larger line width.
\param node Parent node. Can be zero.
*/
void erase(GlowWind* w, GlowTransform* t, int hot, void* node);
//! Draw the object.
/*!
\param t Transform of parent node. Can be zero.
\param highlight Draw with highlight colors.
\param hot Draw as hot, with larger line width.
\param node Parent node. Can be zero.
\param colornode The node that controls the color of the object. Can be
zero.
The object is drawn with border, fill and shadow. If t is not zero, the
current tranform is
multiplied with the parentnodes transform, to give the appropriate
coordinates for the drawing.
*/
void draw(GlowWind* w, GlowTransform* t, int highlight, int hot, void* node,
void* colornode);
//! Redraw the area inside the objects border.
void draw();
//! Moves object to alignment line or point.
/*!
\param x x coordinate of alignment point.
\param y y coordinate of alignment point.
\param direction Type of alignment.
*/
void align(double x, double y, glow_eAlignDirection direction);
//! Get the range for the bar value
/*!
\param min Min value.
\param max Max value.
*/
void get_range(double *min, double *max);
//! Set the range for the bar value
/*!
\param min Min value.
\param max Max value.
*/
void set_range(double min, double max);
//! Set the bar value
/*!
\param value Bar value.
*/
void set_value(double value)
{
bar_value = value;
if (!fill)
erase(&ctx->mw);
draw();
}
//! Set parameters for the bar.
/*!
\param info Info struct.
*/
void set_bar_info(glow_sBarInfo* info);
//! Get parameters for the bar.
/*!
\param info Info struct.
*/
void get_bar_info(glow_sBarInfo* info);
//! Export the object as a javabean.
/*!
\param t Transform of parent node. Can be zero.
\param node Parent node. Can be zero.
\param pass Export pass.
\param shape_cnt Current index in a shape std::vector.
\param node_cnt Counter used for javabean name. Not used for this kind
of
object.
\param in_nc Member of a nodeclass. Not used for this kind of object.
\param fp Output file.
The object is transformed to the current zoom factor, and GlowExportJBean is
used to generate
java code for the bean.
*/
void export_javabean(GlowTransform* t, void* node, glow_eExportPass pass,
int* shape_cnt, int node_cnt, int in_nc, std::ofstream& fp);
//! Scan trace
/*! Calls the trace scan callback for the object.
*/
int trace_scan();
//! Init trace
/*! Calls the trace connect callback for the object.
*/
int trace_init();
//! Close trace
/*! Calls the trace disconnect callback for the object.
*/
void trace_close();
//! Conversion between different versions of Glow
/*!
\param version Version to convert to.
*/
void convert(glow_eConvert version);
};
/*@}*/
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment