Commit 8599aa47 authored by Claes Sjofors's avatar Claes Sjofors

DSupComp and ASupComp added

parent 3a72aa92
Proview Android application PwrXtt build. Proview Android application PwrXtt build.
The android-sdk has to be installed under /usr/local.
The build script java/aapp/bld/src/os_templ/hw_templ/pwrxtt_build.sh and the The build script java/aapp/bld/src/os_templ/hw_templ/pwrxtt_build.sh and the
make files under java/appl creates an android application tree under make files under java/appl creates an android application tree under
$pwre_broot/os_linux/hw_x86/bld/aapp. $pwre_broot/os_linux/hw_x86/bld/aapp.
...@@ -23,6 +25,6 @@ The application PwrXtt can be imported to eclipse by stating ...@@ -23,6 +25,6 @@ The application PwrXtt can be imported to eclipse by stating
$pwre_sroot/os_linux/hw_x86/bld/aapp as work directory. Import the project with $pwre_sroot/os_linux/hw_x86/bld/aapp as work directory. Import the project with
File/Import/General/Existing Projects... Activate Android Tools/Fix Project Properties File/Import/General/Existing Projects... Activate Android Tools/Fix Project Properties
in the popup menu for the project. After this the application can be run and debugged. in the popup menu for the project. After this the application can be run and debugged.
Any changed in the java code should be copied back to source code in java/jwpr and Any changes in the java code should be copied back to source code in java/jpwr and
java/aapp. java/aapp.
...@@ -111,7 +111,9 @@ typedef struct s_SaveBlock sSaveBlock; ...@@ -111,7 +111,9 @@ typedef struct s_SaveBlock sSaveBlock;
typedef struct s_Sup sSup; typedef struct s_Sup sSup;
typedef struct s_Timer sTimer; typedef struct s_Timer sTimer;
typedef struct s_ASup sASup; typedef struct s_ASup sASup;
typedef struct s_ASupComp sASupComp;
typedef struct s_DSup sDSup; typedef struct s_DSup sDSup;
typedef struct s_DSupComp sDSupComp;
typedef union u_Event uEvent; typedef union u_Event uEvent;
LstType(sActive); LstType(sActive);
...@@ -291,6 +293,7 @@ struct s_SupActive { ...@@ -291,6 +293,7 @@ struct s_SupActive {
void *supInfoP; void *supInfoP;
void *op; void *op;
sTimer *timer; sTimer *timer;
pwr_tCid cid;
void (*detect_exec)(sSupActive *sp); void (*detect_exec)(sSupActive *sp);
}; };
...@@ -302,6 +305,12 @@ struct s_ASup { ...@@ -302,6 +305,12 @@ struct s_ASup {
sTimer Timer pwr_dAlignLW; sTimer Timer pwr_dAlignLW;
}; };
struct s_ASupComp {
sSup Sup pwr_dAlignLW;
mh_sASupInfo Info pwr_dAlignW;
sTimer Timer pwr_dAlignLW;
};
struct s_DSup { struct s_DSup {
pwr_tBoolean *InP pwr_dAlignLW; pwr_tBoolean *InP pwr_dAlignLW;
pwr_tBoolean In pwr_dAlignLW; pwr_tBoolean In pwr_dAlignLW;
...@@ -310,6 +319,12 @@ struct s_DSup { ...@@ -310,6 +319,12 @@ struct s_DSup {
sTimer Timer pwr_dAlignLW; sTimer Timer pwr_dAlignLW;
}; };
struct s_DSupComp {
sSup Sup pwr_dAlignLW;
mh_sDSupInfo Info pwr_dAlignW;
sTimer Timer pwr_dAlignLW;
};
struct s_ApplActive { struct s_ApplActive {
sActive link; sActive link;
LstLink(sApplActive) active_l; LstLink(sApplActive) active_l;
...@@ -2611,6 +2626,8 @@ initSupActiveCB ( ...@@ -2611,6 +2626,8 @@ initSupActiveCB (
pwr_tStatus sts; pwr_tStatus sts;
sASup *asp; sASup *asp;
sDSup *dsp; sDSup *dsp;
sASupComp *ascompp;
sDSupComp *dscompp;
pwr_sClass_NodeLinkSup *nlsp; pwr_sClass_NodeLinkSup *nlsp;
pwr_sClass_CycleSup *csp; pwr_sClass_CycleSup *csp;
pwr_tAttrRef Object; pwr_tAttrRef Object;
...@@ -2630,6 +2647,12 @@ initSupActiveCB ( ...@@ -2630,6 +2647,12 @@ initSupActiveCB (
case pwr_cClass_DSup: case pwr_cClass_DSup:
sts = gdh_DLRefObjectInfoAttrref(SupObject, (pwr_tAddress *)&dsp, &Dlid); sts = gdh_DLRefObjectInfoAttrref(SupObject, (pwr_tAddress *)&dsp, &Dlid);
break; break;
case pwr_cClass_ASupComp:
sts = gdh_DLRefObjectInfoAttrref(SupObject, (pwr_tAddress *)&ascompp, &Dlid);
break;
case pwr_cClass_DSupComp:
sts = gdh_DLRefObjectInfoAttrref(SupObject, (pwr_tAddress *)&dscompp, &Dlid);
break;
case pwr_cClass_NodeLinkSup: case pwr_cClass_NodeLinkSup:
sts = gdh_DLRefObjectInfoAttrref(SupObject, (pwr_tAddress *)&nlsp, &Dlid); sts = gdh_DLRefObjectInfoAttrref(SupObject, (pwr_tAddress *)&nlsp, &Dlid);
break; break;
...@@ -2653,6 +2676,12 @@ initSupActiveCB ( ...@@ -2653,6 +2676,12 @@ initSupActiveCB (
case pwr_cClass_DSup: case pwr_cClass_DSup:
Object = dsp->Sup.Attribute; Object = dsp->Sup.Attribute;
break; break;
case pwr_cClass_ASupComp:
Object = ascompp->Sup.Attribute;
break;
case pwr_cClass_DSupComp:
Object = dscompp->Sup.Attribute;
break;
case pwr_cClass_NodeLinkSup: case pwr_cClass_NodeLinkSup:
Object = *SupObject; Object = *SupObject;
break; break;
...@@ -2696,6 +2725,7 @@ initSupActiveCB ( ...@@ -2696,6 +2725,7 @@ initSupActiveCB (
sp->timer = &asp->Timer; sp->timer = &asp->Timer;
sp->op = (void *) asp; sp->op = (void *) asp;
sp->agent = getAgent(sp); sp->agent = getAgent(sp);
sp->cid = cid;
if (sp->agent == mh_eAgent_MH) if (sp->agent == mh_eAgent_MH)
sp->detect_exec = aSup_exec; sp->detect_exec = aSup_exec;
break; break;
...@@ -2710,9 +2740,36 @@ initSupActiveCB ( ...@@ -2710,9 +2740,36 @@ initSupActiveCB (
sp->timer = &dsp->Timer; sp->timer = &dsp->Timer;
sp->op = (void *) dsp; sp->op = (void *) dsp;
sp->agent = getAgent(sp); sp->agent = getAgent(sp);
sp->cid = cid;
if (sp->agent == mh_eAgent_MH) if (sp->agent == mh_eAgent_MH)
sp->detect_exec = dSup_exec; sp->detect_exec = dSup_exec;
break; break;
case pwr_cClass_ASupComp:
sp->supType = mh_eSupType_Analog;
sp->supDlid = Dlid;
sp->sup = &ascompp->Sup;
sp->supInfoSize = sizeof(mh_sASupInfo);
sp->supInfoP = &ascompp->Info;
sp->attribute = ascompp->Sup.Attribute;
sp->link.eventSound = ascompp->Sup.Sound;
sp->timer = &ascompp->Timer;
sp->op = (void *) ascompp;
sp->agent = getAgent(sp);
sp->cid = cid;
break;
case pwr_cClass_DSupComp:
sp->supType = mh_eSupType_Digital;
sp->supDlid = Dlid;
sp->sup = &dscompp->Sup;
sp->supInfoSize = sizeof(mh_sDSupInfo);
sp->supInfoP = &dscompp->Info;
sp->attribute = dscompp->Sup.Attribute;
sp->link.eventSound = dscompp->Sup.Sound;
sp->timer = &dscompp->Timer;
sp->op = (void *) dscompp;
sp->agent = getAgent(sp);
sp->cid = cid;
break;
case pwr_cClass_NodeLinkSup: case pwr_cClass_NodeLinkSup:
sp->supType = mh_eSupType_Link; sp->supType = mh_eSupType_Link;
sp->supDlid = Dlid; sp->supDlid = Dlid;
...@@ -2728,6 +2785,7 @@ initSupActiveCB ( ...@@ -2728,6 +2785,7 @@ initSupActiveCB (
sp->timer = (sTimer *)&nlsp->TimerFlag; sp->timer = (sTimer *)&nlsp->TimerFlag;
sp->op = (void *) nlsp; sp->op = (void *) nlsp;
sp->agent = mh_eAgent_None; sp->agent = mh_eAgent_None;
sp->cid = cid;
break; break;
case pwr_cClass_CycleSup: case pwr_cClass_CycleSup:
sp->supType = mh_eSupType_Cycle; sp->supType = mh_eSupType_Cycle;
...@@ -2745,6 +2803,7 @@ initSupActiveCB ( ...@@ -2745,6 +2803,7 @@ initSupActiveCB (
sp->op = (void *) csp; sp->op = (void *) csp;
sp->agent = mh_eAgent_MH; sp->agent = mh_eAgent_MH;
sp->detect_exec = cSup_exec; sp->detect_exec = cSup_exec;
sp->cid = cid;
break; break;
default: default:
errh_Error("initSupActiveCB, program error, cid: %s", cdh_ClassIdToString(NULL, cid, 0)); errh_Error("initSupActiveCB, program error, cid: %s", cdh_ClassIdToString(NULL, cid, 0));
...@@ -2800,6 +2859,14 @@ initSupList () ...@@ -2800,6 +2859,14 @@ initSupList ()
if (EVEN(sts)) if (EVEN(sts))
errh_Error("Initialize list of DSup's\n%m", sts); errh_Error("Initialize list of DSup's\n%m", sts);
sts = initSupListClass(pwr_cClass_ASupComp);
if (EVEN(sts))
errh_Error("Initiate list of ASupComp's\n%m", sts);
sts = initSupListClass(pwr_cClass_DSupComp);
if (EVEN(sts))
errh_Error("Initialize list of DSupComp's\n%m", sts);
sts = initSupListClass(pwr_cClass_NodeLinkSup); sts = initSupListClass(pwr_cClass_NodeLinkSup);
if (EVEN(sts)) if (EVEN(sts))
errh_Error("Initialize list of LinkSup's\n%m", sts); errh_Error("Initialize list of LinkSup's\n%m", sts);
...@@ -4184,6 +4251,8 @@ updateSupActive ( ...@@ -4184,6 +4251,8 @@ updateSupActive (
sActive *ap; sActive *ap;
sASup *asp; sASup *asp;
sDSup *dsp; sDSup *dsp;
sASupComp *ascompp;
sDSupComp *dscompp;
sSup *sup; sSup *sup;
mh_eAgent agent; mh_eAgent agent;
pwr_tClassId cid; pwr_tClassId cid;
...@@ -4193,13 +4262,31 @@ updateSupActive ( ...@@ -4193,13 +4262,31 @@ updateSupActive (
/* Get pointer to supervisory object */ /* Get pointer to supervisory object */
if (sp->supType == mh_eSupType_Analog) { if (sp->supType == mh_eSupType_Analog) {
switch ( sp->cid) {
case pwr_cClass_ASup:
sts = gdh_AttrRefToPointer(&sp->link.supObject, (pwr_tAddress *)&asp); sts = gdh_AttrRefToPointer(&sp->link.supObject, (pwr_tAddress *)&asp);
sup = &asp->Sup; sup = &asp->Sup;
cid = pwr_cClass_ASup; cid = sp->cid;
break;
case pwr_cClass_ASupComp:
sts = gdh_AttrRefToPointer(&sp->link.supObject, (pwr_tAddress *)&ascompp);
sup = &ascompp->Sup;
cid = sp->cid;
break;
}
} else if (sp->supType == mh_eSupType_Digital) { } else if (sp->supType == mh_eSupType_Digital) {
switch ( sp->cid) {
case pwr_cClass_DSup:
sts = gdh_AttrRefToPointer(&sp->link.supObject, (pwr_tAddress *)&dsp); sts = gdh_AttrRefToPointer(&sp->link.supObject, (pwr_tAddress *)&dsp);
sup = &dsp->Sup; sup = &dsp->Sup;
cid = pwr_cClass_DSup; cid = sp->cid;
break;
case pwr_cClass_DSupComp:
sts = gdh_AttrRefToPointer(&sp->link.supObject, (pwr_tAddress *)&dscompp);
sup = &dscompp->Sup;
cid = sp->cid;
break;
}
} else if (sp->supType == mh_eSupType_Link) { } else if (sp->supType == mh_eSupType_Link) {
return; /* Supervised attribute can't change. */ return; /* Supervised attribute can't change. */
} else if (sp->supType == mh_eSupType_Cycle) { } else if (sp->supType == mh_eSupType_Cycle) {
......
...@@ -181,3 +181,131 @@ ...@@ -181,3 +181,131 @@
o->TimerCount = 0; \ o->TimerCount = 0; \
o->DetectCheck = TRUE; \ o->DetectCheck = TRUE; \
} }
/*_*
Name:
DSupCompFo_exec(object, In, con)
Description:
Supervise digital parameter
@aref dsupcompfo DSupCompFo
*/
#define DSupCompFo_init(o)\
{\
pwr_tDlid dlid;\
pwr_tStatus sts;\
sts = gdh_DLRefObjectInfoAttrref( &o->PlcConnect, (void **)&o->PlcConnectP, &dlid);\
if ( EVEN(sts))\
o->PlcConnectP = 0;\
else\
((pwr_sClass_DSupComp *)o->PlcConnectP)->TimerDO = &(((pwr_sClass_DSupComp *)o->PlcConnectP)->TimerDODum);\
}
#define DSupCompFo_exec(o, In, con)\
{\
pwr_sClass_DSupComp *co = (pwr_sClass_DSupComp *)o->PlcConnectP;\
if ( !co)\
return;\
if (In != co->CtrlPosition) {\
if (co->Action) co->Action = FALSE;\
if (co->ReturnCheck) {\
time_GetTime( &co->ReturnTime);\
co->ReturnCheck = FALSE;\
co->ReturnSend = TRUE;\
}\
if (co->AlarmCheck && !co->DetectCheck) {\
co->TimerCount = 0;\
co->DetectCheck = TRUE;\
}\
} else if (con) {\
if (!co->Action) co->Action = TRUE;\
if (co->AlarmCheck && co->DetectOn && !co->Blocked) {\
if (co->DetectCheck) {\
co->ActualValue = In;\
timer_in(tp, co);\
time_GetTime(&co->DetectTime);\
co->DetectCheck = FALSE;\
}\
if (!co->TimerFlag) {\
co->DetectSend = TRUE;\
co->ReturnCheck = TRUE;\
co->Acked = FALSE;\
co->AlarmCheck = FALSE;\
}\
}\
}\
if (co->Blocked) {\
co->TimerCount = 0;\
co->DetectCheck = TRUE;\
}\
o->Action = co->Action;\
o->Acked = co->Acked;\
o->Blocked = co->Blocked;\
}
/*_*
Name:
ASupCompFo_exec(object, In, con)
Description:
Supervise analog parameter
@aref asupcompfo ASupCompFo
*/
#define ASupCompFo_init(o)\
{\
pwr_tDlid dlid;\
pwr_tStatus sts;\
sts = gdh_DLRefObjectInfoAttrref( &o->PlcConnect, (void **)&o->PlcConnectP, &dlid);\
if ( EVEN(sts))\
o->PlcConnectP = 0;\
else\
((pwr_sClass_ASupComp *)o->PlcConnectP)->TimerDO = &(((pwr_sClass_ASupComp *)o->PlcConnectP)->TimerDODum);\
}
#define ASupCompFo_exec(o, In, con)\
{\
pwr_sClass_ASupComp *co = (pwr_sClass_ASupComp *)o->PlcConnectP;\
if ( !co)\
return;\
if ((co->High && In <= co->CtrlLimit - co->Hysteres) ||\
(!co->High && In >= co->CtrlLimit + co->Hysteres)\
) {\
if (co->Action) co->Action = FALSE;\
if (co->ReturnCheck) {\
time_GetTime(&co->ReturnTime);\
co->ReturnCheck = FALSE;\
co->ReturnSend = TRUE;\
}\
if (co->AlarmCheck && !co->DetectCheck) {\
co->TimerCount = 0;\
co->DetectCheck = TRUE;\
}\
} else if (con &&\
((co->High && In > co->CtrlLimit) ||\
(!co->High && In < co->CtrlLimit))) {\
if (!co->Action) co->Action = TRUE;\
if (co->AlarmCheck && co->DetectOn && !co->Blocked) {\
if (co->DetectCheck) {\
co->ActualValue = In;\
timer_in(tp, co);\
time_GetTime(&co->DetectTime);\
co->DetectCheck = FALSE;\
}\
if (!co->TimerFlag) {\
co->DetectSend = TRUE;\
co->ReturnCheck = TRUE;\
co->Acked = FALSE;\
co->AlarmCheck = FALSE;\
}\
}\
}\
if (co->Blocked) {\
co->TimerCount = 0;\
co->DetectCheck = TRUE;\
}\
o->Action = co->Action;\
o->Acked = co->Acked;\
o->Blocked = co->Blocked;\
}
This diff is collapsed.
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2013 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_asupcompfo.wb_load -- Defines the class ASupCompFo.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Code rt_plc_macro_sup.h
! @Group Plc,PlcAnalog,Supervision,PlantConfiguration
! @Summary Analog supervisory
! Analog Supervisory.
! @image orm_asup_fo.gif
!
!
! @b See Also
! @classlink DSup pwrb_asupcomp.html
!*/
Object ASupCompFo $ClassDef 615
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtConnectionsAndDevBodies
Attr PopEditor = 2
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "ASupCompFo"
EndBody
!/**
! Supervised signal. If the input is left unconnected
! Attribute tells what to supervise.
!*/
Object In $Input 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_RTVIRTUAL
Attr Flags |= PWR_MASK_NOEDIT
Attr GraphName = "IN"
EndBody
EndObject
!/**
! Specifies whether to enable or disable the supervision.
! Note that blocking is done when Control is FALSE. The
! input signal can be inverted.
! FALSE disables the supervision and TRUE or open input
! enables the supervision.
!*/
Object Control $Input 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_RTVIRTUAL
Attr Flags |= PWR_MASK_NOEDIT
Attr GraphName = "con"
EndBody
EndObject
!/**
! Specifies the status of supervised quantity. FALSE
! means normal state and TRUE means alarm state.
!
! The output signal can, for instance, be used to
! activate an action sequence at alarm state.
!*/
Object Action $Output 3
Body SysBody
Attr PgmName = "Action"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "act"
EndBody
EndObject
!/**
! Specifies if the alarm state has been acknowledged or
! not. FALSE means that unacknowledged alarm exists. The
! output is set TRUE initially when the ASup object is
! created in rtdb and when the alarm state has been
! acknowledged.
!*/
Object Acked $Output 4
Body SysBody
Attr PgmName = "Acked"
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr GraphName = "ack"
EndBody
EndObject
!/**
! Specifies whether to enable or disable the blocking. No
! messages from the supervision object will be sent away
! as long as the object is blocked. The blocking does not
! influence on the 'act' output of the object.
! FALSE disables the the blocking and TRUE enables the
! blocking. When a supervisory object in alarm position
! is blocked current messages will be cancelled.
! Blocking /deblocking is done by means of the 'Alarm
! Blocking Window' in the operator environment.
!*/
Object Blocked $Output 5
Body SysBody
Attr PgmName = "Blocked"
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr GraphName = "blk"
EndBody
EndObject
Object PlcConnect $Intern 6
Body SysBody
Attr TypeRef = "pwrs:Type-$AttrRef"
EndBody
EndObject
Object PlcConnectP $Intern 7
Body SysBody
Attr TypeRef = "pwrs:Type-$Void"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
EndObject
Object DevBody $ObjBodyDef 2
!/**
! Specifies if DetectText is to be displayed in the
! symbol of the ASup object or not. FALSE means no
! displaying and TRUE displaying.
!*/
Object ShowDetectText $Intern 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
Object PlcNode $Buffer 2
Body SysBody
Attr Class = pwr_eClass_PlcNode
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
EndObject
Object GraphPlcNode $GraphPlcNode
Body SysBody
Attr object_type = 11
Attr parameters[0] = 2
Attr parameters[1] = 0
Attr parameters[2] = 3
Attr parameters[3] = 0
Attr subwindows = 0
Attr graphmethod = 9
Attr graphindex = 0
Attr default_mask[0] = 1
Attr default_mask[1] = 0
Attr segname_annotation = 1
Attr rtbody_annotation = 1
Attr compmethod = 67
Attr compindex = 0
Attr executeordermethod = 2
Attr tracemethod = 3
Attr traceindex = 1
Attr connectmethod = 10
Attr objname = "ASupCompFo"
Attr graphname = "ASupCompFo"
Attr debugpar = "Action"
EndBody
EndObject
Object Template ASupCompFo
Body RtBody
EndBody
Body DevBody
Attr ShowDetectText = 1
EndBody
EndObject
Object RtXtt $RtMenu
Object PlcConnect $MenuRef
Body SysBody
Attr ButtonName = "PlcConnect"
Attr RefAttribute = "PlcConnect"
EndBody
EndObject
EndObject
EndObject
EndSObject
This diff is collapsed.
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2013 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_dsupcompfo.wb_load -- Defines the class DSupCompFo.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Code rt_plc_macro_sup.h
! @Group Plc,PlcLogic,Supervision,PlantConfiguration
! @Summary Digital supervisory
! Digital Supervisory.
! @image orm_dsup_fo.gif
!
!
! @b See Also
! @classlink ASup pwrb_dsupcomp.html
!*/
Object DSupCompFo $ClassDef 614
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtConnectionsAndDevBodies
Attr PopEditor = 2
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "DSupCompFo"
EndBody
!/**
! Supervised signal. Can be inverted to supervise a false
! signal.
!*/
Object In $Input 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_RTVIRTUAL
Attr Flags |= PWR_MASK_NOEDIT
Attr GraphName = "in"
EndBody
EndObject
!/**
! Specifies whether to enable or disable the supervision.
! Note that blocking is done when Control is FALSE. The
! input signal can be inverted.
!
! FALSE disables the supervision and TRUE or open input
! enables the supervision.
!*/
Object Control $Input 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_RTVIRTUAL
Attr Flags |= PWR_MASK_NOEDIT
Attr GraphName = "con"
EndBody
EndObject
!/**
! Specifies the status of supervised quantity. FALSE
! means normal state and TRUE means alarm state.
! The output signal can for instance be used to activate
! an action sequence at alarm state.
!*/
Object Action $Output 3
Body SysBody
Attr PgmName = "Action"
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr GraphName = "act"
EndBody
EndObject
!/**
! Specifies if the alarm state has been acknowledged or
! not. FALSE means that unacknowledged alarm exists. The
! output is set TRUE after booting and when the alarm
! state has been acknowledged.
!*/
Object Acked $Output 4
Body SysBody
Attr PgmName = "Acked"
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr GraphName = "ack"
EndBody
EndObject
!/**
! Specifies whether to enable or disable the blocking. No
! messages from the supervision object will be sent away
! as long as the object is blocked. The blocking does not
! influence on the 'act' output of the object.
!
! FALSE disables the the blocking and TRUE enables the
! blocking. When a supervisory object in alarm position
! is blocked current messages will be cancelled.
! Blocking /deblocking is done by means of the 'Alarm
! Blocking Window' in the operator environment.
!*/
Object Blocked $Output 5
Body SysBody
Attr PgmName = "Blocked"
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr GraphName = "blk"
EndBody
EndObject
Object PlcConnect $Intern 6
Body SysBody
Attr TypeRef = "pwrs:Type-$AttrRef"
EndBody
EndObject
Object PlcConnectP $Intern 7
Body SysBody
Attr TypeRef = "pwrs:Type-$Void"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
EndBody
EndObject
EndObject
Object DevBody $ObjBodyDef 2
!/**
! Specifies if DetectText is to be displayed in the
! symbol of the DSup object or not. FALSE means no
! displaying and TRUE displaying.
!*/
Object ShowDetectText $Intern 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
Object PlcNode $Buffer 2
Body SysBody
Attr Class = pwr_eClass_PlcNode
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
EndObject
Object GraphPlcNode $GraphPlcNode
Body SysBody
Attr object_type = 11
Attr parameters[0] = 2
Attr parameters[1] = 0
Attr parameters[2] = 3
Attr parameters[3] = 0
Attr subwindows = 0
Attr graphmethod = 9
Attr graphindex = 0
Attr default_mask[0] = 1
Attr default_mask[1] = 0
Attr segname_annotation = 1
Attr rtbody_annotation = 1
Attr compmethod = 67
Attr compindex = 0
Attr executeordermethod = 2
Attr tracemethod = 3
Attr traceindex = 1
Attr connectmethod = 10
Attr objname = "DSupCompFo"
Attr graphname = "DSupCompFo"
Attr debugpar = "Action"
EndBody
EndObject
Object Template DSupCompFo
Body RtBody
EndBody
Body DevBody
Attr ShowDetectText = 1
EndBody
EndObject
Object RtXtt $RtMenu
Object PlcConnect $MenuRef
Body SysBody
Attr ButtonName = "PlcConnect"
Attr RefAttribute = "PlcConnect"
EndBody
EndObject
EndObject
EndObject
EndSObject
...@@ -1165,6 +1165,8 @@ palette PlcEditorPalette ...@@ -1165,6 +1165,8 @@ palette PlcEditorPalette
class BaseMotorAggrFo class BaseMotorAggrFo
class BaseMotorIncrDecrAggrFo class BaseMotorIncrDecrAggrFo
class RunTimeCounterFo class RunTimeCounterFo
class DSupCompFo
class ASupCompFo
} }
menu ABB menu ABB
{ {
......
...@@ -256,6 +256,7 @@ int gcg_comp_m63( gcg_ctx gcgctx, vldh_t_node node); ...@@ -256,6 +256,7 @@ int gcg_comp_m63( gcg_ctx gcgctx, vldh_t_node node);
int gcg_comp_m64( gcg_ctx gcgctx, vldh_t_node node); int gcg_comp_m64( gcg_ctx gcgctx, vldh_t_node node);
int gcg_comp_m65( gcg_ctx gcgctx, vldh_t_node node); int gcg_comp_m65( gcg_ctx gcgctx, vldh_t_node node);
int gcg_comp_m66( gcg_ctx gcgctx, vldh_t_node node); int gcg_comp_m66( gcg_ctx gcgctx, vldh_t_node node);
int gcg_comp_m67( gcg_ctx gcgctx, vldh_t_node node);
gcg_tMethod gcg_comp_m[70] = { gcg_tMethod gcg_comp_m[70] = {
(gcg_tMethod)gcg_comp_m0, (gcg_tMethod)gcg_comp_m0,
...@@ -324,7 +325,8 @@ gcg_tMethod gcg_comp_m[70] = { ...@@ -324,7 +325,8 @@ gcg_tMethod gcg_comp_m[70] = {
gcg_comp_m63, gcg_comp_m63,
gcg_comp_m64, gcg_comp_m64,
gcg_comp_m65, gcg_comp_m65,
gcg_comp_m66 gcg_comp_m66,
gcg_comp_m67
}; };
...@@ -16160,6 +16162,185 @@ int gcg_comp_m66( gcg_ctx gcgctx, vldh_t_node node) ...@@ -16160,6 +16162,185 @@ int gcg_comp_m66( gcg_ctx gcgctx, vldh_t_node node)
return GSX__SUCCESS; return GSX__SUCCESS;
} }
/*************************************************************************
*
* Name: gcg_comp_m67()
*
* Type void
*
* Type Parameter IOGF Description
* gcg_ctx gcgctx I gcg context.
* vldh_t_node node I vldh node.
*
* Description:
* Compile method for DSupComp and ASupComp.
* Generated code:
* Declares and links a rtdb pointer to the sup object.
* Prints an exec call.
* If the enable input is not connected it is set to true.
* Inits the object by putting the supervised object and parameter
* into the object and setting AckFlg to true.
*
**************************************************************************/
int gcg_comp_m67( gcg_ctx gcgctx, vldh_t_node node)
{
int sts;
pwr_sAttrRef output_aref;
int output_type;
char output_prefix;
char output_par[80];
unsigned long point;
unsigned long par_inverted;
vldh_t_node output_node;
unsigned long output_count;
unsigned long output_point;
ldh_sParDef output_bodydef;
pwr_sAttrRef aref;
pwr_tBoolean locked;
int size;
gcg_t_nocondef nocondef[2];
unsigned long nocontype[2] = { GCG_BOOLEAN, GCG_BOOLEAN };
pwr_tAttrRef *connect_arp, connect_aref;
pwr_tAttrRef attribute_aref;
pwr_tAttrRef aaref;
pwr_tCid connect_cid;
ldh_tSesContext ldhses = (node->hn.wind)->hw.ldhses;
char *name;
nocondef[0].bo = FALSE;
nocondef[1].bo = TRUE;
sts = gcg_ref_insert( gcgctx, node->ln.oid, GCG_PREFIX_REF, node);
sts = gcg_print_exec_macro( gcgctx, node, node->ln.oid, GCG_PREFIX_REF);
if (EVEN(sts)) return sts;
sts = gcg_print_inputs( gcgctx, node, ", ", GCG_PRINT_ALLPAR,
nocondef, nocontype);
if ( EVEN(sts)) return sts;
IF_PR fprintf( gcgctx->files[GCGM1_CODE_FILE],
");\n");
/* Print init call */
sts = gcg_get_structname( gcgctx, node->ln.oid, &name);
if( EVEN(sts)) return sts;
IF_PR fprintf( gcgctx->files[GCGM1_REF_FILE],
"%s_init( %c%s);\n",
name,
GCG_PREFIX_REF,
vldh_IdToStr(0, node->ln.oid));
/* Get PlcConnect object */
sts = ldh_GetObjectPar( gcgctx->ldhses, node->ln.oid, "RtBody", "PlcConnect",
(char **)&connect_arp, &size);
if ( EVEN(sts)) {
gcg_error_msg( gcgctx, GSX__REFCONNECT, node);
return GSX__NEXTNODE;
}
connect_aref = *connect_arp;
free( connect_arp);
sts = gcg_replace_ref( gcgctx, &connect_aref, node);
if ( sts == GSX__REPLACED) {
/* Store the converted aref */
sts = ldh_SetObjectPar( gcgctx->ldhses, node->ln.oid, "RtBody",
"PlcConnect", (char *)&connect_aref, sizeof(connect_aref));
if ( EVEN(sts)) return sts;
}
if ( cdh_ObjidIsNull(connect_aref.Objid)) {
gcg_error_msg( gcgctx, GSX__REFCONNECT, node);
return GSX__NEXTNODE;
}
// Check class of connected object
sts = ldh_GetAttrRefOrigTid( gcgctx->ldhses, &connect_aref, &connect_cid);
if ( EVEN(sts)) {
gcg_error_msg( gcgctx, GSX__REFCONNECT, node);
return GSX__NEXTNODE;
}
switch ( node->ln.cid) {
case pwr_cClass_DSupCompFo:
if ( connect_cid != pwr_cClass_DSupComp) {
gcg_error_msg( gcgctx, GSX__REFCONNECT, node);
return GSX__NEXTNODE;
}
break;
case pwr_cClass_ASupCompFo:
if ( connect_cid != pwr_cClass_ASupComp) {
gcg_error_msg( gcgctx, GSX__REFCONNECT, node);
return GSX__NEXTNODE;
}
break;
default: ;
}
sts = ldh_ArefANameToAref( ldhses, &connect_aref, "LockAttribute", &aaref);
if ( EVEN(sts)) return sts;
sts = ldh_ReadAttribute( ldhses, &aaref, &locked, sizeof(locked));
if ( EVEN(sts)) return sts;
if ( locked) {
sts = ldh_ArefANameToAref( ldhses, &connect_aref, "Attribute", &attribute_aref);
if ( EVEN(sts)) return sts;
sts = ldh_ReadAttribute( ldhses, &attribute_aref, &aref, sizeof(aref));
if ( EVEN(sts)) return sts;
if ( !cdh_ObjidIsNull( aref.Objid)) {
sts = gcg_replace_ref( gcgctx, &aref, node);
if ( sts == GSX__REPLACED) {
sts = ldh_WriteAttribute( ldhses, &attribute_aref, &aref, sizeof(aref));
if ( EVEN(sts)) return sts;
}
}
}
else {
sts = ldh_ArefANameToAref( ldhses, &connect_aref, "Attribute", &aaref);
if ( EVEN(sts)) return sts;
/* Print the supervised object and parameter in the object */
sts = gcg_get_inputpoint( node, 0, &point, &par_inverted);
if ( ODD( sts)) {
/* Look for an output connected to this point */
sts = gcg_get_output( node, point, &output_count, &output_node,
&output_point, &output_bodydef,
GOEN_CON_SIGNAL | GOEN_CON_OUTPUTTOINPUT);
if ( EVEN(sts)) return sts;
if ( output_count > 0 ) {
sts = gcg_get_outputstring( gcgctx, output_node, &output_bodydef,
&output_aref, &output_type, &output_prefix, output_par);
if ( sts == GSX__NEXTPAR ) return sts;
if ( EVEN(sts)) return sts;
/* Put the attribut reference in the sup object */
IF_PR {
sts = ldh_ArefANameToAref( ldhses, &connect_aref, "Attribute", &attribute_aref);
if ( EVEN(sts)) return sts;
sts = ldh_WriteAttribute( ldhses, &attribute_aref, &output_aref, sizeof(output_aref));
if ( EVEN(sts)) return sts;
}
}
else {
/* Point not connected, errormessage */
gcg_error_msg( gcgctx, GSX__NOTCON, node);
}
}
}
// gcg_timer_print( gcgctx, node->ln.oid);
return GSX__SUCCESS;
}
/************************************************************************* /*************************************************************************
* *
* Name: gcg_wind_check_modification() * Name: gcg_wind_check_modification()
......
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