DSM in DocEng · Representation of DSL concepts DVMEx IDE DSM Tools, RTS and client applications...
Transcript of DSM in DocEng · Representation of DSL concepts DVMEx IDE DSM Tools, RTS and client applications...
Domain-Specific Modeling
How to apply DSM for the development of modeling tools and client
applications for monitoring of measurement and control processes?
• Language construction
• Code generating
• Generating of client applications
• Synchronization between RTS, modeling tools and HMI
Keywords:
domain-specific modeling, model-driven development, model transformations, modeling
tools, model execution, run-time system, HMI components
DVMEx IDE DSM Tools, RTS and client applications 1/27
Various approaches to
Model-driven Development
•Function-block diagrams
This general purpose language (GPL) is used in
automation and mainly contains FBs, type
converters, HWIN, OTCs, … and one type of
relations
•Domain-specific diagrams (models)
This domain-specific language (DSL) is used in
house automation and contains user defined
symbols for objects, relations, roles, properties
and ports
•Models combining both FB and DSM
DVMEx IDE DSM Tools, RTS and client applications 2/27
Basic architecture of modeling
by means of function-blocks
IEC 61131-3 FB diagrams
IEC 61131-3 ST code
generator
(Libraries)
Target RTS or OS
Example:
Function block diagram
DVMEx IDE DSM Tools, RTS and client applications 3/27
Basic architecture of
Domain-Specific Modeling solution
Domain-Specific Language
Code generators (Java,
C++, C#, IEC 61131-3,...)
Domain framework
(Libraries, Web services)
Target RTS or OS
Example:
House automation
DVMEx IDE DSM Tools, RTS and client applications 4/27
Basic architecture of
solution that uses both FB and DSL
Domain-Specific Language
Code generators (Java,
C++, C#, IEC 61131-3,...)
Target RTS
Domain framework
(Libraries, Web services)
Model animation,
app.generator
Action reports
DVMEx IDE DSM Tools, RTS and client applications 5/27
Language construction
(meta-modeling) Objects
DVMEx IDE DSM Tools, RTS and client applications 6/27
<bindings> <binding relType ="Rel" id = "b1" name="Input value" objType = "FunctionBlock,Balance,AnalogControler" portType ="*" roleType="InVal" card="1,1" rules =""/> <binding relType ="Rel" id = "b2" name="Output value" objType = "FunctionBlock,Balance,AnalogControler" portType ="*" roleType="OutVal" card="1,1" rules =""/> </bindings>
Properties
Relations
Constraints
Roles
Ports
Mata-model as XML
(object and relation types)
DVMEx IDE DSM Tools, RTS and client applications 7/27
Mata-model as XML
(properties and domains)
DVMEx IDE DSM Tools, RTS and client applications 8/27
Representation of DSL concepts
DVMEx IDE DSM Tools, RTS and client applications 9/27
Representation of language concept is specified on the meta-model level, but can
be different for each instance and dependent of the RTS state or values of variables
Using generators for integration
in various tools
DVMEx IDE DSM Tools, RTS and client applications 10/27
Generators of code generators
DVMEx IDE DSM Tools, RTS and client applications 11/27
REPORT ExecuteModel INTERVAL 200
/* ---------------- Update DSM control values ------------------ */
var $tp = :RemoteIPPortAsync;
if :TargetRTSPort; = 'SYNC' then
$tp = :RemoteIPPortSync;
endif
var $mList = 'DB GV "CardReader.generator1.OUT,CardReader.add4,
CardReader.generator24.OUT,
CardReader.gentoswitch3.OUT,CardReader.generator5.OUT"'
var $setOfVars = f:EXTERNAL($tp,$mList)
toset $mList $setOfVars,','
foreach {$mList}
{
var $curInd = current.index
var $curVal = current.value
if $curInd=1 then
do {.} where id='dvmexCardReader1' {:OUT=$curVal;}
endif
if $curInd=2 then
do {.} where id='dvmexMoneyCounter1' {:OUT=$curVal;}
endif
if $curInd=3 then
do {.} where id='dvmexDigitalDisplay4' {:OUT=$curVal;}
endif
if $curInd=4 then
do {.} where id='dvmexPipeSwitch1' {:OUT=$curVal;}
endif
if $curInd=5 then
do {.} where id='dvmexMoneyCounter2' {:OUT=$curVal;}
endif
}
REPORT PrepareExecuteModel
var $sList =''
var $prgID = id
append $prgID '.'
'REPORT ExecuteModel INTERVAL 200' nl
'/* ---------------- Update DSM control values ------------------ */'
nl
'var $tp = :RemoteIPPortAsync;' nl
'if :TargetRTSPort; = \'SYNC\' then
$tp = :RemoteIPPortSync;
endif' nl
'var $mList = \'DB GV "'
DVRepLang / MERL syntax on
examples (foreach, do, dowhile)
DVMEx IDE DSM Tools, RTS and client applications 12/27
dowhile #InPort~InVal>Rel~OutVal#OutPort.FunctionBlock
{
$sep
if :IsFunc; = True then
var $tTarPort = :DataType,5; var $tSrcPort = :DataType,1; var $tID=:id;
:id,5; ' := ' ConvertFromTo($tSrcPort,$tTarPort,$tID)
else
:id,5; ' := ' /* :id; '.' :id,1; */
var $tTarPort = :DataType,5; var $tSrcPort = :DataType,1; var $tID=:id;
append $tID '.', :id,1;
ConvertFromTo($tSrcPort,$tTarPort,$tID)
endif
$sep = ', '
}
foreach .FunctionBlock
{
do #InPort~InVal>Rel~OutVal.
{ ' :.' :id,5; '#' :id,4; '.Value=' id '.Value;' nl }
do #InPort~InVal>Rel~OutVal#OutPort.
{ ' :.' :id,6; '#' :id,5; '.Value=' :id; '#' :id,1; '.Value;' nl }
}
DVRepLang syntax on examples
(data retrieving from RTS)
DVMEx IDE DSM Tools, RTS and client applications 13/27
REPORT ExecuteModel INTERVAL 100
/* -------------------------- Input from DSM controls and ports --------------------- */
:.lreal_to_real1#IN.Value=dvmexDigitalDisplay1.Value;
:.add2#IN2.Value=dvmexAnalogScale5.Value;
:*Img3DDeltaY=generator1#OUT.Value;
/* ---------------- Update DSM control values ------------------ */
var $tp = '127.0.0.1:13010'
var $mList = 'DB GV "TimeToRealStatusTest.add2,TimeToRealStatusTest.generator10.OUT"'
var $setOfVars = f:EXTERNAL($tp,$mList)
toset $mList $setOfVars,','
foreach {$mList}
{
var $curInd = current.index
var $curVal = current.value
if $curInd=1 then
do {.} where id='dvmexAnalogScale1' {:OUT=$curVal;}
endif
if $curInd=2 then
do {.} where id='dvmexBeaker3' {:OUT=$curVal;}
endif
}
DVRepLang syntax on examples
(setting values of control properties)
DVMEx IDE DSM Tools, RTS and client applications 14/27
REPORT ExecuteModel INTERVAL 100
/* -------------------------- Input from DSM controls and ports --------------------- */
:.lreal_to_real1#IN.Value=dvmexDigitalDisplay1.Value;
:.add2#IN2.Value=dvmexAnalogScale5.Value;
:*Img3DDeltaY=generator1#OUT.Value;
/* ---------------- Update DSM control values ------------------ */
var $tp = '127.0.0.1:13010'
var $mList = 'DB GV "TimeToRealStatusTest.add2,TimeToRealStatusTest.generator10.OUT"'
var $setOfVars = f:EXTERNAL($tp,$mList)
toset $mList $setOfVars,','
foreach {$mList}
{
var $curInd = current.index
var $curVal = current.value
if $curInd=1 then
do {.} where id='dvmexAnalogScale1' {:OUT=$curVal;}
endif
if $curInd=2 then
do {.} where id='dvmexBeaker3' {:OUT=$curVal;}
endif
}
DVRepLang commands
[append..content]
DVMEx IDE DSM Tools, RTS and client applications 15/27
append
append $tID '.', :id,1;
assign
$pc = 'T'
break
if $toVis = '' then break endif
breakloop
if $found = 'True' then breakloop endif
clause
:BodyColor; {:BodyColor=$p;}
const
'VAR_EXTERNAL'
current
var $curInd = current.index
do, dowhile
dowhile {#OutPort} { :id,1; ':' :DataType; '; ' nl }
foreach
foreach .FunctionBlock { $conn = 'T' }
function: or f: or func:
f:EXTERNAL('127.0.0.1:13010', 'S GA')
f:WEBSERVICE('POST','http://212.114.206.149/DocCounter/WordDocSrv.asmx/GetDocCounter')
f:EXEC('firefox.exe','E:\\Temp\\00318072013091006.html -height 1024 -width 1280')
if
if #OutPort~OutVal>Rel~InVal.; then $toVis = 'T'
input
input
content
$pInp1 = content, false
DVRepLang commands
[insert..write]
DVMEx IDE DSM Tools, RTS and client applications 16/27
insert
insert object ':objType','objID','Left=190.0','Top=310.0'
nl
nl newline
operator
var $cnt = '0' $cnt++ $cnt+=5
param
param $srcType
report
REPORT ConvertFromTo ConvertFromTo($srcType,$tarType,$val)
read
$fileCont = read 'c:\\Temp\\GenFile.txt'
remove
remove object 'SideBal'
toset
toset $mList $setOfVars,','
vardecl
var $dataValue = ''
var
$dataValue
wait
wait 200
write
write 'c:\\Temp\\TarFile.txt'
Action Report browser
DVMEx IDE DSM Tools, RTS and client applications 17/27
foreach .FunctionBlock
{
if :IsFunc; = True then
do {#OutPort}
{
$count++
:Value=$mList[$count]; :Status=$mStat[$count];
}
else
do {#InPort}
{
$count++
:Value=$mList[$count]; :Status=$mStat[$count];
}
do {#OutPort}
{
$count++
:Value=$mList[$count]; :Status=$mStat[$count];
}
endif
}
Referencing properties
DVMEx IDE DSM Tools, RTS and client applications 18/27
/* --------------------- Properties to map from DSL to .Net concepts ---------------- */
<prop name="nameFor_BodyColor" propType=" impName ="BodyColor"/>
<prop name="nameFor_BodyImage" propType=" impName ="BodyImage"/>
<prop name="nameFor_BodyStyle" propType=" impName ="BodyStyle"/>
<prop name="nameFor_FBType" propType=" impName ="FBType"/>
<prop name="nameFor_GlassStyle" propType=" impName ="GlassStyle"/>
/* -------------------- Layouts defaults for language concepts ------------------------- */
<defaults BodyColor="Color [White]" BodyImage="" BodyStyle="Flat" FBType="GENERATOR" GlassStyle="Half"/>
/* ------------------------ Logical for REPORT ModelState ------------------------------ */
{'BodyColor','BodyImage','BodyStyle','FBType','GlassStyle'}
/* ---------------- Implementation names for REPORT ModelState ------------------ */
{:BodyColor;,:BodyImage;,:BodyStyle;,:FBType;,:GlassStyle;}
Types of Action Reports
DVMEx IDE DSM Tools, RTS and client applications 19/27
INTERVAL /* Used for model execution when explicit refresh time is required */
REPORT ExecuteModel INTERVAL 100
...
ENDREPORT
CYCLIC /* Used to execute models on processor idle */
REPORT ExecuteModel CYCLIC
...
ENDREPORT
SINGLE /* Used to execute model only one time or on events */
REPORT ExecuteModel
...
ENDREPORT
How Action Report interpreter
communicates with RTS?
DVMEx IDE DSM Tools, RTS and client applications 20/27
Run-Time
System
Run-Time
System
Interface to RTS • Command language
• Direct interface (LIB)
Communication channels (built-in in AR interpreter)
• High priority TCP/IP channel
• Low proprity TCP/IP channel
• Listener for command results
• Data listener
Action Report Interpreter
MetaEdit+ Modeler .Net extension for ME+
Import meta-model, models and code
into DVMEx IDE
DVMEx IDE DSM Tools, RTS and client applications 21/27
DVMEx IDE, Djukic Software GmbH, www.djukic-soft.com
Using DVMEx IDE :
• Set additional relationships between DSL concepts and .Net
controls, to have full specification of application
• Finalize setting of layout properties
• Start action reports interpreter, that is connected to RTS
• Redesign HMI components and applications “on hot”
Test and refine models
and modeling languages
DVMEx IDE DSM Tools, RTS and client applications 22/27
Test and refine code generators
and HMI components
DVMEx IDE DSM Tools, RTS and client applications 23/27
Model, HMI control, generator, code
DVMEx IDE DSM Tools, RTS and client applications 24/27
Run-Time
System
Run-Time
System
Action
reports
Enjoy the “3D” modeling
DVMEx IDE DSM Tools, RTS and client applications 25/27
Conclusion
DVMEx IDE DSM Tools, RTS and client applications 26/27
Using action reports it is possible:
• to test modeling languages (meta-models), models, code
generators and target interpreter (RTS)
• to integrate any .Net control in modeling
• to produce client applications automatically
• to execute models and define model execution rules using MERL-
like language
• to refine DSL, models, code generators and HMI components by
direct model execution
Action report parser and interpreter are available for .Net framework
Useful links
Videos:
.Net extension for MetaEdit+ Modeler
http://www.djukic-soft.com/Framework/MetaEdit_DVMEx_DSM_RTS.wmv
Animation of MetaEdit+ models
http://www.djukic-soft.com/Framework/MetaEditModelExec.wmv
DSL-s for embedded devices
http://www.djukic-soft.com/Framework/BloodPressDemo.wmv
Contact:
Djukic Software GmbH
www.djukic-soft.com
MetaCase
www.metacase.com
DVMEx IDE DSM Tools, RTS and client applications 27/27