Commit 0959114d authored by Claes Sjofors's avatar Claes Sjofors

Simulink interface added and function object SupressSup

parent 69b3ff60
This diff is collapsed.
...@@ -191,4 +191,44 @@ ...@@ -191,4 +191,44 @@
obj->Status = false; \ obj->Status = false; \
} }
/*_*
SUPRESSSUP
@aref supresssup SupressSup
*/
#define SupressSup_exec(obj,sup,cid,in)\
if ( in && !obj->InOld) {\
switch ( cid) {\
case pwr_cClass_DSup:\
((pwr_sClass_DSup *)sup)->Blocked = 1;\
break;\
case pwr_cClass_DSupComp:\
((pwr_sClass_DSupComp *)sup)->Blocked = 1;\
break;\
case pwr_cClass_ASup:\
((pwr_sClass_ASup *)sup)->Blocked = 1;\
break;\
case pwr_cClass_ASupComp:\
((pwr_sClass_ASupComp *)sup)->Blocked = 1;\
break;\
default: ;\
}\
}\
else if ( !in && obj->InOld) {\
switch ( cid) {\
case pwr_cClass_DSup:\
((pwr_sClass_DSup *)sup)->Blocked = 0;\
break;\
case pwr_cClass_DSupComp:\
((pwr_sClass_DSupComp *)sup)->Blocked = 0;\
break;\
case pwr_cClass_ASup:\
((pwr_sClass_ASup *)sup)->Blocked = 0;\
break;\
case pwr_cClass_ASupComp:\
((pwr_sClass_ASupComp *)sup)->Blocked = 0;\
break;\
default: ;\
}\
}\
obj->Supressed = in;\
obj->InOld = in;
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2016 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_supresssup.wb_load -- Defines the class SupressSup.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Code rt_plc_macro_io.h
! @Summary Object to suppress alarms.
! Object to supress alarm.
! @image orm_supresssup_fo.gif
!
!*/
Object SupressSup $ClassDef 686
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtConnectionsAndDevBodies
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "SupressSup"
EndBody
!/**
! Digital input to supress the alarm.
! When In is high, the alarm is supressed.
!*/
Object In $Input 1
Body SysBody
Attr PgmName = "In"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_RTVIRTUAL
Attr Flags |= PWR_MASK_NOREMOVE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "in"
EndBody
EndObject
!/**
! Value of In from last scan.
!*/
Object InOld $Intern 2
Body SysBody
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Output indicating that alarm is supressed.
!*/
Object Supressed $Output 3
Body SysBody
Attr PgmName = "Supressed"
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "out"
EndBody
EndObject
EndObject
Object DevBody $ObjBodyDef 2
!/**
! The supervision object for the alarm.
! An object of class DSup, DSupComp, ASup or ASupComp.
!*/
Object SupObject $Intern 1
Body SysBody
Attr TypeRef = "pwrs:Type-$AttrRef"
Attr NiNaAnnot = 1
Attr NiNaSegments = 1
EndBody
EndObject
!/**
! Specifies how many segments of the Sup object name that
! is to be displayed in the symbol of the ResDi object.
! The segments are counted from behind.
! 0 and 1 both result in displaying the last segment of
! the signal object name.
!*/
Object SupObjectSegments $Intern 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
Object PlcNode $Buffer 3
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] = 1
Attr parameters[1] = 1
Attr parameters[2] = 1
Attr parameters[3] = 0
Attr subwindows = 0
Attr graphmethod = 7
Attr graphindex = 1
Attr default_mask[0] = 1
Attr default_mask[1] = 0
Attr segname_annotation = 0
Attr devbody_annotation = 1
Attr compmethod = 70
Attr compindex = 0
Attr tracemethod = 1
Attr traceindex = 1
Attr connectmethod = 36
Attr executeordermethod = 6
Attr objname = "SupressSup"
Attr graphname = "SupSup"
Attr debugpar = "Supressed"
EndBody
EndObject
Object Template SupressSup
Body RtBody
EndBody
Body DevBody
Attr SupObjectSegments = 3
EndBody
EndObject
EndObject
EndSObject
...@@ -879,6 +879,7 @@ palette PlcEditorPalette ...@@ -879,6 +879,7 @@ palette PlcEditorPalette
class PulseTrain class PulseTrain
class SR_R class SR_R
class SR_S class SR_S
class SupressSup
class Timer class Timer
class True class True
class Wait class Wait
...@@ -1204,6 +1205,7 @@ palette PlcEditorPalette ...@@ -1204,6 +1205,7 @@ palette PlcEditorPalette
class Sim_LagFilter class Sim_LagFilter
class Sim_LeadLagFilter class Sim_LeadLagFilter
class Sim_SigGen class Sim_SigGen
class Sim_Simulink
class Sim_SlewRateLimiter class Sim_SlewRateLimiter
class Sim_SouFilter class Sim_SouFilter
class Sim_SouTOoFilter class Sim_SouTOoFilter
......
This diff is collapsed.
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
#define BEEP putchar( '\7' ); #define BEEP putchar( '\7' );
#define GOBJ_MAX_METHOD 35 #define GOBJ_MAX_METHOD 36
typedef int (* gobj_tMethod)( WFoe *, vldh_t_node, unsigned long); typedef int (* gobj_tMethod)( WFoe *, vldh_t_node, unsigned long);
...@@ -98,6 +98,7 @@ int gobj_get_object_m32( WFoe *foe, vldh_t_node node, unsigned long index); ...@@ -98,6 +98,7 @@ int gobj_get_object_m32( WFoe *foe, vldh_t_node node, unsigned long index);
int gobj_get_object_m33( WFoe *foe, vldh_t_node node, unsigned long index); int gobj_get_object_m33( WFoe *foe, vldh_t_node node, unsigned long index);
int gobj_get_object_m34( WFoe *foe, vldh_t_node node, unsigned long index); int gobj_get_object_m34( WFoe *foe, vldh_t_node node, unsigned long index);
int gobj_get_object_m35( WFoe *foe, vldh_t_node node, unsigned long index); int gobj_get_object_m35( WFoe *foe, vldh_t_node node, unsigned long index);
int gobj_get_object_m36( WFoe *foe, vldh_t_node node, unsigned long index);
gobj_tMethod gobj_get_object_m[40] = { gobj_tMethod gobj_get_object_m[40] = {
gobj_get_object_m0, gobj_get_object_m0,
...@@ -136,6 +137,7 @@ gobj_tMethod gobj_get_object_m[40] = { ...@@ -136,6 +137,7 @@ gobj_tMethod gobj_get_object_m[40] = {
gobj_get_object_m33, gobj_get_object_m33,
gobj_get_object_m34, gobj_get_object_m34,
gobj_get_object_m35, gobj_get_object_m35,
gobj_get_object_m36,
}; };
static pwr_tAttrRef gobj_selected_aref; static pwr_tAttrRef gobj_selected_aref;
...@@ -3163,6 +3165,64 @@ int gobj_get_object_m35( WFoe *foe, vldh_t_node node, unsigned long index) ...@@ -3163,6 +3165,64 @@ int gobj_get_object_m35( WFoe *foe, vldh_t_node node, unsigned long index)
return FOE__SUCCESS; return FOE__SUCCESS;
} }
//
// Method for SupressSup. Inserts the selected Sup-object in the
// navigator in the parameter SupObject in a SupressSup object.
//
int gobj_get_object_m36( WFoe *foe, vldh_t_node node, unsigned long index)
{
pwr_tClassId cid;
ldh_tSesContext ldhses;
int sts;
vldh_t_plc plc;
pwr_sAttrRef attrref;
int is_attr;
/* Get the selected object in the navigator */
plc = (node->hn.wind)->hw.plc;
ldhses =(node->hn.wind)->hw.ldhses;
sts = gobj_get_select( foe, &attrref, &is_attr);
if ( EVEN(sts)) {
foe->message( "Select a supervision object in the navigator");
BEEP;
return sts;
}
sts = ldh_GetAttrRefTid( ldhses, &attrref, &cid);
if ( EVEN(sts)) return sts;
switch ( cid) {
case pwr_cClass_DSup:
case pwr_cClass_ASup:
case pwr_cClass_DSupComp:
case pwr_cClass_ASupComp:
break;
default:
foe->message( "Selected object is not a di object");
BEEP;
return 0;
}
if ( cdh_IsClassVolume( node->ln.oid.vid)) {
sts = gobj_ref_replace( ldhses, node, &attrref);
if ( EVEN(sts)) return sts;
}
/* Set the parameter value */
sts = ldh_SetObjectPar( ldhses,
node->ln.oid,
"DevBody",
"SupObject",
(char *)&attrref, sizeof(attrref));
if ( EVEN(sts)) return sts;
foe->gre->node_update( node);
return FOE__SUCCESS;
}
// //
// Description: Method for objects with nothing to expand // Description: Method for objects with nothing to expand
// //
...@@ -3246,6 +3306,7 @@ int gobj_expand( WFoe *foe, ...@@ -3246,6 +3306,7 @@ int gobj_expand( WFoe *foe,
case pwr_cClass_GetBoInt32: case pwr_cClass_GetBoInt32:
case pwr_cClass_GetBoFloat32: case pwr_cClass_GetBoFloat32:
case pwr_cClass_GetBoString80: case pwr_cClass_GetBoString80:
case pwr_cClass_SupressSup:
sts = gobj_expand_m1( foe, node, compress); sts = gobj_expand_m1( foe, node, compress);
break; break;
case pwr_cClass_and: case pwr_cClass_and:
......
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