DVMEx Solution (advanced features) - Djukic Soft · Timer, ticker and task intervals ... Configure...
Transcript of DVMEx Solution (advanced features) - Djukic Soft · Timer, ticker and task intervals ... Configure...
DVMEx Solution
(advanced features)
Run-Time
System
Run-Time
System
Special features of DVMEx Solution are implemented in modeling tools, parser,
native-code builder, linker and run-time system scheduler in order to:
• Support refinement of models and modeling languages
• Simplify integration of RTS in various modeling tools
• Use RTS for state machines and synchronization between drivers and scheduler
• Protect RTS from unauthorized use
Modeling tools
DVMEx Solution - Advanced features 1/27
Parser Parser
Native-code
Builder
Native-code
Builder Linker Linker
Generator Generator
Target RTS machine
Timer, ticker and task intervals
DVMEx Solution - Advanced features 2/27
Timer actions
Ticker interval: 0.05 ms for Linux, 1 ms for WinCE / WinXP-Win8
Testing precision of timers used for scheduling
(hardware and OS dependent)
- WinXP-8 ticker (+/- 30 micro sec)
- WinCE ticker (+/- 3 micro sec)
- Linux ticker (+/- 1 micro sec)
Ticker actions Task cycles
Configure timer and ticker
DVMEx Solution - Advanced features 3/27
<LINUX_SYSTEM_PRIORITY_CLASS>VERY_HIGH</LINUX_SYSTEM_PRIORITY_CLASS>
<RECORD_TIMER_ACTIVITIES>FALSE</RECORD_TIMER_ACTIVITIES>
<SCHEDULER_PRIORITY>1</SCHEDULER_PRIORITY>
<!– Windows 15 : critical, 2 : height, 0 : normal, -1 : bellow normal, -2 : lowest -->
<!– WinCE 90 : realtime, 255 : low -->
<!– Linux 0 : high, 99 : low -->
<TIMER_PRIORITY>0</TIMER_PRIORITY>
<STOP_CONF_TASK_PRIORITY>0</STOP_CONF_TASK_PRIORITY>
<TIMER_FREQ>200</TIMER_FREQ>
<!-- MICROSEC -->
<TIMER_EPS_DELAY>-1</TIMER_EPS_DELAY>
<!-- MICROSEC, -1 TO CALCULATE -->
In RTS config file:
RTS language commands:
RTS SHOW_TICK "true"
RTS SHOW_TIMER "true"
Configuration feasibility
DVMEx Solution - Advanced features 4/27
Configuration that contains more tasks with different intervals and priorities
RTS commands used to find optimal configuration settings
• SCHEDULER CONFIG_TIME "Config1"
• SCHEDULER TIME_DOMAIN_SET "*","200"
CPU usage
DVMEx Solution - Advanced features 5/27
RTS returns CPU usage for all tasks and for complete configuration
ET- estimated time for one cycle, I – specified interval, F – CPU usage
ws1 SCHEDULER CONFIG_TIME CONFIG1: ET=6.075ms, F=79.83%cpu
(TASK_RealToBoolTest,INTERVAL,ET=0.017ms,I=10.00ms,F=0.17%cpu)
(TASK_DVModelState,INTERVAL,ET=0.022ms,I=1.00ms,F=2.20%cpu)
(TASK_DVModelPragmaValidate,INTERVAL,ET=0.021ms,I=2.00ms,F=1.05%cpu)
(TASK_TimeToRealStatusTest,INTERVAL,ET=0.021ms,I=3.00ms,F=0.70%cpu)
(TASK_OTC_InOuts,INTERVAL,ET=0.029ms,I=4.00ms,F=0.73%cpu)
(TASK_HardwareSignals,INTERVAL,ET=0.021ms,I=5.00ms,F=0.42%cpu)
(TASK_CardReader,INTERVAL,ET=0.027ms,I=6.00ms,F=0.45%cpu)
(TASK_FunctionsAsParams,INTERVAL,ET=0.022ms,I=7.00ms,F=0.31%cpu)
(TASK_PIDT1,INTERVAL,ET=0.022ms,I=8.00ms,F=0.27%cpu)
(TASK_SpeedTest,INTERVAL,ET=5.848ms,I=8.00ms,F=73.10%cpu)
(TASK_UserDefinedFB,INTERVAL,ET=0.023ms,I=10.00ms,F=0.23%cpu)
(TASK_TimeDataType,INTERVAL,ET=0.020ms,I=10.00ms,F=0.20%cpu)
Auto-detection of task delays
DVMEx Solution - Advanced features 6/27
Delay bigger than 0.2 ms caused by processing commands on high priority over
synchronous interface
Events (declaration)
DVMEx Solution - Advanced features 7/27
...
FUNCTION_BLOCK FUNC1
VAR_INPUT
STR1 : STRINGTYPE;
STR2 : STRING;
Int1 : int;
END_VAR
NIL;
END_FUNCTION_BLOCK
EVENT_HANDLER EventHandler1
VAR_INPUT
STR1 : STRINGTYPE;
STR2 : STRING;
Int1 : int;
END_VAR
VAR_OUTPUT
o1 : INT;
END_VAR
o1 := int1;
END_EVENT_HANDLER
Events - calling
DVMEx Solution - Advanced features 8/27
PROGRAM EventDemo
EVENTS
e1 : EventHandler1;
END_EVENTS
VAR
i1 : INT := 32000;
i2 : INT := 32000;
f1 : FUNC1;
add_1 : add := (in0 := int#0, in1 := int#0, out := int#0);
FUNC1_1 : FUNC1;
END_VAR
RAISE EVENT e1(int1 := 10);
i1 := e1.o1;
FUNC1_1(int1 := 10);
END_PROGRAM
CONFIGURATION CONFIG1
RESOURCE RESOURCE1 ON WinXP
TASK Task_NewProgram(INTERVAL := t#50ms, PRIORITY := 0);
PROGRAM NewProgram WITH Task_NewProgram : Task_NewProgram;
END_RESOURCE
END_CONFIGURATION
How to influence scheduler from driver ?
DVMEx Solution - Advanced features 9/27
1) Synchronous interface time slices (for example 1 ms in each 20 ms)
2) TASK_SpeedTest is suspended for 1000 ms or while condition is satisfied
3) Task_DVModelState that is not suspended
4) Command SCHEDULER SET_SUSPENDED "TASK_SpeedTest","1000"
or notification from driver level – DriverStateChanged(params)
4
2
1
3
How to influence driver from scheduler ?
DVMEx Solution - Advanced features 10/27
class SchedulerEventListener : public SchedulerEventIface
{
public:
void TaskChanged(wchar_t* specId, wchar_t* taskName, wchar_t* progName, ULONGLONG cycle,
ULONGLONG timeStamp, wchar_t status, TaskConfInfo* taskConfInfo)
{
//.... Driver level actions on this notification
}
};
int main()
{
RtsComm* rsComm = new RtsComm();
SchedulerEventListener* listener = new SchedulerEventListener();
rsComm->SetSchedulerEventListener(listener);
//....
}
RTS extension for state machines
Run-Time System and appropriate IEC 61131-3 parser and Native-code Builder
are extended with some IEC 61499 concepts to simplify implementing of state
machines
This feature is very usable for embedded systems
DVMEx Solution - Advanced features 11/27
Algorithms for encryption
DVMEx Solution - Advanced features 12/27
Run-Time
System
Run-Time
System
Modeling tools
Parser Parser
Native-code
Builder
Native-code
Builder Linker Linker
Generator Generator
Code generators, parser and native code builder are places where
unique encryption / decryption algorithms are created automatically
Target RTS machine
Native code decryption
DVMEx Solution - Advanced features 13/27
<DVNativeCodeGen>
<CARDINALITYTEST Id="" FuncCallStackSize="0">
<BIN_SEGMENT PROCESSOR_ARCHITECTURE="INTEL"
OS_VERSION="WIN7">
[ In each code section is stored unique algorithm for the decription of native code in
the context of target machine, user, license type, etc.
This is done by dynamic linker ]
60
55
8B EC
83 EC 0C
FF 35 $$sectPtr
FF 15 $$leaveCritSect
FF 35 $$sectPtr
FF 15 $$enterCritSect
A1 $$step
6B C0 0A
89 45 FC
C7 45 F8 00 00 00 00
C6 05 $ADD1$status 01
A0 $HWIN2$status
3C 00
75 07
Licensing and security
DVMEx Solution - Advanced features 14/27
Registration and order for Run-time System licenses
Company name : Djukic Software GmbH
Street and number : Gärtnerstr. 17
Post code : 90408
Place : Nürnberg
Land : DE
Contact person : Verislav Djukic
E-mail : [email protected]
Phone : 0911 4313686
Fax : 0911 4313687
VAT ID : *****
Notes : Comments
Target processor : ARM
Target operating system : Linux
License type : Professional
Quantity : 1
Request IP : 212.114.206.149
Hard disk ID : 8735305857413211
Processor ID : BFEBFBFF000307B9
Bios ID : 5B565412R
OS Version : Win32NT 6.1.7601 Service Pack 1
RTS IP : 192.168.178.42,192.168.56.1
Model, HMI control, generator, code
DVMEx Solution - Advanced features 16/27
Run-Time
System
Run-Time
System
Action
reports
Platform for automated refinement of
DSL, models, generators and RTS
DVMEx Solution - Advanced features 17/27
Actions:
- Redefine DSL
- Update M2T transofrmations
- Improve target RTS
Unexpected state (reasons):
- Lack of DSM semantics
- Wrong M2T transformation
- Limitations or RTS
Refinement of meta-model (DSL)
DVMEx Solution - Advanced features 18/27
The main goal is to recognize how to extend DSL and code generators
in order to have modeling concepts on higher level of abstraction
Meta-logic, driven by compiler properties
DVMEx Solution - Advanced features 21/27
mov DIV2$status, 1
mov al, __SLIDER1$status
cmp al, 0
jne ok3
mov __DIV2$status, 0
ok3:
movsx ebx, WORD PTR __SLIDER1
mov al,__ SLIDER2$status
cmp al, 0
jne ok4
mov __DIV2$status, 0
ok4:
movsx ecx, WORD PTR __SLIDER2
cmp ecx, 0
jne ok5
mov __DIV2$status, 0
jmp skip6
ok5:
mov eax, ebx
cdq
idiv ecx
mov ebx, eax
mov __DIV2, bx
Generators of generators
DVMEx Solution - Advanced features 22/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 "'
Representations of language concepts
DVMEx Solution - Advanced features 23/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
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 Solution - Advanced features 27/27