Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
0959114d
Commit
0959114d
authored
Nov 22, 2016
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simulink interface added and function object SupressSup
parent
69b3ff60
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1054 additions
and
6 deletions
+1054
-6
simul/wbl/simul/src/simul.wb_load
simul/wbl/simul/src/simul.wb_load
+419
-2
src/doc/orm/src/orm_simulink_fo.png
src/doc/orm/src/orm_simulink_fo.png
+0
-0
src/lib/rt/src/rt_plc_macro_logic.h
src/lib/rt/src/rt_plc_macro_logic.h
+41
-1
src/wbl/pwrb/src/pwrb_c_supresssup.wb_load
src/wbl/pwrb/src/pwrb_c_supresssup.wb_load
+156
-0
wb/exp/wb/src/pwr_wb_palette.cnf
wb/exp/wb/src/pwr_wb_palette.cnf
+2
-0
wb/lib/wb/src/wb_gcg.cpp
wb/lib/wb/src/wb_gcg.cpp
+374
-2
wb/lib/wb/src/wb_gobj.cpp
wb/lib/wb/src/wb_gobj.cpp
+62
-1
No files found.
simul/wbl/simul/src/simul.wb_load
View file @
0959114d
Volume Simul $ClassVolume 0.0.0.8
Body SysBody 01-JAN-1970 01:00:00.00
Attr NextOix = "_X3
6
"
Attr NextCix = "_X1
6
"
Attr NextOix = "_X3
7
"
Attr NextCix = "_X1
7
"
Attr NextTix[0] = "_X6"
EndBody
Object Type $TypeHier 3 28-FEB-2016 17:05:51.66
...
...
@@ -1111,5 +1111,422 @@ Volume Simul $ClassVolume 0.0.0.8
EndBody
EndObject
EndObject
!/**
! @Version 1.0
! @Summary Interface Simulink model.
! Interface to Simulink model.
!
! @image orm_simulink_fo.png
!
! A simulink model can be exported to c-code, and the Sim_Simulink class
! makes it possible to call this model from a function object.
! Defined input and output signals for the model can be connected
! to inputs and outputs in the function object.
!
! Enter the model name in the attribute ModelName. Also enter the
! input signal names for corresponding input pins in AInName and DInName,
! and the output signal names for the corresponding output pins in
! OutAName and OutDName.
!
! The step function for the model is called every scan of the plc thread.
! The scan time of the thread should be adapted to the scantime of the model
! or vv.
!
! When generating c code for the model, the files 'modelname'.c and
! 'modelname'.h is created. 'modelname'.h together with rtwtypes.h should
! be copied to $pwrp_inc, and 'modelname.c' should be compiled and built
! with the plc executable. This is done by creating a BuildOptions object
! under the NodeConfig object in the directory volume, and specifying
! 'modelname.o' in ObjectModule. 'modelname'.o should be present on
! $pwrp_obj.
!*/
Object Sim_Simulink $ClassDef 16 18-NOV-2016 10:44:32.21
Body SysBody 01-JAN-1970 01:00:00.00
Attr Method = 6
Attr Flags = 16
Attr PopEditor = 2
EndBody
Object RtBody $ObjBodyDef 1 18-NOV-2016 10:43:32.00
Body SysBody 18-NOV-2016 10:44:39.76
Attr StructName = "Sim_Simulink"
EndBody
!/**
! Analog input signal to model.
!*/
Object AIn1 $Input 1 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "AIn1"
Attr Flags = 4
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "A1"
EndBody
EndObject
Object AIn2 $Input 2 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "AIn2"
Attr Flags = 4
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "A2"
EndBody
EndObject
Object AIn3 $Input 3 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "AIn3"
Attr Flags = 4
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "A3"
EndBody
EndObject
Object AIn4 $Input 4 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "AIn4"
Attr Flags = 4
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "A4"
EndBody
EndObject
Object AIn5 $Input 5 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "AIn5"
Attr Flags = 4
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "A5"
EndBody
EndObject
Object AIn6 $Input 6 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "AIn6"
Attr Flags = 4
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "A6"
EndBody
EndObject
Object AIn7 $Input 7 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "AIn7"
Attr Flags = 4
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "A7"
EndBody
EndObject
Object AIn8 $Input 8 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "AIn8"
Attr Flags = 4
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "A8"
EndBody
EndObject
!/**
! Digital input signal to model.
!*/
Object DIn1 $Input 9 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "DIn1"
Attr Flags = 8196
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "d1"
EndBody
EndObject
Object DIn2 $Input 10 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "DIn2"
Attr Flags = 8196
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "d2"
EndBody
EndObject
Object DIn3 $Input 11 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "DIn3"
Attr Flags = 8196
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "d3"
EndBody
EndObject
Object DIn4 $Input 12 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "DIn4"
Attr Flags = 8196
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "d4"
EndBody
EndObject
Object DIn5 $Input 13 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "DIn5"
Attr Flags = 8196
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "d5"
EndBody
EndObject
Object DIn6 $Input 14 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "DIn6"
Attr Flags = 8196
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "d6"
EndBody
EndObject
Object DIn7 $Input 15 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "DIn7"
Attr Flags = 8196
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "d7"
EndBody
EndObject
Object DIn8 $Input 16 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "DIn8"
Attr Flags = 8196
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "d8"
EndBody
EndObject
!/**
! Analog output signal from model.
!*/
Object OutA1 $Output 17 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutA1"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OA1"
EndBody
EndObject
Object OutA2 $Output 18 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutA2"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OA2"
EndBody
EndObject
Object OutA3 $Output 19 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutA3"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OA3"
EndBody
EndObject
Object OutA4 $Output 20 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutA4"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OA4"
EndBody
EndObject
Object OutA5 $Output 21 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutA5"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OA5"
EndBody
EndObject
Object OutA6 $Output 22 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutA6"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OA6"
EndBody
EndObject
Object OutA7 $Output 23 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutA7"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OA7"
EndBody
EndObject
Object OutA8 $Output 24 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutA8"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Float32"
Attr GraphName = "OA8"
EndBody
EndObject
!/**
! Digital output signal from model.
!*/
Object OutD1 $Output 25 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutD1"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "od1"
EndBody
EndObject
Object OutD2 $Output 26 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutD2"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "od2"
EndBody
EndObject
Object OutD3 $Output 27 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutD3"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "od3"
EndBody
EndObject
Object OutD4 $Output 28 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutD4"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "od4"
EndBody
EndObject
Object OutD5 $Output 29 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutD5"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "od5"
EndBody
EndObject
Object OutD6 $Output 30 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutD6"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "od6"
EndBody
EndObject
Object OutD7 $Output 31 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutD7"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "od7"
EndBody
EndObject
Object OutD8 $Output 32 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutD8"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Boolean"
Attr GraphName = "od8"
EndBody
EndObject
EndObject
Object GraphPlcNode $GraphPlcNode 37 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr object_type = 11
Attr parameters[0] = 16
Attr parameters[1] = 0
Attr parameters[2] = 16
Attr parameters[3] = 0
Attr subwindows = 1
Attr graphmethod = 0
Attr graphindex = 0
Attr default_mask[0] = 1
Attr default_mask[1] = 1
Attr segname_annotation = 1
Attr compmethod = 71
Attr compindex = 0
Attr tracemethod = 0
Attr traceindex = 0
Attr connectmethod = 0
Attr executeordermethod = 2
Attr objname = "Simulink"
Attr graphname = "Simulink"
EndBody
EndObject
Object DevBody $ObjBodyDef 2 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
EndBody
Object PlcNode $Buffer 1 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr Flags = 2048
Attr Class = "pwrs:Class-$PlcNode"
EndBody
EndObject
!/**
! Simulink model name.
!*/
Object ModelName $Intern 2 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "ModelName"
Attr TypeRef = "pwrs:Type-$String32"
EndBody
EndObject
!/**
! Simulink input signal names for A1 - A8.
! Defines the connection between an analog input of
! the function object (A1 - A8) and a simulink input signal.
! Enter the simulink name for A1 in AInName[0], for
! A2 in AInName[1] etc.
!*/
Object AInName $Intern 3 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "AInName"
Attr Flags = 2
Attr Elements = 8
Attr TypeRef = "pwrs:Type-$String32"
EndBody
EndObject
!/**
! Simulink input signal names for d1 - d8.
! Defines the connection between a digial input of
! the function object (d1 - d8) and a simulink input signal.
! Enter the simulink name for d1 in DInName[0], for
! d2 in DInName[1] etc.
!*/
Object DInName $Intern 4 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "DInName"
Attr Flags = 2
Attr Elements = 8
Attr TypeRef = "pwrs:Type-$String32"
EndBody
EndObject
!/**
! Simulink output signal names for OA1 - OA8.
! Defines the connection between an analog output of
! the function object (OA1 - OA8) and a simulink output signal.
! Enter the simulink name for OA1 in OutAName[0], for
! OA2 in OutAName[1] etc.
!*/
Object OutAName $Intern 5 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutAName"
Attr Flags = 2
Attr Elements = 8
Attr TypeRef = "pwrs:Type-$String32"
EndBody
EndObject
!/**
! Simulink input signal names for OD1 - OD8.
! Defines the connection between a digital output of
! the function object (od1 - od8) and a simulink output signal.
! Enter the simulink name for od1 in OutDName[0], for
! od2 in OutDName[1] etc.
!*/
Object OutDName $Intern 6 18-NOV-2016 10:43:32.00
Body SysBody 01-JAN-1970 01:00:00.00
Attr PgmName = "OutDName"
Attr Flags = 2
Attr Elements = 8
Attr TypeRef = "pwrs:Type-$String32"
EndBody
EndObject
EndObject
Object Template Sim_Simulink 2151907328 01-JAN-1970 01:00:00.00
Body RtBody 01-JAN-1970 01:00:00.00
EndBody
Body DevBody 01-JAN-1970 01:00:00.00
EndBody
EndObject
EndObject
EndObject
EndVolume
src/doc/orm/src/orm_simulink_fo.png
0 → 100644
View file @
0959114d
1.74 KB
src/lib/rt/src/rt_plc_macro_logic.h
View file @
0959114d
...
...
@@ -191,4 +191,44 @@
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;
src/wbl/pwrb/src/pwrb_c_supresssup.wb_load
0 → 100644
View file @
0959114d
!
! 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
wb/exp/wb/src/pwr_wb_palette.cnf
View file @
0959114d
...
...
@@ -879,6 +879,7 @@ palette PlcEditorPalette
class PulseTrain
class SR_R
class SR_S
class SupressSup
class Timer
class True
class Wait
...
...
@@ -1204,6 +1205,7 @@ palette PlcEditorPalette
class Sim_LagFilter
class Sim_LeadLagFilter
class Sim_SigGen
class Sim_Simulink
class Sim_SlewRateLimiter
class Sim_SouFilter
class Sim_SouTOoFilter
...
...
wb/lib/wb/src/wb_gcg.cpp
View file @
0959114d
...
...
@@ -263,8 +263,10 @@ int gcg_comp_m66( gcg_ctx gcgctx, vldh_t_node node);
int
gcg_comp_m67
(
gcg_ctx
gcgctx
,
vldh_t_node
node
);
int
gcg_comp_m68
(
gcg_ctx
gcgctx
,
vldh_t_node
node
);
int
gcg_comp_m69
(
gcg_ctx
gcgctx
,
vldh_t_node
node
);
int
gcg_comp_m70
(
gcg_ctx
gcgctx
,
vldh_t_node
node
);
int
gcg_comp_m71
(
gcg_ctx
gcgctx
,
vldh_t_node
node
);
gcg_tMethod
gcg_comp_m
[
7
0
]
=
{
gcg_tMethod
gcg_comp_m
[
8
0
]
=
{
(
gcg_tMethod
)
gcg_comp_m0
,
(
gcg_tMethod
)
gcg_comp_m1
,
gcg_comp_m2
,
...
...
@@ -334,7 +336,9 @@ gcg_tMethod gcg_comp_m[70] = {
gcg_comp_m66
,
gcg_comp_m67
,
gcg_comp_m68
,
gcg_comp_m69
gcg_comp_m69
,
gcg_comp_m70
,
gcg_comp_m71
};
...
...
@@ -17061,6 +17065,374 @@ int gcg_comp_m69( gcg_ctx gcgctx, vldh_t_node node)
return
GSX__SUCCESS
;
}
/*************************************************************************
*
* Name: gcg_comp_m38()
*
* Type void
*
* Type Parameter IOGF Description
* gcg_ctx gcgctx I gcg context.
* vldh_t_node node I vldh node.
*
* Description:
* Compile method for SupressSup.
*
* Syntax control:
* Checks that the class of the referenced object is correct.
*
* Code generation:
* Declares and links a write pointer to the referenced object.
* Prints an exec call.
* SupressSup_exec( W800005f6, Z800005e2, Z800005f5->Out);
*
**************************************************************************/
int
gcg_comp_m70
(
gcg_ctx
gcgctx
,
vldh_t_node
node
)
{
ldh_sParDef
*
bodydef
;
int
rows
,
sts
;
int
size
;
pwr_sAttrRef
refattrref
;
pwr_sAttrRef
*
refattrref_ptr
;
ldh_tSesContext
ldhses
;
pwr_tClassId
cid
;
char
*
nocondef_ptr
;
gcg_t_nocondef
nocondef
[
2
];
unsigned
long
nocontype
[
2
];
char
*
name
;
char
cid_str
[
40
];
nocondef
[
1
].
bo
=
1
;
nocontype
[
1
]
=
GCG_BOOLEAN
;
ldhses
=
(
node
->
hn
.
wind
)
->
hw
.
ldhses
;
sts
=
gcg_ref_insert
(
gcgctx
,
node
->
ln
.
oid
,
GCG_PREFIX_REF
,
node
);
/* Check that this is objdid of an existing object */
sts
=
ldh_GetObjectClass
(
ldhses
,
node
->
ln
.
oid
,
&
cid
);
if
(
EVEN
(
sts
))
return
sts
;
/* Get the objdid of the referenced io object stored in the
first parameter in defbody */
/* Get the devbody parameters for this class */
sts
=
ldh_GetObjectBodyDef
(
ldhses
,
node
->
ln
.
cid
,
"DevBody"
,
1
,
&
bodydef
,
&
rows
);
if
(
EVEN
(
sts
)
)
return
sts
;
sts
=
ldh_GetObjectPar
(
ldhses
,
node
->
ln
.
oid
,
"DevBody"
,
bodydef
[
0
].
ParName
,
(
char
**
)
&
refattrref_ptr
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
refattrref
=
*
refattrref_ptr
;
free
((
char
*
)
refattrref_ptr
);
free
((
char
*
)
bodydef
);
sts
=
gcg_replace_ref
(
gcgctx
,
&
refattrref
,
node
);
if
(
EVEN
(
sts
))
return
sts
;
/* If the object is not connected the value in the
parameter should be written in the macro call */
sts
=
ldh_GetObjectPar
(
ldhses
,
node
->
ln
.
oid
,
"RtBody"
,
"In"
,
&
nocondef_ptr
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
/* Check that this is objdid of an existing object */
sts
=
ldh_GetAttrRefOrigTid
(
ldhses
,
&
refattrref
,
&
cid
);
if
(
EVEN
(
sts
))
{
gcg_error_msg
(
gcgctx
,
GSX__REFOBJ
,
node
);
return
GSX__NEXTNODE
;
}
/* Check that the class of the referenced object is correct */
switch
(
cid
)
{
case
pwr_cClass_DSup
:
case
pwr_cClass_DSupComp
:
case
pwr_cClass_ASup
:
case
pwr_cClass_ASupComp
:
break
;
default:
gcg_error_msg
(
gcgctx
,
GSX__REFCLASS
,
node
);
return
GSX__NEXTNODE
;
}
free
(
nocondef_ptr
);
nocondef
[
0
].
bo
=
TRUE
;
nocontype
[
0
]
=
GCG_BOOLEAN
;
/* Insert dsup object in ref list */
gcg_aref_insert
(
gcgctx
,
refattrref
,
GCG_PREFIX_REF
,
node
);
/* Print the execute command */
sts
=
gcg_get_structname
(
gcgctx
,
node
->
ln
.
oid
,
&
name
);
if
(
EVEN
(
sts
))
return
sts
;
switch
(
cid
)
{
case
pwr_cClass_DSup
:
strcpy
(
cid_str
,
"pwr_cClass_DSup"
);
break
;
case
pwr_cClass_DSupComp
:
strcpy
(
cid_str
,
"pwr_cClass_DSupComp"
);
break
;
case
pwr_cClass_ASup
:
strcpy
(
cid_str
,
"pwr_cClass_ASup"
);
break
;
case
pwr_cClass_ASupComp
:
strcpy
(
cid_str
,
"pwr_cClass_ASupComp"
);
break
;
default:
;
}
/* Print the execute command */
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_CODE_FILE
],
"%s_exec( %c%s, %c%s, %s, "
,
name
,
GCG_PREFIX_REF
,
vldh_IdToStr
(
0
,
node
->
ln
.
oid
),
GCG_PREFIX_REF
,
vldh_AttrRefToStr
(
0
,
refattrref
),
cid_str
);
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
"
);
return
GSX__SUCCESS
;
}
/*************************************************************************
*
* Name: gcg_comp_40()
*
* Type void
*
* Type Parameter IOGF Description
* gcg_ctx gcgctx I gcg context.
* vldh_t_node node I vldh node.
*
* Description:
* Compile method for Simulink.
* Generates code to call simulink functions with in and out signals.
*
**************************************************************************/
int
gcg_comp_m71
(
gcg_ctx
gcgctx
,
vldh_t_node
node
)
{
unsigned
long
point
;
unsigned
long
par_inverted
;
vldh_t_node
output_node
;
unsigned
long
output_count
;
unsigned
long
output_point
;
ldh_sParDef
*
bodydef
;
ldh_sParDef
output_bodydef
;
int
rows
,
sts
;
int
i
,
output_found
,
first_par
;
int
size
;
pwr_sAttrRef
output_attrref
;
int
output_type
;
char
output_prefix
;
char
output_par
[
80
];
ldh_tSesContext
ldhses
;
pwr_tString32
*
modelname_p
;
pwr_tString32
*
ainname_p
;
pwr_tString32
*
dinname_p
;
pwr_tString32
*
outaname_p
;
pwr_tString32
*
outdname_p
;
ldhses
=
(
node
->
hn
.
wind
)
->
hw
.
ldhses
;
/* Get Model name stored in devbody */
sts
=
ldh_GetObjectPar
(
ldhses
,
node
->
ln
.
oid
,
"DevBody"
,
"ModelName"
,
(
char
**
)
&
modelname_p
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
strcmp
(
*
modelname_p
,
""
)
==
0
)
{
/* There is no expression */
gcg_error_msg
(
gcgctx
,
GSX__NOEXPR
,
node
);
free
(
modelname_p
);
return
GSX__NEXTNODE
;
}
/* Get Input signals name stored in devbody */
sts
=
ldh_GetObjectPar
(
ldhses
,
node
->
ln
.
oid
,
"DevBody"
,
"AInName"
,
(
char
**
)
&
ainname_p
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_GetObjectPar
(
ldhses
,
node
->
ln
.
oid
,
"DevBody"
,
"DInName"
,
(
char
**
)
&
dinname_p
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_GetObjectPar
(
ldhses
,
node
->
ln
.
oid
,
"DevBody"
,
"OutAName"
,
(
char
**
)
&
outaname_p
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_GetObjectPar
(
ldhses
,
node
->
ln
.
oid
,
"DevBody"
,
"OutDName"
,
(
char
**
)
&
outdname_p
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
/* Print includes */
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_DECL_FILE
],
"\
#include
\"
rtwtypes.h
\"\n
\
#include
\"
%s.h
\"\n
"
,
*
modelname_p
);
/* Print init */
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_REF_FILE
],
"\
%s_initialize();
\n
"
,
*
modelname_p
);
/* Print step code */
for
(
i
=
0
;
i
<
8
;
i
++
)
{
if
(
strcmp
(
ainname_p
[
i
],
""
)
!=
0
)
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_CODE_FILE
],
" rtU.%s = *%c%s->AIn%dP;
\n
"
,
ainname_p
[
i
],
GCG_PREFIX_REF
,
vldh_IdToStr
(
0
,
node
->
ln
.
oid
),
i
+
1
);
}
for
(
i
=
0
;
i
<
8
;
i
++
)
{
if
(
strcmp
(
dinname_p
[
i
],
""
)
!=
0
)
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_CODE_FILE
],
" rtU.%s = *%c%s->DIn%dP;
\n
"
,
dinname_p
[
i
],
GCG_PREFIX_REF
,
vldh_IdToStr
(
0
,
node
->
ln
.
oid
),
i
+
1
);
}
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_CODE_FILE
],
" %s_step();
\n
"
,
*
modelname_p
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
if
(
strcmp
(
outaname_p
[
i
],
""
)
!=
0
)
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_CODE_FILE
],
" %c%s->OutA%d = rtY.%s;
\n
"
,
GCG_PREFIX_REF
,
vldh_IdToStr
(
0
,
node
->
ln
.
oid
),
i
+
1
,
outaname_p
[
i
]);
}
for
(
i
=
0
;
i
<
8
;
i
++
)
{
if
(
strcmp
(
outdname_p
[
i
],
""
)
!=
0
)
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_CODE_FILE
],
" %c%s->OutD%d = rtY.%s;
\n
"
,
GCG_PREFIX_REF
,
vldh_IdToStr
(
0
,
node
->
ln
.
oid
),
i
+
1
,
outdname_p
[
i
]);
}
free
((
char
*
)
modelname_p
);
free
((
char
*
)
ainname_p
);
free
((
char
*
)
dinname_p
);
free
((
char
*
)
outaname_p
);
free
((
char
*
)
outdname_p
);
sts
=
gcg_ref_insert
(
gcgctx
,
node
->
ln
.
oid
,
GCG_PREFIX_REF
,
node
);
/* Get the runtime parameters for this class */
sts
=
ldh_GetObjectBodyDef
((
node
->
hn
.
wind
)
->
hw
.
ldhses
,
node
->
ln
.
cid
,
"RtBody"
,
1
,
&
bodydef
,
&
rows
);
if
(
EVEN
(
sts
)
)
return
sts
;
i
=
0
;
first_par
=
1
;
while
(
(
i
<
rows
)
&&
(
bodydef
[
i
].
ParClass
==
pwr_eClass_Input
))
{
/* Get the point for this parameter if there is one */
output_found
=
0
;
sts
=
gcg_get_inputpoint
(
node
,
i
,
&
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
)
{
output_found
=
1
;
if
(
output_count
>
1
)
gcg_error_msg
(
gcgctx
,
GSX__CONOUTPUT
,
output_node
);
sts
=
gcg_get_outputstring
(
gcgctx
,
output_node
,
&
output_bodydef
,
&
output_attrref
,
&
output_type
,
&
output_prefix
,
output_par
);
if
(
sts
==
GSX__NEXTPAR
)
{
i
++
;
continue
;
}
if
(
EVEN
(
sts
))
return
sts
;
if
(
par_inverted
)
gcg_error_msg
(
gcgctx
,
GSX__INV
,
node
);
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_REF_FILE
],
"%c%s->%sP = &%c%s->%s;
\n
"
,
GCG_PREFIX_REF
,
vldh_IdToStr
(
0
,
node
->
ln
.
oid
),
bodydef
[
i
].
Par
->
Param
.
Info
.
PgmName
,
output_prefix
,
output_type
==
GCG_OTYPE_OID
?
vldh_IdToStr
(
1
,
output_attrref
.
Objid
)
:
vldh_AttrRefToStr
(
0
,
output_attrref
),
output_par
);
}
else
{
/* Point visible but not connected, errormessage */
gcg_error_msg
(
gcgctx
,
GSX__NOTCON
,
node
);
}
first_par
=
0
;
}
if
(
!
output_found
)
{
/* The point is not connected and will point to its
own object */
IF_PR
fprintf
(
gcgctx
->
files
[
GCGM1_REF_FILE
],
"%c%s->%sP = &%c%s->%s;
\n
"
,
GCG_PREFIX_REF
,
vldh_IdToStr
(
0
,
node
->
ln
.
oid
),
bodydef
[
i
].
Par
->
Param
.
Info
.
PgmName
,
GCG_PREFIX_REF
,
vldh_IdToStr
(
1
,
node
->
ln
.
oid
),
bodydef
[
i
].
Par
->
Param
.
Info
.
PgmName
);
}
i
++
;
}
free
((
char
*
)
bodydef
);
return
GSX__SUCCESS
;
}
/*************************************************************************
*
...
...
wb/lib/wb/src/wb_gobj.cpp
View file @
0959114d
...
...
@@ -58,7 +58,7 @@
#define BEEP putchar( '\7' );
#define GOBJ_MAX_METHOD 3
5
#define GOBJ_MAX_METHOD 3
6
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);
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_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_get_object_m0
,
...
...
@@ -136,6 +137,7 @@ gobj_tMethod gobj_get_object_m[40] = {
gobj_get_object_m33
,
gobj_get_object_m34
,
gobj_get_object_m35
,
gobj_get_object_m36
,
};
static
pwr_tAttrRef
gobj_selected_aref
;
...
...
@@ -3163,6 +3165,64 @@ int gobj_get_object_m35( WFoe *foe, vldh_t_node node, unsigned long index)
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
//
...
...
@@ -3246,6 +3306,7 @@ int gobj_expand( WFoe *foe,
case
pwr_cClass_GetBoInt32
:
case
pwr_cClass_GetBoFloat32
:
case
pwr_cClass_GetBoString80
:
case
pwr_cClass_SupressSup
:
sts
=
gobj_expand_m1
(
foe
,
node
,
compress
);
break
;
case
pwr_cClass_and
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment