Commit f08dacd0 authored by Marcus Nordenberg's avatar Marcus Nordenberg

Merge branch 'master' of /data1/x0-0-0/pwr

parents a0430a7b a51b95ab
...@@ -570,6 +570,7 @@ void CompOnOffZoneFo_exec(plc_sThread* tp, pwr_sClass_CompOnOffZoneFo* o) ...@@ -570,6 +570,7 @@ void CompOnOffZoneFo_exec(plc_sThread* tp, pwr_sClass_CompOnOffZoneFo* o)
2015 - 12 - 19 Bruno: initial object. v0.1 2015 - 12 - 19 Bruno: initial object. v0.1
2016 - 04 - 11 Bruno: cleaning. v0.2 2016 - 04 - 11 Bruno: cleaning. v0.2
2017 - 04 - 14 Bruno: remove "division by zero" potential bugs v0.3 2017 - 04 - 14 Bruno: remove "division by zero" potential bugs v0.3
2019 - 08 - 31 Bruno: add missing links for Trim_SP and FF inputs: copy IMC_Fo to IMC
*/ */
#define MAXCELLS 100 #define MAXCELLS 100
...@@ -731,6 +732,8 @@ void CompIMC_Fo_exec(plc_sThread* tp, pwr_sClass_CompIMC_Fo* plc_obj) ...@@ -731,6 +732,8 @@ void CompIMC_Fo_exec(plc_sThread* tp, pwr_sClass_CompIMC_Fo* plc_obj)
plant_obj->PV = *plc_obj->PVP; // Process value: copy IMC_Fo to IMC plant_obj->PV = *plc_obj->PVP; // Process value: copy IMC_Fo to IMC
plant_obj->SP = *plc_obj->SPP; // Setpoint value: copy IMC_Fo to IMC plant_obj->SP = *plc_obj->SPP; // Setpoint value: copy IMC_Fo to IMC
plant_obj->aut = *plc_obj->autP; // Auto input: copy IMC_Fo to IMC plant_obj->aut = *plc_obj->autP; // Auto input: copy IMC_Fo to IMC
plant_obj->FF = *plc_obj->FFP; // FF: copy IMC_Fo to IMC
plant_obj->Trim_SP = *plc_obj->Trim_SPP; // Trim_SP: copy IMC_Fo to IMC
LSP = plant_obj->SP + plant_obj->Trim_SP; // Calculate working setpoint LSP = plant_obj->SP + plant_obj->Trim_SP; // Calculate working setpoint
LSP = CLAMP(LSP, plant_obj->LL_SP, plant_obj->HL_SP); // Apply limits LSP = CLAMP(LSP, plant_obj->LL_SP, plant_obj->HL_SP); // Apply limits
......
...@@ -469,7 +469,7 @@ int main(int argc, char* argv[]) ...@@ -469,7 +469,7 @@ int main(int argc, char* argv[])
{ {
remtrans_item* remtrans; remtrans_item* remtrans;
unsigned char id[32]; unsigned char id[32];
unsigned char pname[32]; unsigned char pname[80];
pwr_tStatus sts; pwr_tStatus sts;
int i; int i;
float time_since_scan = 0.0; float time_since_scan = 0.0;
......
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
#include "sev_dbms.h" #include "sev_dbms.h"
static unsigned int mysql_timeout = 315360000;
static bool mysql_enable_reconnect = true;
char sev_dbms_env::m_systemName[40]; char sev_dbms_env::m_systemName[40];
sev_dbms_env::sev_dbms_env(const char* v_fileName) sev_dbms_env::sev_dbms_env(const char* v_fileName)
...@@ -276,6 +279,7 @@ int sev_dbms_env::create(const char* v_fileName, const char* v_host, ...@@ -276,6 +279,7 @@ int sev_dbms_env::create(const char* v_fileName, const char* v_host,
MYSQL* sev_dbms_env::createDb(void) MYSQL* sev_dbms_env::createDb(void)
{ {
if (mysql_library_init(0, NULL, NULL)) { if (mysql_library_init(0, NULL, NULL)) {
printf("** Cannot init mysql client library\n"); printf("** Cannot init mysql client library\n");
return 0; return 0;
...@@ -283,6 +287,9 @@ MYSQL* sev_dbms_env::createDb(void) ...@@ -283,6 +287,9 @@ MYSQL* sev_dbms_env::createDb(void)
m_con = mysql_init(NULL); m_con = mysql_init(NULL);
mysql_options(m_con, MYSQL_OPT_CONNECT_TIMEOUT, &mysql_timeout);
mysql_options(m_con, MYSQL_OPT_RECONNECT, &mysql_enable_reconnect);
MYSQL* con = mysql_real_connect( MYSQL* con = mysql_real_connect(
m_con, host(), user(), passwd(), 0, port(), socket(), 0); m_con, host(), user(), passwd(), 0, port(), socket(), 0);
// printf("Tried to connect to database, con %x: Status: %s\n", (int)con, // printf("Tried to connect to database, con %x: Status: %s\n", (int)con,
...@@ -679,6 +686,9 @@ MYSQL* sev_dbms_env::openDb(unsigned int* sts) ...@@ -679,6 +686,9 @@ MYSQL* sev_dbms_env::openDb(unsigned int* sts)
m_con = mysql_init(NULL); m_con = mysql_init(NULL);
mysql_options(m_con, MYSQL_OPT_CONNECT_TIMEOUT, &mysql_timeout);
mysql_options(m_con, MYSQL_OPT_RECONNECT, &mysql_enable_reconnect);
MYSQL* con = mysql_real_connect( MYSQL* con = mysql_real_connect(
m_con, host(), user(), passwd(), dbName(), port(), socket(), 0); m_con, host(), user(), passwd(), dbName(), port(), socket(), 0);
if (con == 0) { if (con == 0) {
...@@ -693,6 +703,9 @@ MYSQL* sev_dbms_env::open_thread(unsigned int* sts) ...@@ -693,6 +703,9 @@ MYSQL* sev_dbms_env::open_thread(unsigned int* sts)
{ {
MYSQL* con = mysql_init(NULL); MYSQL* con = mysql_init(NULL);
mysql_options(con, MYSQL_OPT_CONNECT_TIMEOUT, &mysql_timeout);
mysql_options(con, MYSQL_OPT_RECONNECT, &mysql_enable_reconnect);
con = mysql_real_connect( con = mysql_real_connect(
con, host(), user(), passwd(), dbName(), port(), socket(), 0); con, host(), user(), passwd(), dbName(), port(), socket(), 0);
if (con == 0) { if (con == 0) {
...@@ -1011,7 +1024,7 @@ int sev_dbms::delete_table(pwr_tStatus* sts, char* tablename) ...@@ -1011,7 +1024,7 @@ int sev_dbms::delete_table(pwr_tStatus* sts, char* tablename)
int sev_dbms::create_event_table( int sev_dbms::create_event_table(
pwr_tStatus* sts, char* tablename, pwr_tMask options) pwr_tStatus* sts, char* tablename, pwr_tMask options)
{ {
char query[540]; char query[580];
char timeformatstr[80]; char timeformatstr[80];
char jumpstr[80]; char jumpstr[80];
char idtypestr[20]; char idtypestr[20];
...@@ -2629,6 +2642,8 @@ int sev_dbms::store_event( ...@@ -2629,6 +2642,8 @@ int sev_dbms::store_event(
if (!result) { if (!result) {
printf("In %s row %d:\n", __FILE__, __LINE__); printf("In %s row %d:\n", __FILE__, __LINE__);
printf("%s Result Error\n", __FUNCTION__); printf("%s Result Error\n", __FUNCTION__);
*sts = SEV__DBERROR;
return 0;
} }
int rows = mysql_num_rows(result); int rows = mysql_num_rows(result);
......
...@@ -272,6 +272,9 @@ def process(o): ...@@ -272,6 +272,9 @@ def process(o):
o.setSts(sts) o.setSts(sts)
# Init gdh
pwrrt.init('MaintSupServer')
# Get server object # Get server object
cid = pwrrt.Cid('MaintSupServer') cid = pwrrt.Cid('MaintSupServer')
server = None server = None
......
!
! 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_blockattrboolean.wb_load -- Defines the class BlockAttrBoolean.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Boolean block attribute.
! Configuration of a block attribute of type boolean.
!
! @b See also
! @classlink BlockAttribute pwrs_blockattribute.html
!*/
Object BlockAttrBoolean $ClassDef 715
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "BlockAttrBoolean"
EndBody
!/**
! Superclass
!*/
Object Super $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Class-$BlockAttribute"
Attr Flags |= PWR_MASK_CLASS
Attr Flags |= PWR_MASK_SUPERCLASS
EndBody
EndObject
!/**
! Attribute value.
!*/
Object Value $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
EndObject
Object Template BlockAttrBoolean
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_blockattrfloat32.wb_load -- Defines the class BlockAttrFloat32.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Float32 block attribute.
! Configuration of a block attribute of type Float32.
!
! @b See also
! @classlink BlockAttribute pwrs_blockattribute.html
!*/
Object BlockAttrFloat32 $ClassDef 716
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "BlockAttrFloat32"
EndBody
!/**
! Superclass
!*/
Object Super $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Class-$BlockAttribute"
Attr Flags |= PWR_MASK_CLASS
Attr Flags |= PWR_MASK_SUPERCLASS
EndBody
EndObject
!/**
! Attribute value.
!*/
Object Value $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
EndObject
Object Template BlockAttrFloat32
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_blockattrint32.wb_load -- Defines the class BlockAttrInt32.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary Int32 block attribute.
! Configuration of a block attribute of type Int32.
!
! @b See also
! @classlink BlockAttribute pwrs_blockattribute.html
!*/
Object BlockAttrInt32 $ClassDef 717
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "BlockAttrInt32"
EndBody
!/**
! Superclass
!*/
Object Super $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Class-$BlockAttribute"
Attr Flags |= PWR_MASK_CLASS
Attr Flags |= PWR_MASK_SUPERCLASS
EndBody
EndObject
!/**
! Attribute value.
!*/
Object Value $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
EndObject
Object Template BlockAttrInt32
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_blockattrstring.wb_load -- Defines the class BlockAttrString.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Summary String block attribute.
! Configuration of a block attribute of type String80.
!
! @b See also
! @classlink BlockAttribute pwrs_blockattribute.html
!*/
Object BlockAttrString $ClassDef 718
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "BlockAttrString"
EndBody
!/**
! Superclass
!*/
Object Super $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Class-$BlockAttribute"
Attr Flags |= PWR_MASK_CLASS
Attr Flags |= PWR_MASK_SUPERCLASS
EndBody
EndObject
!/**
! Attribute value.
!*/
Object Value $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
EndObject
Object Template BlockAttrString
EndObject
EndObject
EndSObject
...@@ -40,6 +40,15 @@ SObject pwrs:Class ...@@ -40,6 +40,15 @@ SObject pwrs:Class
! @Group ClassDefinition ! @Group ClassDefinition
! Definition a block. ! Definition a block.
! !
! A block a kind of object without a class. It's built by a set of objects
! with $Block, $SubBlock and subclasses of $BlockAttribute, and presented
! at runtime in shape of an object.
!
! $Block is the root of a block object.
!
! @b See also
! @classlink $SubBlock pwrs_subblock.html
! @classlink $BlockAttribute pwrs_blockattribute.html
!*/ !*/
! !
Object $Block $ClassDef pwr_eCix_Block Object $Block $ClassDef pwr_eCix_Block
......
...@@ -39,6 +39,14 @@ SObject pwrs:Class ...@@ -39,6 +39,14 @@ SObject pwrs:Class
!/** !/**
! @Group ClassDefinition ! @Group ClassDefinition
! Definition of a block attribute. ! Definition of a block attribute.
!
! $BlockAttribute is a superclass for objects that defines attributes
! in block objects. The subclass should contain a Value attribute
! that keeps the block attribute value.
!
! @b See also
! @classlink $Block pwrs_block.html
! @classlink $SubBlock pwrs_subblock.html
!*/ !*/
! !
Object $BlockAttribute $ClassDef pwr_eCix_BlockAttribute Object $BlockAttribute $ClassDef pwr_eCix_BlockAttribute
......
...@@ -40,6 +40,11 @@ SObject pwrs:Class ...@@ -40,6 +40,11 @@ SObject pwrs:Class
! @Group ClassDefinition ! @Group ClassDefinition
! Definition a subblock. ! Definition a subblock.
! !
! $SubBlock is the root of a block element in a block object.
!
! @b See also
! @classlink $Block pwrs_block.html
! @classlink $BlockAttribute pwrs_blockattribute.html
!*/ !*/
! !
Object $SubBlock $ClassDef pwr_eCix_SubBlock Object $SubBlock $ClassDef pwr_eCix_SubBlock
......
...@@ -1829,6 +1829,7 @@ pwr_tStatus lfu_SaveDirectoryVolume( ...@@ -1829,6 +1829,7 @@ pwr_tStatus lfu_SaveDirectoryVolume(
found = 1; found = 1;
break; break;
} }
sts = ldh_GetNextSibling(ldhses, volobjid, &volobjid);
} }
if (!found) { if (!found) {
char msg[200]; char msg[200];
......
...@@ -3639,7 +3639,7 @@ static int graph_getobjecttext_func(void* filectx, ccm_sArg* arg_list, ...@@ -3639,7 +3639,7 @@ static int graph_getobjecttext_func(void* filectx, ccm_sArg* arg_list,
Graph* graph; Graph* graph;
int type; int type;
grow_tObject o; grow_tObject o;
char text[200]; char text[K_STRING_SIZE];
if (arg_count != 1) if (arg_count != 1)
return CCM__ARGMISM; return CCM__ARGMISM;
...@@ -3653,7 +3653,7 @@ static int graph_getobjecttext_func(void* filectx, ccm_sArg* arg_list, ...@@ -3653,7 +3653,7 @@ static int graph_getobjecttext_func(void* filectx, ccm_sArg* arg_list,
type = grow_GetObjectType(o); type = grow_GetObjectType(o);
if (type == glow_eObjectType_GrowText) { if (type == glow_eObjectType_GrowText) {
grow_GetObjectText(o, text, sizeof(text)); grow_GetObjectText(o, text, sizeof(text));
strncpy(return_string, text, sizeof(text)); strncpy(return_string, text, sizeof(K_STRING_SIZE));
} else } else
strcpy(return_string, ""); strcpy(return_string, "");
......
...@@ -2008,9 +2008,12 @@ void GlowDrawQt::pop_customcolors() ...@@ -2008,9 +2008,12 @@ void GlowDrawQt::pop_customcolors()
{ {
if (customcolors_cnt <= 0) { if (customcolors_cnt <= 0) {
printf("** Customcolor stack disorder\n"); printf("** Customcolor stack disorder\n");
return;
} }
for (int i = 0; i < customcolors_cnt - 1; i++) for (int i = 0; i < customcolors_cnt - 1; i++) {
customcolors[i] = customcolors[i + 1]; customcolors[i] = customcolors[i + 1];
customcolors[i + 1] = NULL;
}
customcolors_cnt--; customcolors_cnt--;
} }
......
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