Home
Modeling with TDL
Contents
1. TDL source code of module M1 Choose the File gt View TDL Code menu item in the TDL VisualCreator tool This opens a read only text viewer that shows the TDL program text of module M1 Modeling with TDL Guided Tour of the TDL VisualCreator tool e 51 f TDL Code Viewer module Ml public const cl SO public const ce 200 Sensor int 3 uses gets actuator int al 50 uses setal actuator int az ZO0 uses seta e public task inc output int o i 50 uses incImpliol public task dec output int a i sl uses declmpli a mode Cle period 10 ma task freq 2 dec 1 freq l inc actuator freq l al inc o freq 2 az dec o node freq lj if fleetllGuardi s then 11 fine o i inc o dec o dec azs start mode fll period 10 ms task freq l dec 1 freq l inc actuator freq l al inc o freq l a dec o node freq l if fClletleGuard s then l2 fine o inc o dec o dec a s Define module M2 Module M2 exemplifies how a module imports another module In this case M2 imports M1 to access the output ports of M1 s tasks inc and dec Module M2 s task sum simply adds the outputs of MI s inc and dec tasks 52 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL Add module M2 Add another TDL module from the Simulink Library Browser and rename it to M2 IncD
2. As a developer specifies only the timing behavior in TDL the functionality of the tasks has to be implemented in another programming language In this case study we assume that the functions invoked by the tasks and the drivers for reading sensors and updating actuators have been implemented in C as external functionality code The TDL source code shown below indicates this according to the syntax of TDL by the keyword uses module M1 public const cl 50 c2 200 refPeriod 10ms sensor int s uses getS actuator int al c1 uses setA1 int a2 c2 uses setA2 public task inc declaration of task inc output int o c1 uses incImpl o inc by step 10 from 50 to 200 public task dec declaration of task dec output int o c2 uses decImpl o dec by step 10 from 200 to 50 in the following we define the periodic activities of mode f11 1 the invocations of the tasks inc and dec in this mode 2 the actuator updates 3 the frequency with which a mode switch is checked start mode f11 period refPeriod mode period is 10 ms task freq 1 inc LET of task inc is f11 period inc freq 10ms freq 1 dec LET of task dec is f11 period dec freq 10ms actuator freq 1 al inc o actuator al update every 10 ms 4 e The Timing Definition Language TDL in a nut shell Modeling with TDL freq 1 a2 dec o actuator a2 update
3. Synchronous actuator updates and advance calculation In the previously presented Scope output the axis Actuator M2 a shows that the timing behavior of the actuator update follows TDL s LET semantics This means that the actuator is set to the new value of output port sum o with a delay of the task invocation s LET which is 10 ms Digital controller applications however may require updating the actuator as soon as possible As a rule of thumb the task period should be at least 10 times as large as the delay between reading inputs and setting the actuator in order to get stable controller behavior This goal can be reached on slow processors by means of so called advance calculation which splits the calculations done by the digital controller such that a fast calculation of the actuator value can be performed before more CPU intensive operations such as computing a polynomial is carried out later In fact the CPU intensive part for the next round is performed in the delay between setting the actuator and the next reading of the inputs TDL supports advance calculation and fast actuator updates by means of task sequences Modeling with TDL Guided Tour of the TDL VisualCreator tool e 71 A task sequence combines a task invocation and subsequent actuator updates where the actuator updates are performed right at the release time of the invoked task that is in logically zero time after th
4. a g hi Imports 4 Constants i e if c2 Ci Types 4 Sensors ol Actuators Tasks Modes Sensor Either choose the Edit gt Rename menu item that is the menu item Rename in the Edit menu or right click on the listed s7 and choose Rename from the pop up menu Rename the sensor from s to s You can also click twice no double click speed on the s item to edit the name directly in the tree Another option is to edit the Identifier property in the inspector f Module M1 Mode Transitions BEIE File Edit Tools Help Ee mm iy E g Mi Imports 4 Constants e H c2 C Types 4 Sensors B CJ Actuators Tasks Modes Sensor In the inspector change the sensor type to integer int and make it private set the Public property to false Modeling with TDL Guided Tour of the TDL VisualCreator tool e 13 f Module M1 Mode Transitions Fle Edit Tools Help Cl om K F a g Mi Imports Constants H c2 C Types 4 Sensors of Actuators _ Tasks Modes sengor Edit actuators a1 and a2 Each new module has already one actuator We stick to the suggested default name al In the inspector change the Type property to int and set the Initial Value to c1 by selecting that constant from the pop up menu f gt Module M1 JER File Edit Tools Help Hnn z i 11 ES Mode Transitions Imports E 4 Cons
5. gt fl2 E fi12fl2Guard 5 a M f2 inc dec g al fe a2 fy f12 gt f1 Click on the next to the mode switch item labeled f72 gt f11 in the tree This shows the guard function labeled f722f1 1 Guard that we just added to the mode switch 44 e Guided Tour of the TDL VisualCreator tool Modeling with TDL f Module M1 Mode Switch f12 gt 11 File Edt Tools Help Mi Imports a Constants FRUK GANE Target f11 ig ci B c2 Ca Types 9 Sensors s 9 Actuators al G a2 A4 Tasks T inc dec 9 Modes El tm fi inc dec ee al oe a2 a f1 gt 12 E f112f12Guard s E im fi inc dec ee al fe a2 E Cci fiz gt f11 122711 Guard Drag the sensor s from the tree s Sensors folder and drop it on the guard function f122f11Guard in the tree Click on the sign next to the guard function labeled f122fl l Guard and you see that the sensor s was added in the tree as input of the guard function Modeling with TDL Guided Tour of the TDL VisualCreator tool e 45 f Module M1 Mode Switch f12 gt f11 File Edit Tools Help SAio gt 7 R E Mi Imports E 4 Constants SOUR TZ Target f11 H cl c3 C Types 4 Sensors s 9 Actuators al a2 E Sa Tasks inc dec 9 Modes E im fii inc dec fe al fe az a Hi gt fl2 E fl 12fl2Guard s E M fi inc dec g al i a2 a f2 gt f1 E fi 224fl 1 Guard ef The guard function can again
6. 4 Sensors s 4 Actuators al a2 E Tasks T inc dec 9 Modes E m fit inc dec W al fo a2 a fii gt f12 fl12f12Guard iM fl Platforms Simulink Value fi2ti2Guard ExternalGuardFunction Analogous to task functions guard functions can be specified in Simulink Before doing that we define which input the guard function needs the guard function should cause a mode switch if the sensor input has a certain value Let us define that the mode remains f if the sensor value s lt 1 and that a mode switch should occur if the sensor value s gt 1 As a consequence we need to access the sensor value for defining the guard function Thus we drag the sensor s from the tree s Sensors folder and drop it on the guard function f1 2f72Guard in the tree Modeling with TDL Guided Tour of the TDL VisualCreator tool e 39 Module M1 Mode Switch f11 gt 12 File Edit Tools Help r om amp E Mi CJ imports fli Target fl2 S Constants ource a arget 12 H ci E c2 li C Types inc o 3 9 Sensors 2 5 3 4 Actuators ait a2 2 Tasks tTlinc drag amp drop Tlhdec y Modes a fit A gline gO dec k g al a a2 s fii gt f2 m fi2 Property Value Identifier E f112fl 2Guard GuardFunction If you click on the sign next to the guard function labeled f7 2f12Guard you see that the sen
7. i Mi Imports El Constants ig ci c2 C Types 9 Sensors s 4 Actuators al a2 Tasks T inc E dec E 9 Modes to il mM f12 4 Platforms Simulink Name Value Identifier Time Unit Note that you can switch back to the Mode Transition editor by either selecting the Modes folder or the module name M in our case study in the tree For now we keep the Mode editor active to edit mode f7 We drag the task inc in the Tasks folder and drop it on the Mode editor right window pane The operation drag means that you select the inc item in the tree with a left click left mouse button but you do not release the mouse button Then you move the item while keeping the left mouse button pressed The drop operation means that you release the left mouse button at the point where you want to drop the dragged item In this case this is somewhere in the Mode editor The invocation frequency of a task relative to the mode period is specified as the Frequency property As the mode period of f7 is 10 ms this means that inc has a Logical Execution Time LET of 10 1 10 ms Guided Tour of the TDL VisualCreator tool e 27 f gt Module M1 Mode f11 File Edit Tools Help coh amp 2 8 Mi Imports 4 Constants if ci c C Types 4 Sensors Os J 9 Actuators al O a2 drag amp drop pie eooeeerr H Tlinteoe T dec 9 Modes tfi Filin Property Task Frequency
8. E M1 Imports 4 Constants c1 ig c2 C Types 9 Sensors s 4 Actuators al a2 El A Tasks T inc dec mM f11 mM f12 Guided Tour of the TDL VisualCreator tool e 41 Then we add a mode transition from mode f 2 to mode f by clicking in the f72 box and dragging the connecting line to f7 7 Remember that the mouse cursor has to be a hand when you are inside the mode box f12 Once you have started connecting the f12 box with the f1 1 box make sure that before releasing the left mouse button you do that about in the center of the f7 box After connecting the box f with f72 the Mode Transitions editor should have arrows on both ends of the line connecting modes f and f72 and thus should look like this Module M1 Mode Transitions File Edit Tools Help i om M1 Imports 3 9 Constants c1 c2 Types 4 Sensors s 4 Actuators al a2 H Tasks T inc dec Modes M f11 M f12 When you select the arrow line one left mouse click on the line the corresponding item is selected in the tree and you see the properties of the mode switch in the one direction that is from f11 to f12 in the inspector If you left click again you see the properties of the switch from f12 to f11 in the inspector Each further left click on the connecting line with the two arrows toggles the selected switch Make sure you have selected the switch from f12 to f11 42
9. Next we drag M1 inc o and M1 dec o as well as actuator a from the tree and drop Guided Tour of the TDL VisualCreator tool e 67 Module M2 File Edit Tools Help IOLE o M2 M Mode main S Imports E 4 M1 c Constants W cl J c2 Types Sensors amp Tasks Constants M1 inc o Types Sensors S Actuators a amp Tasks H sumlmpl il i2 o 9 Modes M main gO sum An Now we can connect M inc o to il M1 dec o to i2 and o to a f Module M2 File Edit Tools Help nanje i M2 iM Mode main E 9 Imports E 4 fi Constants W ci fac C Types Sensors E 4 Tasks inc o E dec j Constants Types Sensors E 4 Actuators Qa 4 Tasks ee M11 dec o H sumimpl il i2 o 9 Modes E iM main surm i a 68 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL TDL source code of module M2 Choose the menu item File gt View TDL Code menu item in the TDL VisualCreator tool This opens a read only text viewer that shows the TDL program text of module M2 f gt TDL Code Viewer module MZ import Hl actuator int a Ml c uses seta public task sum input ine ili int i output int o Ml cz uses sumlmpl il iZ oj I start mode main period 10 ma task Oreq l sum il Hl inc o siez Hl dec a actuator freq l a Ssum a Test module M2 In the top level subsy
10. gt 10 0 Normal B i p if ui lt 50 ei The If Action block labeled o 200 contains the following blocks L IncDecSample declmpl o 200 Seles Ale Edit View Simulation Format Tool Help Constant Ready 100 ode45 The If Action block labeled o _o 10 contains the following blocks 22 e Guided Tour of the TDL VisualCreator tool Modeling with TDL IncDecSample declmpl o _o 10 File Edit View Simulation Format Tools Help Dg Wg Fa b 100 Normal Cel is Auction Port Edit modes f11 and f12 Each new module has already one mode called mode In order to rename this mode open the Modes folder click on the symbol left to the Modes folder in the tree Click twice no double click on the mode item and change the name to f Alternatively you can right click on the mode text in the tree and choose the Rename item from the pop up menu You can also change the name by selecting the mode text in the tree Then you edit the name in the Identifier property of the inspector Set the Period property to 10 and leave the Time Unit property as milliseconds ms Modeling with TDL Guided Tour of the TDL VisualCreator tool e 23 2 Module M1 Mode mode BEIE File Edit Tools Help i n G E Mi Imports H Constants H ci E c2 C Types 9 Sensors s H Actuators al a2 E 4 Tasks m inc derc 5 Modes M Property Value ifi eriod im
11. 50 contains the following blocks 18 e Guided Tour of the TDL VisualCreator tool Modeling with TDL IncDecSample inclmpl o 50 Seles File Edit View Simulation Format Tools Help i i i 2 EA GP ma 10 0 Normal Action Port Constant Ready 100 File Edit View Simulation Format Tool Help L coe Ge 4b tk GS BAPE ct bP oe 10 0 Normal E9 Action Port Task dec We define task dec in an analogous way as task inc From the File gt New submenu choose Task or right click on the Tasks folder in the tree pane and choose the New Task item from the pop up menu Change the name to dec and make the access public set the Public property to true Modeling with TDL Guided Tour of the TDL VisualCreator tool e 19 f Module M1 File Edit Tools Help Hena E g Mi 8 Mode Transitions Imports 9 Constants if ci c2 ae Oy rose 4 Sensors s 4 Actuators al az 9 Tasks T inc Modes Open the dec folder in the tree click on the symbol left to the dec folder in the tree the dec folder is a subfolder of Tasks and rename the item labeled t Impl to decImpl The decImpl item refers to the task function implementation amp Module M1 File Edit Tools Help mw iy Mi H Mode Transitions Imports 4 Constants H cl ig c2 Ci Types e trade 9 Sensors s a 9 Actuators al a2 a 4 Tasks T inc E dec declim
12. Modeling with TDL TDL VisualCreator e 107 Simulink Buses and TDL Structure Types For each struct type t in module M the TDL VisualCreator tool automatically defines a Simulink Bus object M_t in the Matlab workspace For code generation a Simulink BusCreator block that drives a TDL port block 1 e sensor actuator or task port must have its bus object property set to the corresponding Simulink Bus object Furthermore input signals of a BusCreator block must be named according to their corresponding counterparts represented as struct elements of that type 108 e TDL VisualCreator Modeling with TDL Appendix The Timing Definition Language TDL TDL is a pioneering domain specific high level modeling language for portable and deterministic hard real time control applications This chapter first explains TDL s advantages and argues why the state of the art cannot deliver desired software properties such as determinism and portability Finally we describe all TDL language constructs TDL is in stark contrast to most state of that art methodologies where the timing properties of software systems are accidental consequences of an implementation rather than specified parts of the design Concurrency often relies on low level concepts such as semaphores Further low level concepts such as task priorities and interrupts with which developers have to cope with significantly increase the complexity of the software The result is that w
13. Module Task1 300Hz L Task2 100Hz ia Sensor Actuator mode switch Operation mode Task1 200Hz fx NN f Actuator updates and mode switches are considered to be much faster than task invocations thus they are executed in logical zero time Whereas task invocations adhere to the so called Logical Execution Time LET semantics Comparison with the state of the art Why is state of the art embedded software not deterministic not portable not composable Embedded software for safety critical applications typically does the following periodically The inputs are read from sensors for example the rotation speed of the wheels of a vehicle processed by a function and the results are forwarded to other functions or actuators as soon as the calculation is finished The only constraint is that the function calculation finishes before a deadline The problem is that this programming model leads to non deterministic behavior as illustrated in the following figure In the example the deadline for the two functions is shown as dotted red line Thus the slower computation of function 1 indicated by the length of the upper arrow is as fine as the faster computation indicated by the short lower arrow because both computations finish before the deadline of function 1 The gray sections in the arrows indicate suspension times of the particular function Unfortunately function 2 which requir
14. Ready 100 FixedStepDiscrete Note that you can define any number of mappings by dragging more Distribution to your model 76 e Guided Tour of the TDL VisualCreator tool Modeling with TDL IncDecSample2 Fle Edit View Simulation Format Tool Help i Normal amp DiS ed GS gt Step Data Type FlexRay 2 mabx time tiggered Ethernet Ready 100 FixedStepDiscrete The following screen shot exemplifies one TDL module to node mapping by means of one TDL VisualDistributor instance for FlexRay The TDL modules specified in the model are listed in the Modules folder We assume that the platform and topology have already been defined Then the developer simply drags a module listed in the Modules folder to the node where it should be executed In the example Node executes module M1 and Node2 executes module M2 The two nodes are connected to a bus called FlexRay bus f TDL VisualDistributor FlexRay 2 mabx Fie Edit Help EHan o gt System i Clusters o ed lexRay bus Property Value Name FlexRay bus Modeling with TDL El i Connected Modes Model E Nodes O Sender Modules E L Nodes E Model El G gt Placed Modules gb Mt E Connected Clusters E ma Node E gt Placed Modules go M2 E Connected Clusters E gt Modules amp M1 a O Mz Platform Class FlexRay Platform Options send all required ports Cluster FlexRay All necessary code to execute the TDL modul
15. the TDL module has the same input ports corresponding to the module s sensors and output ports corresponding to the module s actuators as the original subsystem migrationSample BEIR File Edit View Simulation Format Tools Help c gt 1 10 0 Normal Ini Outi fF ExistingSubsysterm If necessary adapt the mode period and respectively the frequency of the task invocation accordingly Adding a subsystem as task to a TDL module The translation feature illustrated above is useful if you want one subsystem to become a TDL task in a TDL module If you want several subsystems to become TDL tasks in one module the TDL VisualCreator offers an appropriate editing support either Let us assume we want to add another existing subsystem as task to the TDL module we just have defined Modeling with TDL z migrationSample He Edt Vew Simulation Format Toob Help ce ed B gt m foo ExistingSubsystem anotherExistingSubsystem Module Ready 100 Then we open the TDL module with a double click and choose the Import task item from the Tools menu P Start Simulation Rebuild Model Import Task Translate Subsystem Show Import Relations Then we select the subsystem we want to incorporate as task in the module Import task Choose a top level subsystem migrationSample anotherExistingSubsystem Abbrechen This results in an additio
16. the output ports of task inc and dec in M1 as well as for actuator a and all ports of task sum in M2 TDL ports that use an array data type expect multiplexed Simulink signals and ports using a struct data type expect a Simulink bus as in or output Module M1 Seles File Edit Tools Help am Fe i Mi H Mode Transitions Imports Constants Sensors E 4 Actuators a al init a a initAzZ a Tasks T inc T dec E 9 Modes E iM f2 im fii Property Value Identifier array Type ublic rue ategory array esiqnator ength Note that an output port or actuator of type array or struct cannot be initialized by a value defined with its Initial Value property An initializer function must be used instead Creating initializer functions To create an initializer function for a port right click on the port in the tree and select New init function from the pop up menu 74 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Analogous to task or guard functions initializer functions are specified in Simulink IncDecSam ple InitFunction A E fx Fie Edit View Simulation Format Tools Help De Hg D E _return_ Constant FixedSteoD We have to create initializer functions for all actuators and output ports in our example This short summary of structured types concludes the guided tour of the TDL VisualCreator tool We recommend that you ex
17. 9 Modes iM model M mode Property Value Identifier elease function This means that the task execution is split in two functions the release part and the one that can be used for advance calculations For details we refer to the definition of the task sequence in the TDL language report The TDL source code fragment illustrates which effect the definition of a task sequence has on the textual version of the task definition as task sample input double in output double out state double s uses release sampleRelease in out uses sampleImpl in out Zi start mode model period 10 ms task freq 1 sample in s1 al sample out d Modeling with TDL TDL VisualCreator e 101 Port Assignment editor Assignments must be to output ports of tasks invoked in the target mode and must be thought of as initializations carried out as a first step in the affected target task s functionality code If you need to assign values to output ports of tasks invoked in the target mode for example from the output values of tasks in the source mode then you need to activate the Port Assignment editor Click on the mode switch in the tree where you want to define the port assignments You see the mode switches listed as sourceMode gt targetMode For example you activate the Port Assignment editor in our sample TDL module by clicking on mode1 gt modez2 in the tree amp Module SampleTDLModule Mo
18. Actuators GJ Tasks Modes Sensor For further details we refer to the EBNF definition of this TDL construct TDL Actuator declaration An actuator declaration requires the definition of the following properties Identifier name Type choose one of the supported types from a pop up menu in the Value column Setter name of an external setter function Initial Value If you do not specify a setter function the default name setSensorName is used where SensorName is the Identifier starting with a capital letter In the following example this would be setAl as the Identifier has the value al The properties are listed in the navigator f Module SampleTDLModule Hle Edt Tools Help mm R E 8 SampleTOLModule H Mode Transitions Imports Constants Types Sensors E 4 Actuators amp Tasks Modes Property Value Identifier Type ome Initial Value es For further details we refer to the EBNF definition of this TDL construct TDL VisualCreator e 91 92 e TDL VisualCreator TDL Task declaration We first present the task declaration when we use the TDL VisualCreator tool within Simulink In this case a task declaration requires the definition of the following properties Identifier name and Public enable or disable access to task output ports from other modules The property Release function is automatically set depending on whether the task is part of a task sequence or not The properties ar
19. Identifier pott ooo o o ype double nitial Value Output Port Rename the output port to o and change its type to integer int with the Initial Value of c1 select the constant from the pop up menu gt Module M1 Sees File Edit Tools Help oni i Mi H Mode Transitions Imports 4 Constants ig cl cz oa hp rose EJ Sensors s Actuators al G a2 9 Tasks a inc H inclmpl of Modes 1 Property Identifier Initial alue Output Port The task function can now be modeled in Simulink by simply double clicking on the incImpl item in the tree This opens a Simulink editor window Modeling with TDL Guided Tour of the TDL VisualCreator tool e 17 IncDecSample TaskFunctions inclmpl File Edit View Simulation Format Tool Help Dia eSB Qs gt foo Noma A Re euam Tt The outport o on the right side in the window corresponds to the output port of the task The inport o provides the value of o as calculated in the previous task invocation We model the straight forward functionality of task inc by means of standard Simulink blocks The incImpl increments its output value by 10 starting with the initial value of c 50 up to the upper limit c2 200 7 IncDecSample TaskFunctions incImpl Seles File Edit View Simulation Format Tool Help coe Wgl GS Ob 0 0 Normal Del h ifful gt 200 alzs The If Action block labeled o
20. M2 File Edit Tools Help mm M2 H Imports E 4 M1 Constants W ct M c2 C Types Sensors a Tasks a ar inc g E H dec o Constants C Types Sensors E 4 Actuators a E Tasks H Mode Transitions sumlrmpl porti port pot Modes Property Identifier Release function Task Rename port to il and set its type to int 60 e Guided Tour of the TDL VisualCreator tool Modeling with TDL f Module M2 File Edit Tools Help om i E g M2 H Mode Transitions 4 Imports 4 f 5 Constants W ci H c2 C Types Sensors E Tasks a g inc g E g dec g Constants C Types Sensors 4 Actuators Ga Tasks El sum sumlmpl port port Modes Input Port Rename port2 to i2 and set its type to int Modeling with TDL Guided Tour of the TDL VisualCreator tool e 61 f Module M2 File Edit Tools Help on R E g M2 H Mode Transitions 4 Imports 4 f 5 Constants W ci H c2 C Types Sensors E Tasks a g inc g E g dec g Constants C Types Sensors Y Actuators Ga Tasks El sum sumlmpl i on port Modes Input Port Rename ports to o set its type to int and define the Initial Value as M c2 62 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL amp Module M2 H Imports E hat Constants W ci W c2 C Types Sensors E 2 Tasks E A inc g E dec g C
21. Q GJ Tasks ES Modes Edit task sum From the File gt New submenu choose Task or right click on the Tasks folder in the tree and choose the New Task item in the pop up menu Rename the task from t to sum and set the Public property to true Modeling with TDL Guided Tour of the TDL VisualCreator tool e 57 amp Module M2 File Edit Tools Help an 2 a Me H Mode Transitions a 9 Imports E 4 M1 Constants W ct W c2 C Types Sensors E 4 Tasks a fr inc g a fr dec g Constants C Types Sensors Actuators Qa E H Tasks Ea Modes Click the left to task sum and rename the task function from tl Impl to sumImpl 58 e Guided Tour of the TDL VisualCreator tool Modeling with TDL f Module M2 File Edit Tools Help n m g E g M2 S Mode Transitions a Imports M1 4 Constants W cl fa c2 i Types Sensors E Tasks a Gr inc j a g dec j Constants C Types Sensors a 4 Actuators Ga E Tasks E Sum sumlmyl Modes Property Value Identifier Task Function The task needs two input ports and one output port Add these ports to task sum by right clicking on the sum item in the tree and selecting twice the New input port and then once the New output port menu item in the pop up menu After adding the two input ports and one output port the tree should look as follows Modeling with TDL Guided Tour of the TDL VisualCreator tool e 59 f gt Module
22. TDL module the definition of constants of a sensor and of two actuators as well as the definition of two tasks and two modes Guided Tour of the TDL VisualCreator tool e 9 Start TDL VisualCreator in Simulink First we start Matlab Simulink and open the library If the TDL Library with the green Module block does not appear as shown in the screen shot make sure that you set up Matlab Simulink properly The yellow box is only listed if you also have licensed the TDL VisualDistributor which is not included in the demonstration version of the TDL VisualCreator tool D2HLink_ 10162You drag the Module block from the TDL Library into a Simulink editor that is a new model and name the module M1 Save the Simulink model as IncDecSample IncDecSample K Bf File Edit View Simulation Format Tools Help Dee ee G b 10 0 Normal A double click on the green box representing the TDL module M1 opens the TDL VisualCreator tool FS Module Mi Mode Transitions File Edit Tools Help iS am GB M1 C Imports Constants E E Actuators Tasks Modes The tree in the upper left window pane groups the module imports and TDL constructs of module M1 in folders We call the tree pane just tree for short The right hand editor pane shows different editors depending on the editing state and your selection The default editor is the Mode Transitions editor A new module has as default mode one named mode and t
23. Task Invocation Next we drag and drop task dec as well as the actuators a and a2 from the tree into the Mode editor 28 e Guided Tour of the TDL VisualCreator tool Modeling with TDL f Module M1 Mode f11 File Edit Tools Help i ow RF E g Mli Imports E 4 Constants ig ci ig c2 C Types 4 Sensors s 4 Actuators al a2 a 4 Tasks T ince dec E Modes a M fi inc dec oe al a2 M fl2 Then we connect the output port of task inc with actuator a This corresponds to the assignment al inc o in the textual version of a TDL program In an analogous way we connect the output port of task dec with actuator a2 Modeling with TDL Guided Tour of the TDL VisualCreator tool e 29 f Module M1 Mode f11 File Edit Tools Help i ow RF E g Mli Imports E 4 Constants cl ig 2 C Types 4 Sensors s 4 Actuators al a2 a 4 Tasks T ince dec E Modes a t f11 inc dec oe al fo a2 M fl2 Mode f 2 is defined in an analogous way as mode f with the only differences that the invocation frequency of task dec is 2 and that the actuator update frequency of a2 is also 2 Let us define f 2 step by step We select mode f 2 in the tree to activate its Mode editor Then drag the task inc from the Tasks folder in the tree and drop it on the Mode editor right window pane We leave the Frequency property of task inc set to 1 which mean
24. Tools Help ai os amp FP i SampleTOLModule C Imports S Constants i Rename Strg R Delete Entf rs a Tasks Modes Property identifier Public Expression Constant The n you can edit the name directly in the tree TDL VisualCreator e 85 f Module SampleTDLModule Mode Transitions Fle Edt Tools Hep i aw e El 8 Sample TOLModule Imports 4 Constants a ro C Types Sensors C Actuators B Tasks Modes Property Value if cto ublic xpression C Constant Alternatively you can also select the particular item in the tree and choose the Edit gt Rename menu item Undo Mew Constant rs Redo Rename A Delete Deleting a TDL construct Select the particular item in the tree and choose the Edit gt Delete menu item Undo New Constant Strg 2 ru Reda Strq s Rename ag R Alternatively you can right click on the item in the tree and choose Delete from the pop up menu 86 e TDL VisualCreator Modeling with TDL TDL constructs Modeling with TDL Module SampleTDLModule Mode Transitions Fie Edit Tools Help e amp SampleTDLModule G Imports i C Actuators Sj Tasks Modes Property Identifier Public Expression Constant TDL program text At any time you can generate the textual representation of the TDL module you are editing in the TDL VisualCreator Choose the File gt View TDL Code menu item for that pur
25. Types Sensors Actuators Ci Tasks E Modes Property Value ifi ublic Cs xpression Constant In the inspector mark the access as public that is set the value of the Public property to true and set the Expression to 50 Guided Tour of the TDL VisualCreator tool e 11 f Module M1 Mode Transitions File Edit Tools Help eS mw a g hi Imports 4 Constants a La Types Sensors j Actuators Ci Tasks Modes Property Value Identifier ublic Expression Constant To add the constant c2 choose again the File gt New gt Constant menu item or right click on the Constants folder in the tree We stick to the suggested default name c2 Mark the access property of constant c2 as public that is set the value of the Public property to true and set the Expression to 200 f Module M1 Mode Transitions File Edit Tools Help Gl K GB M1 CJ Imports 4 Constants C Types Sensors Cq Actuators C Tasks Modes Property Value Identifier Constant Edit sensor s Each new module has already one sensor In order to rename this sensor open the Sensors folder in the tree click on the symbol left to the Sensors folder in the tree and click on the sensor labeled s1 12 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Module M1 Mode Transitions BEIG Fie Edit Tools Help i mor g
26. be modeled in Simulink by simply double clicking on the f122f I Guard item in the tree This opens a Simulink editor window Add a Data Type Conversion block and a Fen block from the Simulink library and set the condition to u lt 1 The Fen block returns 1 if the condition u input lt 1 holds true and returns O if the condition u gt 1 holds true The specification of the guard function should look like that 7 IncDecSample GuardF unctions f122f1 1Guard Sele File Edit View Simulation Format Tools Help FixedStepDiscrete Finally we specify by means of the Port Assignment editor how output ports of a mode s tasks are initialized after a mode switch Let us do that first for the mode 46 e Guided Tour of the TDL VisualCreator tool Modeling with TDL switch from f to f12 For this purpose select the mode switch item labeled f11 gt f12 in the tree f Module M1 Mode Switch f11 gt 12 File Edit Tools Help Source ifl Target fl2 4 Constants a get 2 Eci H c2 C Types 49 Sensors s 4 Actuators al a2 4 Tasks T inc dec 9 Modes E iM fit Ji s a Mi fi2 inc dec fo al fe a2 f12 gt f1 E fi22f11 Guard Switch We connect the output port of task inc in f1 1 with the output port of task inc in f12 And we also connect the output port of task dec in f7 with the output port of task dec in f12 M
27. every 10 ms mode freq 1 if switch2f12 s then f12 mode switch depends on s mode f12 period refPeriod task freq 1 inc freq 2 dec LET of task dec is 10ms 2 5ms actuator freq 1 al inc o freq 2 a2 dec o a2 is updated every 5ms mode freq 1 if switch2f11 s then f11 mode switch depends on s j j module M2 import M1 actuator int a M1 c2 uses setA public task sum input int 11 int 12 output int o M1 c2 uses sumImpl il 12 0 o 11 12 start mode main period M1 refPeriod task freq 1 sum M1 inc o M1 dec o actuator freq 1 a sum o The following figure shows the outputs of module M1 s inc and dec tasks and module M2 s sum task Module M1 is in mode f11 in the beginning because the mode f11 is marked as start mode so that the sum task is producing a constant output After pushing the sensor button a mode switch occurs and task sum produces the corresponding output pattern The delay between the output of the sum task and the output of the inc and dec tasks is due to the LET semantics Modeling with TDL The Timing Definition Language TDL in a nut shell e 5 219 500k gt TDL modeling and platform deployment This manual describes the platform independent development of TDL components Instead of the textual notation shown above a visual interactive tool can be used that we called the TDL VisualCreator We have seamlessly int
28. have to invest with state of the art methods and tools Determinism If a software component is called twice with the same input values at the same time instants it should both times produce the same output values at the same time instants Appendix The Timing Definition Language TDL e 109 TDL concepts Example If a control component receives the same sensor values it should always react exactly in the same way Consequences e Determinism is crucial in the context of product liability e Testability each behavior can be reproduced e Determinism is the precondition for ultra reliable systems Most of the currently available embedded software is not deterministic see the explanation below Portability The behavior of a software component should be specified independent of its implementation Example The hardware operating system or bus architecture can be changed without changing the behavior of the application components Consequences e Protection of development and testing investments e Upgradability of hardware Composability The behavior of a software component should be independent of the overall system load and configuration Example A new component can be added to a system without changing the behavior of the original components Consequences e Significantly reduced costs for component integration e Extensibility and maintainability of systems e Reduced development costs through reuse of
29. is the core abstraction of TDL that allows the abstraction from platform details and that delivers time and value determinism LET means that the observable temporal behavior of a task is independent of its physical execution It is only assumed that physical task execution is fast enough to fit somewhere within the logical start and end points The following figure shows the relationship between logical and physical task execution logical view task invocation The inputs of a task are read at the release event and the newly calculated outputs are available at the terminate event Between these the outputs have the value of the previous execution release i i terminate Logical Execution Time LET time LET introduces a delay for observable outputs which might be considered a disadvantage On the other hand however LET provides the cornerstone to deterministic behavior platform abstraction as basis of portability and well defined interaction semantics between parallel activities It is always defined which value is in use at which time instant and there are no race conditions or priority inversions involved If the output of a task is written to an actuator the LET can also be zero For details we refer to the description of the task declaration and mode declaration as well as the definition of a socalled task sequence The following case study illustrates how TDL modules are defined and how their timing behavior is defined ac
30. on to Simulink 80 e TDL VisualCreator We have tested the TDL VisualCreator tool with Matlab version 7 0 R14 and 7 1 R14SP3 Simulink version 6 0 R14 and 6 3 RI4SP3 Real Time Workshop version 6 0 R14 and 6 3 R14SP3 and Real Time Workshop Embedded Coder version 4 0 R14 and 4 3 RI4SP3 Modeling with TDL Modeling with TDL Thus we recommend to use the TDL VisualCreator tool within these environments Execute the TDLVisualCreatorSetup exe file The installation wizard will guide you through the installation F TDLVisualCreator Setup U CTEC Welcome to the TDLVisualCreator Setup Wizard This wizard will guide you through the installation of TOLVisualCreator Itis recommended that you close all other applications before starting Setup This will make it possible to update relevant system files without having to reboot your computer Click Next to continue Then start Matlab change to the TDL VisualCreator installation directory and start the setup m script Current Directory c programme preetec IDL isualCreator ac mS BH All Files File Type lib Folder C plugins Folder 9 simulink Folder i Readme txt TAT File l file EXE File i JAR File ENA EXE File Open as Text Open Outside MATLAB Import Data New Rename Delete Source Contral uk Strg Copy Strg t File Filter Add to Path F Refresh lt Hi Connect the hardware lo
31. the tree as an item labeled f11 gt f12 in the mode folder f11 which is a subfolder of the Modes folder This item is selected in the tree in the above screen shot The Frequency property is set to 1 which means that the mode switch is checked every 10 ms mode period of mode f7 1 10 ms We now define that a mode switch from f to f72 should occur if the sensor s reads a value larger or equal to 1 Right click on the mode switch item labeled f7 1 f12 in the tree and select the New Guard menu item in the pop up menu The window will look like the following screen shot showing the Port Assignment editor in the right window pane for the explanation of the purpose of that editor and how to use it see below Guided Tour of the TDL VisualCreator tool e 37 gt Module M1 Mode Switch f11 gt 12 File Edit Tools Help Ei more g a M1 Imports a amp Constants source fT 1 Target 12 H cl Ec C Types E 9 Sensors s 4 Actuators al a2 E Tasks T inc dec E 9 Modes E im fit inc dec A gt 12 Click on the next to the mode switch item labeled f11 gt f12 in the tree This shows the guard function labeled f1 12f12Guard that we just added to the mode switch 38 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Module M1 Mode Switch f11 gt 12 File Edit View Tools Simulation Help i K ru P E i Mi Imports E Constants source 11 Target 12 c c2 C Types
32. up menu 106 e TDL VisualCreator Modeling with TDL amp Module Module File Edit Tools Help inn QR E Module H Mode Transitions Imports Constants Types E Sensors Oy veces Actuators Outputs E CY Tasks New input port Mew output port Mew skate port Rename Strg k TRTE Delete Entf enter Synchronize Task Declaration Publi Release uai Synchronize bask declaration with Simulink task Function implementation This will create a task input port for each Simulink Inport and a task output port for each Outport in the task function Module i migrationSample TaskF unctions SES C imports File Edit View Simulation Format Tools Help C Constants 3 x 7 ia Types DSUS teea for Sensors Actuators Guiputs Y Tasks haiti ti Ir in Q m2 outt HH Modes EJ 7 Functionality code generation in Simulink When using the TDL VisualCreator tool within Simulink together with the Real Time Workshop Embedded Coder functionality modelled in task guard and initializer functions can be turned into C code Choosing the File gt Export Functionality Code menu item starts the functionality code generation for the particular TDL module and places all files in a directory of your choice Please refer to the TDL VisualDistributor tool documentation for more details about code generation particularly with regard to platform mapping and platform specific code
33. we refer to the EBNF definition of this TDL construct TDL Constant declaration A constant declaration requires the definition of the following properties Identifier name Public enable or disable access from other modules Expression value of the constant The properties are listed in the navigator gt Module SampleTDLModule Mode Transitions File Edit Tools Help iS aml SampleTOLModule C Imports E 4 Constants al Oy roe C Types E3 Sensors Actuators a Tasks Modes Constant For further details we refer to the EBNF definition of this TDL construct TDL Type declaration A type declaration requires the definition of the following properties Identifier name Public enable or disable access from other modules and Category Depending on the Category value additional properties may have to be defined Modeling with TDL Module Sample TDLModule File Edt Help Sli os R E SampleTDLModule Imports Constants rl Sensors Actuators Tasks Modes Property Value Categories e alias Alias types require the definition of the supplemental property Designator basic or user defined type e array Array types additionally require also the Designator and Length property to be set e struct Struct types need no additional properties Elements are added by right clicking on the type in the tree and require the definition of the Identifier name and Type pro
34. As case study we stick to the two TDL sample modules introduced before Remember the following figure which presents schematically the two modules with their modes tasks and ports r Sensor mode f11 Inc LET 10ms Dec i LET 10ms CO Mode Switch mode f12 Inc LET 10mes Dec LET 5ms Module M Import aa Module M2 mode main Actuators Sum LET 10ms 2 Actuator gt E Module M has one sensor input two tasks called inc and dec and two actuators connected to the output ports of the tasks The inc task increments its output value by 10 starting with the initial value 50 up to the upper limit 200 The dec task decrements its output value by 10 starting with the initial value 200 down to the lower limit 50 The sensor is only used for switching between the two modes of the module In mode f both tasks have the same LET namely 10 ms In mode f7 2 the task dec has a LET of 5 ms it produces the output values twice as fast as task inc Module M2 imports module M1 and thus has access to its public members in particular to the output ports of M1 s tasks inc and dec Module M2 s task sum simply adds the outputs of M1 s inc and dec tasks The LET of task sum is 10 ms Define module M1 Modeling with TDL Module M comprises many typical elements of a
35. DL VisualCreator tool e 65 f gt Module M2 File Edit Tools Help om E g M2 M Mode main 4 Imports E a ft 5 Constants W ci H c2 C Types Sensors E Tasks a g inc g E g dec g Constants C Types Sensors 9 Actuators Ga a 9 Tasks E sum Gi sumimpl il Task invocation and actuator update To assign task sum to mode main we activate the Mode editor by selecting the main item in the tree pane Remember that you can switch back to the Mode Transition editor by either selecting the Modes folder or the module name M2 in this case in the tree For now we keep the Mode editor active to edit mode main Drag the item in the tree that represents task sum and drop it on the right Mode editor pane The task sum is displayed as box with its name as well as its input and output ports If you select the task instance you see that the Frequency property is set to 1 As the mode period of main is 10 ms this means that sum has a Logical Execution Time LET of 10 ms in mode main 66 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL amp Module M2 File Edit Tools Help am BR o M2 Imports E 4 M1 Constants oa c1 J c2 Types Sensors amp A Tasks Constants C Types Sensors Actuators Qa 9 Tasks sum E sumimpl il i2 o 99 Modes M main fq sum them on the Mode editor M Mode main
36. Modeling with TDL Copyright igen com rch 2008 Contents The Timing Definition Language TDL in a nut shell 1 What is a TDL component module cece eeceececcceeececceeeeeaeeeeeseseeceeeeeeeeeeeesausaeassseeeeeeeeeess 2 L zical Execution Ime LET re a a a EEEa 3 TDL sample MOG MICS ep e e E r 3 TDL modeling and platform deployment cccccccccccceeceeeeeeseseeseseececeeeeseeeeeaesssasesseeeeeeeeess 6 Guided Tour of the TDL VisualCreator tool 9 Def memodale M hressar a a eis meaeiabormeincaceuneteuancenes 9 Start TDL VisualCreator in Simulink cc ccsssssssseseeeeeeeeeeeeeeesaesaeeeseseeeeeeeeees 10 Add constants Crand d2 cai ch nade sactese su Ea E EE EERE 1 Peo TOn sree Sede ge gcteonauroeitss tla evan eceouead tena amaast E tec dage eater ee 12 EGit ac tiatonsii land G2 oi ela cssy ses cuctunat vid a sa avecuns e ean ivadcdngeacens bees 14 GUE TASS incana CC 25sec a nce ni sedis transl e ene nese a EE 15 Edt modes TLI and TIZ iniaeeaa stuns cosie E oa vamtens toh cade E 23 Tost module Mi deai a E eueeatvca dues see 49 DE S urce code or module Miec soies a a a 51 DSTI SMO We M eb tet ae casei Massa een tuted acon beaut loud E E A E A 52 PROG STAG A ULE V1 2 rure E a dgnadade Sia Bens euinmuad ia an asuatciae ateneaes 53 REMOVE SENSOR ora a E eat oak angusdade Mia Ben cmuae tiara auetmaeeatene ens 53 aport module MI oss aces setts a E vadantelededuilen cameead Marval exude hae 54 EGG ACHIALOR Grssstar sae
37. ability of TDL components The TDL component C1 could be deployed on a cluster consisting of 3 dSpace MicroAutoBox nodes or any other platform or topology develop software component once deploy on any platform ene FlexRay based communication In other words developers can ignore the execution platform hardware processors communication protocol operating system and even the distribution topology when modeling the behavior of an embedded real time software system A TDL program explicitly specifies the exact real time interaction of software components with each other and the physical world The execution platform is specified separately of the TDL program typically after the developers came up with an appropriate TDL program that solves a particular control engineering problem Then automatic code generators create the efficient code from the TDL program for a specific platform The Timing Definition Language TDL in a nut shell e 1 Unprecedented quality time and value determinism There is another important first regarding quality TDL is the first technology that guarantees that the same input values at the same time instants result in the same outputs at corresponding same time instants Furthermore we guarantee that the behavior specified in TDL is exactly the same on any target platform If a target platform does not offer sufficient computing and communication resources the code generators would report tha
38. ck dongle to a free USB port in case of using the product version for the demonstration version you do not need a hardware lock restart Matlab and open the Simulink Library Browser Then the TDL Library should be listed as shown in the following screen shot When you select it you see the TDL TDL VisualCreator e 81 Preliminaries 82 e TDL VisualCreator Module block green box and the TDL Distribution block yellow box In case of the demonstration version no Distribution block is listed in the TDL Library i Simulink Library Browser Ses Fie Edit View Help D ce a dh Module deterministic portable embedded software component Simulink E Distributii W Control System Toolbox reams istribution W Model Predictive Control Toolbox Pa W Real Time Workshop Modul W Real Time Workshop Embedded Coder Simulink Control Design W Simulink Extras W Simulink Parameter Estimation la Stateflow im System Identification Toolbox ee Ready After adding the Module block to a Matlab Simulink model you double click on that block and the corresponding TDL VisualCreator opens for editing the particular TDL module If you need to map the TDL module s to a specific platform you drag one Distribution block for each mapping into the Matlab Simulink model With a double click you open the TDL VisualDistributor tool with which you can specify the platform map the TDL modules to that platform and gen
39. components The TDL tools are world wide the first ones that can deliver all these properties of embedded software The basis for that are the TDL module concept invented in the realm of the MoDECS Model Based Development of Embedded Control Software project http www MoDECS cc and an adequate abstraction of the timing behavior called the LET abstraction from the underlying platform invented at the University of California Berkeley TDL separates timing concerns such as sampling rates and output jitter from functionality concerns such as control laws and device drivers A TDL program supervises the interaction between software processes and the physical world but does not itself transform data All computation is encapsulated inside the supervised software processes which can be written in any non embedded programming language such as C We refer to a TDL program as a timing program and to the 110 e Appendix The Timing Definition Language TDL Modeling with TDL Modeling with TDL supervised processes called by the TDL program as functionality programs The functionality programs can be modeled in Simulink C source code can be generated from the Simulink models Note that this separation of timing and functionality also protects intellectual property that is the control laws that correspond to the functionality programs In other words TDL enforces a programming discipline the strict separation of timing and functionali
40. cording to the LET abstraction TDL sample modules Modeling with TDL We illustrate TDL by means of two modules with simple functionality The figure below shows a schematic representation of the modules with their modes tasks and ports Module M1 has one sensor input two tasks called inc and dec and two actuators connected to the output ports of the tasks The functionality of the inc task is that it increments its output value by 10 starting with the initial value 50 up to the upper limit 200 The functionality of the dec task is that it decrements its output value by 10 starting with the initial value 200 down to the lower limit 50 The sensor is only used for switching between the two modes of the module In mode f11 both tasks have the same LET namely 10 ms In mode f12 the task dec has a LET of 5 ms it produces the output values twice as fast as task inc Module M2 imports module M1 and thus has access to the output ports of M1 s tasks inc and dec Module M2 s task sum simply adds the outputs of M1 s inc and dec tasks The LET of task sum is 10 ms The Timing Definition Language TDL in a nut shell e 3 a mode f11 meane Mt Import Ine SS Module M2 K LET 10ms E Dec LET 10ms Sensor gt gt Mode Switch mode main Actuators Sum LET 10ms o Actuator mode f12 Inc LET 10ms Dec C i LET 5ms Bi ne E
41. de Switch mode1 gt mode2 File Edit Tools Help SA no i SampleTDLModule C Imports Source modet Target mode2 3 Constants gets 4 C Types 3 9 Sensors s1 Actuators al sample out 3 Tasks sample fi samplelmpl in 9 Modes M modet E mode12mode2Guard Property Switch Frequency Switch The port assignment is defined by connecting the particular ports In the example above this does not make sense as the target mode has no ports yet For further details we refer to the EBNF definition of this TDL construct Migration of existing Matlab Simulink subsystems to TDL modules If you have already Matlab Simulink models of your controllers the TDL VisualCreator supports an automated transfer of these models so that they become TDL modules Let us consider a simple example We assume that your controller model is represented in a subsystem called ExistingSubsystem 102 e TDL VisualCreator Modeling with TDL Modeling with TDL migrationSample File Edit View Simulation Format Took Help a pazi 110 0 Normal Ini Outi p Existing Subsystem To transform the ExistingSubsystem so that it becomes a TDL module that executes this functionality as its only task we copy a TDL module from the Simulink library browser migrationSample File Edt View Simulation Format Tools Help amp GS Olea cs p gt m 10 0 Norma
42. e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL f Module M1 Mode Transitions Imports 9 Constants ig ci c3 C Types 4 Sensors s 9 Actuators al a 4 Tasks E inc dec 4 Modes E i f1 inc dec g al jet az a f1 gt f2 E f1 Guard gs a M fi2 inc dec fet al fet az alue Frequency 4 The mode switch is checked in mode f12 thus it is listed in the tree as an item labeled f12 gt fl11 in the mode folder f72 which is another subfolder of the Modes folder This item is selected in the tree in the above screen shot The Frequency property is set to 1 which means that the mode switch is checked every 10 ms mode period of mode f 2 1 10 ms We now define that a mode switch from f 2 to f11 should occur if the sensor s reads a value smaller than 1 Right click on the mode switch item labeled f12 gt f11 in the tree and select the New Guard menu item in the pop up menu The window will look like the following screen shot showing the Port Assignment editor in the right window pane for the explanation of the purpose of that editor and how to use it see below Guided Tour of the TDL VisualCreator tool e 43 f Module M1 Mode Switch f12 gt 11 File Edit Tools Help E M1 Imports Constants Source Target f11 ig ct idl c2 Ci Types amp 4 Sensors Qs a 4 Actuators al a2 a Tasks T inc T dec E 9 Modes 5 m fi1 inc
43. e Unit Next we add mode f 2 by choosing the File gt New gt Mode menu item or by right clicking on the Modes folder in the tree pane and choosing the New Mode item from the pop up menu Rename the new mode to f 2 as described above Set the Period property to 10 and leave the Time Unit property as milliseconds ms 24 e Guided Tour of the TDL VisualCreator tool Modeling with TDL 2 Module M1 Mode 12 File Edit Tools Help rE am ke P i Mi Imports Constants ig ci H c2 C Types 9 Sensors s Actuators al a2 4 Tasks 1 inc dec 4 Modes imi f11 m fied Property ifi eriod ime Unit Select the Modes folder in the tree so that the Mode Transitions editor is activated in the right window pane Note that the arrow from the black bullet hole to the box representing mode f marks mode fl 1 as start mode Modeling with TDL Guided Tour of the TDL VisualCreator tool e 25 f2 Module M1 Mode Transitions Seles File Edit Tools Help iE am BR E iM Imports Constants Hci ig c C Types 9 Sensors s 4 Actuators al a2 4 Tasks E inc T dec Task invocations and actuator updates To assign tasks to modes we activate the Mode editor by selecting the particular mode Let us start with fl 1 26 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL f Module M1 Mode f11 File Edit View Tools Simulation Help i mire A
44. e invocation of the task As an example we apply this technique to Module M2 In order to group the invocation of task sum and the actuator update to one sequence select both the task sum and the actuator a in the Mode editor Module M2 File Edit Tools Help naj o M2 M Mode main A Imports E Ci Constants _ Types C Sensors H Actuators Oa 9 Tasks 9 Modes Then right click within the Mode editor and choose the Group to sequence item in the pop up menu The Mode editor now groups the task sum and the actuator a in one unit and indicates the grouping with a gray bounding box Module M2 File Edit Tools Help awl M2 M Mode main A Imports Constants C Types Sensors A Actuators Qa A Tasks S Modes M main a O When simulating the Simulink model again the Scope shows the corresponding different timing behavior with an update of the actuator in module M2 that takes place 10ms earlier than in the original version 72 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Scope a my es e e ey e e es 7 The following screen shots illustrate the difference in detail 0 3 O4 0 5 0 6 0 3 0 4 0 5 0 6 Structured Data Types In the previous example we only used a basic type namely integer int However in practice we often have to deal with more complex data structures TDL supports also array
45. e listed in the navigator amp Module SampleTDLModule File Edit Tools Help am S i SampleTDLModule H Mode Transitions Imports C Constants C Types Sensors Actuators Tasks C Modes Property Identifier Release function Task ports input output or state ports are added by right clicking on the task in the tree f Module SampleTDLModule Sele Fie Edit Tools Help Ron A 5 SampleTDLModule Mode Transitions Ej Imports T Constants G Types C Sensors 2 F model B Cj Actuators 9 Tasks Ti a G New input port New output port New state port a E Mode Rename Strg R L Delete Entf Synchronize Task Declaration aJil Property Identifier The properties of a port Identifier and Type for input ports Identifier Type Initial Value and nitializer for output and state ports are shown in the navigator when a port is selected Modeling with TDL Modeling with TDL Module SampleTDLModule File Edit Tools Help an 8 SampleTOLModule C Imports C Constants Cy Types C Sensors CJ Actuators 4 Tasks a mt H tilmpl in E Mode Transitions Nodes Property Value Identifier Type nitial Value ars Err Fort To remove a port select the task port in the tree right click for the pop up menu and select the Delete menu item In case of using the TDL VisualCreator within Simulink the task function ca
46. ecSample File Edit View Simulation Format Tools Help co HS RS gt FixedStepDiscrete Remove sensor As module M2 only uses the outputs of M s tasks we do not need a sensor Double click on the M2 module block to open the TDL VisualCreator tool and click on the symbol left to the Sensors folder in the tree f Module M2 Mode Transitions SEE File Edit Tools Help is am a Me Imports Constants i e 4 Sensors s1 C Actuators C Tasks Modes Guided Tour of the TDL VisualCreator tool e 53 Select the s item and choose the Edit gt Delete menu item to remove the sensor Alternatively you can right click on the s item and choose Delete from the pop up menu After that operation the Sensors folder is empty f Module M2 Mode Transitions Hle Edit Tools Help _ te an RP fe M2 Imports Constants Actuators faq Tasks Modes Import module M1 Choose the File gt Import menu item or right click on the Imports folder in the tree This opens the following dialog Importing a module Choose 4a module to be imported M1 Press the OK button to import M1 into M2 Click on the symbols left to the Imports folder and left to the items listed in this folder All public members of module M are listed 54 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Module M2 Mode Transitions File Edi
47. egrated the TDL VisualCreator with Matlab Simulink This offers the advantage that 1 the functionality of TDL components can be modeled with discrete blocks from the Simulink library and 2 the TDL components can be simulated If you have your functionality implemented in C or other programming languages the TDL VisualCreator can also be used as stand alone tool for visual interactive TDL modeling but without the simulation capability provided by Matlab Simulink The next chapter guides you through the case study described above with the TDL VisualCreator in Matlab Simulink 6 e The Timing Definition Language TDL in a nut shell Modeling with TDL This manual does not cover the specification of the execution platform and the mapping of TDL components to such a platform that is the platform deployment The socalled TDL VisualDistributor tool offers both features the platform modeling and platform deployment of TDL components For a description of the TDL VisualDistributor tool we refer to its user manual which is not part of this documentation and not part of the TDL demo package Modeling with TDL The Timing Definition Language TDL in a nut shell e 7 Guided Tour of the TDL VisualCreator tool The guided tour illustrates the visual and interactive editing of two TDL components by means of the TDL VisualCreator tool We assume that you use the TDL VisualCreator tool within the Matlab Simulink environment
48. erate platform specific code For details we refer to the documentation of the TDL VisualDistributor tool The TDL VisualCreator is a syntax driven tool for visually editing syntactically correct TDL programs One instance of the TDL VisualCreator allows you to model one TDL module The following figure shows the principal elements of the TDL VisualCreator tool window The tool bar is under the menu bar The window is split in three panes the tree pane and the navigator pane on the left side as well as the editor pane on the right side For short we call the tree pane just tree the navigator pane simply navigator and the editor pane the editor Modeling with TDL Modeling with TDL f Module SampleTDLModule Mode Transitions File Edit Tools Help menu bar tool bar SamplelTOLModule 5 Constants C Sensors O Actuators E Tasks _j Modes editor Value sampleTOLModule navigator Tree and navigator The tree left pane of the TDL VisualCreator window shows the module subtree with the module name as the root item and all possible TDL constructs as subnodes import declarations constants types sensors actuators tasks and modes If you add an instance of one of these constructs to the module the corresponding subnode lists that instance The properties of most TDL constructs are specified via the navigator Editor The editor right pane of the TDL VisualCreator tool window provides the edit
49. erty Value Identifier model 2mode2Guard GuardFunction e A double click on the guard item in the tree opens a Simulink editor that allows you to specify the condition when a mode switch occurs If you need a sensor value or a task output port for that condition specification simply drag the particular sensor from the Sensors folder in the tree or the task output port from the particular task folder in the tree to the guard function The following screen shot exemplifies this for a sensor 2 Module SampleTDLModule Mode Switch mode1 gt mode2 SampleTDLModule C Imports Source mode Target mode C Constants E i get 4H Types 9 Sensors Og Actuafias Tasks drag amp drop 9 Modes Mi M model 2 Q amp model gt modes model2zmode2Guard iM mode Property Value Identifier model2 mode2Gua GuardF unction e You define the mode period by selecting a mode in the Modes folder in the tree and setting the Period property in the navigator The following example shows that the mode period of mode is set to 10 96 e TDL VisualCreator Modeling with TDL f Module SampleTDLModule Mode mode1 MaE File Edit Tools Help ie mom it amp SampleTOLModule Imports Constants C Types E 9 Sensors s1 Actuators j Tasks E 9 Modes tie E model gt mode model 2mode2 Guard M mode Property ime Unit e You activa
50. es M1 and M2 is then generated for the particular platform if the platform offers sufficient communication and computing resources If this is the case the TDL tools guarantee that the observable behavior of the TDL components on the particular platform is identical to the behavior in the Guided Tour of the TDL VisualCreator tool e 77 simulation If a platform offers not sufficient communication and computing resources for the specified timing behavior no code is generated 78 e Guided Tour of the TDL VisualCreator tool Modeling with TDL TDL VisualCreator This part of the documentation presents the features of the TDL VisualCreator a syntax driven visual and interactive editor for TDL programs If you went through the guided tour you already know most of it The TDL VisualCreator tool is an alternative to entering TDL programs as text It can be used as stand alone tool instead of a text editor Once you have modeled your TDL program you can generate the TDL source text You can also view the textual version of a TDL program at any time The TDL VisualCreator tool can also be used within the Simulink environment In this case you can model the functionality in particular the TDL task function implementations and guard functions with standard Simulink blocks and you can simulate the overall system No matter whether you use the TDL VisualCreator as stand alone tool or integrated into Simulink the user interface is the same as s
51. es in a distributed system without changing the observable behavior of the TDL modules and especially without considering the distribution of the modules in the TDL modeling phase We assume that we want to distribute the TDL modules M1 and M2 on a FlexRay cluster with two nodes nodel and node2 The TDL VisualDistributor allows 1 the definition of the bus topology 2 the mapping of TDL modules to the particular nodes that are connected via the bus and 3 the platform specific code generation For a detailed documentation of how to Guided Tour of the TDL VisualCreator tool e 75 use the TDL VisualDistributor we refer to its description which comes with the TDL VisualDistributor For each Simulink model that contains one or more TDL modules any number of platform mappings can be defined For defining a platform mapping drag the Distribution block from the Simulink library browser to the model 7 Simulink Library Browser File Edit View Help ee 0s Distibution Mapping TOL modules to a specific distributed platform i E Simulink Parameter Estimatio a Stateflow i Ii System Identification Toolbo oo TOL Library eal il s iil a Distribution Module C IncDecS mple gt fox File Edit Simulation Format Toob Help DiE HE Bee oe Normal i E Step Dat Type Congersion Pa tod Ma Distribution
52. es the input from function 1 receives a different input depending when function 1 finishes This means that the behavior of the embedded system is not deterministic If a faster processor is used the behavior of the overall system might be different from the behavior produced by a slower processor In other words the embedded software depends on the platform Each change might trigger unforseeable effects that might even cause catastrophic system behavior 112 e Appendix The Timing Definition Language TDL Modeling with TDL Modeling with TDL The LET abstraction is the basis for overcoming the mentioned problem The following figure illustrates the LET abstraction in action no matter how long the computation actually takes the results are only delivered exactly after the LET of a function in the example set exactly at the deadline Because LET 1 of Task 1 s invocation finishes after the corresponding LET2 time period the results are always available as input of the next invocation of Task 2 Task 1 LETI Task 2 LET has established a new programming paradigm for embedded software This is comparable to the invention of the abstractions in higher programming languages such as Algol Pascal C and later on C C Java and C LET was invented in the realm of the Giotto project Thus Giotto has paved the way for higher level programming languages for embedded software It focuses on the timing behavior The implications and its be
53. hat mode is marked as start mode by means of a bullet hole with an arrow pointing to the start mode The empty window pane on the lower left side of the TDL VisualCreator window is the property inspector view 10 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL It shows the properties of items selected in the tree see below We call it inspector for short For example select click on the module name M1 This displays its properties in the inspector in the window pane on the lower left side of the TDL VisualDistributor tool The only property of the module is the identifier property whose value corresponds to its name f Module M1 Mode Transitions File Edit Tools Help i Imports Constants Ly Types Sensors amp J Actuators Tasks 9 Modes inspector Add constants c7 and c2 To add the constant c choose the File gt New gt Constant menu item that is the menu item Constant in the New submenu of the File menu or right click on the Constants folder in the tree and select New Constant from the pop up menu We stick to the suggested default name c Click on the constant c As we have seen above with the module M1 selecting an item in the tree displays its properties in the inspector that is in the window pane below the tree f Module M1 Mode Transitions File Edit Tools Help SAian B iB Mi C Imports E Sy Constants ail rose Ci
54. he mouse pointer is a hand Furthermore arrows between modes show which mode switches are possible For each such selected mode switch arrow the navigator shows the name and you can edit the Frequency property with which 94 e TDL VisualCreator Modeling with TDL the condition is checked in the source mode 2 Module SampleTDLModule Mode Transitions File Edit Tools Help te am ke E 8 SampleTOLModule CI Imports C Constants Ci Types C Sensors C Actuators Ci Tasks 4 Modes E M mode gM ere DHRRe model gt mode Switch e You edit the condition by right clicking on the mode transition item in the tree labeled model gt mode2 in the example and selecting the menu item New Guard in the pop up menu Module SampleTDLModule Mode Switch mode1 gt mode2 Seles File Edit Tools Help ct aon R amp SampleTDLModule C Imports Source mode Ci Constants l C Types C Sensors Actuators Gi Tasks S Modes m model model gt mo Hee ow H mode Modeling with TDL TDL VisualCreator e 95 This adds a guard function to the mode transition amp Module SampleTDLModule Mode Switch mode1 gt mode2 File Edit Tools Help B om 8 SampleTDLModule C Imports Source modet Target mode2 C Constants get C Types Sensors C Actuators a Tasks Modes M modet model gt mode2 model2mode2Guard M mode2 Be amp amp Prop
55. hen software is ported from one platform to another timing changes significantly often leading to significantly different computations and sometimes to malfunctioning systems Whereas with TDL 1 the functional and temporal behavior of a system is the same no matter where a TDL component is executed and 2 the developer does not have to care about the differences of local versus distributed execution of a TDL component We guarantee that the software is free of deadlocks race conditions and timing behavior that does not exactly correspond to the behavior specified in TDL We refer to 1 and 2 as transparent distribution The TDL products have been built on the basis of cutting edge research results in the realm of the Giotto project http www cad eecs berkeley edu research giotto at the University of California Berkeley TDL delivers deterministic portable software components Modeling with TDL From a technical perspective the concept of Logical Execution Time LET is a key element in TDL It allows us to deliver essential software properties that are necessary in order to efficiently produce ultra reliable embedded software determinism portability and composability In other words these software properties imply significant development test and maintenance cost savings while improving the quality of the embedded software So TDL is a truly disruptive technology You get correct software at a fraction of the costs you would
56. hown in the following screen shot after starting the TDL VisualCreator tool gt Module SampleTDLModule Mode Transitions MoE File Edit Tools Help E Ej E Fe ER Imports Constants Sensors Actuators We will first explain how you set up the tool as stand alone tool or as an add on to Simulink Then we present the preliminaries to understand the overall editor concept and continue to present how each TDL construct is specified with the TDL VisualCreator tool Differences between the demonstration and product versions Modeling with TDL The demonstration version of the TDL VisualCreator tool has no restrictions regarding editing and saving of your models though the demonstration version might not support all the features of the current product version However the demonstration version canot be combined with the TDL VisualDistributor tool so that you cannot generate executables for specific platforms What you can do is TDL VisualCreator e 79 simulate the behavior in Matlab Simulink This should be sufficient for experimenting with TDL as we guarantee that the behavior in the simulation is equivalent with the behavior on supported execution platforms provided that the platform offers sufficient computing and communication resources for the timing behavior specified in the TDL modules Technically the main difference between the demonstration version of the TDL VisualCreator and its product version is
57. ing capabilities for certain aspects of TDL modes the TDL developer models socalled mode transitions task invocations actuator updates and port assignments in the editor We explain the editing of TDL modes in a separate section below Adding a TDL construct No matter which TDL construct you want to add to a TDL module you can accomplish that in one of the following alternative ways e Choose the File gt New gt 7DL_construct menu item where TDL_construct is a place holder for any TDL construct import declaration constant declaration type declaration sensor declaration actuator declaration task declaration mode declaration Mew Import Close Constant Save Model Type Save Model As Sensor Import TOL Code Actuator Export TOL Code Task Export XML Mode Export Functionality Code View TDL Code TDL VisualCreator e 83 e Right click on the folder corresponding to the TDL construct you want to add This opens a pop up menu with the menu item New TDL_construct Choose the menu item f Module SampleTDLModule Mode Transitions File Edit Tools Help oeh B SampleTDLModule Imports Constants m TT amp Sensors Actuators Tasks Modes After that the newly added TDL construct is selected and its properties are shown in the navigator in which you can edit them For example the following screen shot illustrates the properties of a newly added TDL constant declaration f Mod
58. l ExistingSubsystem Module Double click on the Module block to open the corresponding TDL VisualCreator tool and choose Translate Subsystem from the Tools menu P Start Simulation Rebuild Model Import Task Translate Subsystem Show Import Relations Then select the subsystem you want to translate in the dialog box and press the OK button Translate Subsystem Choose a top level subsystem migrationSample ExistingSubsystem vi Abbrechen The result is that the selected subsystem becomes a task in the new module with the following translations the input ports of the subsystem become the sensors of the module the output ports of the subsystem become the actuators of the module A TDL VisualCreator e 103 104 e TDL VisualCreator task is created that has the same name as the original subsystem and that uses that subsystem as task function implementation The corresponding input and output ports of the task are created automatically The task is invoked within a mode main where the sensors and actuators are automatically connected to the task ports Module Module File Edit Tools Help ana 8 Module M Mode main Imports Constants Types Int ExistingSubsystem Out Sensors Actuators S Tasks ExistingSubsystem ExistingSubsystemlmpl Int Out1 A Modes M main gO ExistingSubsystem gp Out On the top level of the model
59. n a utente ot iat tee een tote ote saat 55 FE CIE WAS IG SUT aaa a E E OAN 57 EdUMOdE Mees a E OAA 65 TBC SOUICE code OF module M2 sroine e e E ERE 69 Tost moddle M amai ina a E a mean 69 Synchronous actuator updates and advance calculation cccccccccssssssssseeseseececeeeeeeeeeenaas 71 Smc wel Data Type Sasna a E E E 73 Generating platform independent code for TDL modules c cece eeeesseseeeeeeeeeeeeeeeeeaeaeeeeeees 75 Transparent distribution of TDL modules oerni ag E a EEA 75 TDL VisualCreator 79 Differences between the demonstration and product versions ssseesssssssssssssetereerssssssss 79 Set Up aS Stand alOne tool on N n N a a 80 Setu upasadd onto SIMU K Oi saig n a E a i A 80 Preliminar EE eeteadsies hacen 82 Adding a WD LCOS UC nera E a E au asenawlonne 83 Baiting a DLC Ons WC lias as oan ss scenic tana actus alaiauenc a chacele wanes aumadnsaoanavenanlas 84 Deleune a ED a CONSUL Genera E i eceaeasdesbensn ec E 86 TOEP OS IM CRU E a a seanavansnencaasaannn eanomsyiaeneenea aaglanad ne assmeasentan 87 PEED TE COTS UNC ES oa td scaeahe a A tegen daetasan ss oceanic 87 TDL Import declaration eaa E ta seeuenneeudes 87 TDL Constant declaration aa ci salecsshaveeceaseeoe ce a O A E 88 TODE Ty pe decliratiON senan a E E 88 Modeling with TDL Contents e iii iv e Contents TDL Sensor declaration 0esesesesesesesesesesesesessssesesosesesesesesesesessesesosesososessorosseseeses 90 TD
60. n be modeled with Simulink blocks by double clicking on the lt task gt Impl item in the Tasks folder of the tree where lt task gt is a place holder for the task name The following screen shot shows a task sample with the sampleImpl item TDL VisualCreator e 93 2 Module SampleTDLModule Mode Transitions SE File Edit Tools Help eli on amp FP E 8 SampleTOLModule C Imports Constants H CI Types Oy ret Sensors j Actuators a y Tasks T sample in out s Modes Value samplelmpl simulinkTaskF unction For further details we refer to the EBNF definition of this TDL construct TDL Mode declaration The editing of TDL modes requires up to three steps The TDL VisualCreator provides a different editor for each step in the editor e The Mode Transition editor is the default editor It shows which mode is the start mode indicated by the black bullet hole and the arrow from that bullet hole to the start mode You can let the arrow point to any mode to define that the particular mode is the start mode In order to accomplish that you draw a new arrow from the bullet hole to a mode represented by a box To be able to draw a connecting arrow the mouse pointer has to be a hand when you are over the bullet hole or a mode box If the mouse cursor is a cross you can move a box or the bullet hole The mouse pointer is a cross if you are in the center area of a box or the bullet hole Otherwise t
61. nal TDL task declaration with the input and output ports corresponding to the existing subsystem Note that in this case no extra sensors and actuators are created The developer also has to specify in which mode the task should be invoked Modeling with TDL TDL VisualCreator e 105 f Module Module File Edit Tools Help mul Sr 8 Module H Mode Transitions Imports Constants C Types Sensors Actuators E 4 Tasks T ExistingSubsystem anotherExistingSubsystem E anotherExistingSubsystemlimpl In Ina Outi Out Outs E 9 Modes E iM main ExistingSubsystem fet Cut Property Value anotherExistingsubsyst alse elease function Copying models into TDL task functions Another way of using existing subsystems as tasks is to copy the subsystem content into an already defined TDL task function For that purpose we create a new TDL task in the TDL VisualCreator tool and open its task function implementation by double clicking on the function icon in the tree pane We can now drag blocks from any open Simulink model and drop them in our task function subsystem T migrationSample laskF unctions t1impl Selle File Edit View Simulation Format Tools Help Oe HS SEQ pr hoo Nomi N Ready 100 odess Subsequently we synchronize the TDL task declaration with our new task function by right clicking on the task function icon and choosing Synchronize Task Declaration from the pop
62. nefits are manifold d LET2 The LET abstraction allows the automatic software generation from a specification of the timing behavior supposed that the particular platform is powerful enough to provide the required computing and communication resources A platform change simply means a fully automated re generation of the software For several reasons such as fault tolerance and scalability safety critical embedded systems are based on distributed computing platforms The LET abstraction greatly simplifies the development of distributed software the TDL tools automatically generate efficient distributed software from the LET based timing behavior specification The developer only has to map TDL modules with a simple drag amp drop operation to the nodes of a distributed system FlexRay is a sample target platform for which the code generators have already been implemented and used The other aspects in particular the implementation of the functions can be accomplished in any programming language or with any tool such as MathWorks tool suite Appendix The Timing Definition Language TDL e 113 Note that the TDL tools form a natural synergy with existing embedded software development tools that focus on functionality in particular with MathWorks tool suite Thus the TDL tools do not replace them but complement them 114 e Appendix The Timing Definition Language TDL Modeling with TDL Modeling with TDL Appendix The Timi
63. ng Definition Language TDL e 115
64. ng the two boxes that represent the modes f and f 2 Once you have started connecting the f7 with f72 make sure that before releasing the left mouse button you do that about in the center of the f72 box If you want to move the boxes left click inside the box at its center Then the mouse cursor becomes a cross and you can move the particular mode represented by a box The mouse pointer is a cross if you are in the center area of a box Otherwise the mouse pointer is a hand for connecting modes After connecting the box f with f72 the Mode Transitions editor should look like this Guided Tour of the TDL VisualCreator tool e 35 f Module M1 Mode Transitions File Edit Tools Help i ow RF E g Mli Imports E 4 Constants ig ci ig c2 C Types 4 Sensors s E Sq Actuators al a2 a 4 Tasks T ince dec 4 Modes fe m4 f11 E m fl2 The arrow line that connects the boxes f11 and f12 represents a mode switch Select the arrow line to see its properties in the inspector 36 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL f Module M1 Mode Transitions File Edit Tools Help tt mow E Mi Imports 4 Constants cl c2 C Types 4 Sensors s 4 Actuators al a a 4 Tasks T ince dec S49 Modes im fi 1 inc dec fo al fe a2 ie iMifl2 alue Switch Bak The mode switch is checked in mode f11 thus it is listed in
65. ode12mode2Guard si Ful sample M mode kt Et 1 Property Value Task ample Frequency Task Invocation You change the task invocation Frequency in the inspector The LET of the task for this invocation can be specified explicitly by 98 e TDL VisualCreator Modeling with TDL changing the Slots property not shown in the screenshots The default value 1 executes the task with the specified frequency and with LET mode period frequency For more information about slot selection we refer to the TDL Report in the meanwhile Actuator updates In an analogous way as tasks you drag and drop actuators into the Mode editor and set the actuator update frequency The following screen shot shows the Mode editor after dropping an actuator and setting the update frequency to 2 f Module SampleTDLModule Mode mode1 File Edit Tools Help SH E 8 SampleTOLModule CI Imports Constants CI Types a 4 Sensors si 9 Actuators al 4 Tasks T sample D samplelmpl T H y l In out 9 Modes sample M model E model gt mode E model2modezGuard Actuator Frequency Actuator Update As sources for task input parameters you can use sensors drag and drop them as described for tasks and actuators or output ports of other tasks of the particular mode Furthermore the public sensor actuator and task output ports of all imported modules a
66. odeling with TDL Guided Tour of the TDL VisualCreator tool e 47 Module M1 Mode Switch f11 gt 12 Fie Edit Tools Help ie n rn A Ti E M1 Imports Constants SPUEREN Target f1 E ci E co a Types E 4 Sensors s 4 Actuators al a2 E S Tasks E inc dec 64 Modes E m f11 inc dec fe al i a2 a amp f1 gt f12 f 12f12Guard s E M fl2 inc dec g al fe a2 a amp f12 gt fil E f122f11 Guard s This corresponds to the statement inc o inc o dec o dec o after the mode switch condition in the textual version of the TDL program For the sake of clarity this was not shown in the textual version of the modules in the previous chapter In an analogous way we define how output ports of the tasks of mode f 2 are initialized after a mode switch from fl 1 48 e Guided Tour of the TDL VisualCreator tool Modeling with TDL amp Module M1 Mode Switch f12 gt f11 Eile i Edit Tools Help a E Mi Imports 29 Constants source t12 Target f11 if ci E c2 CI Types 9 Sensors s E 9 Actuators al a2 E E4 Tasks inc E dec E 9 Modes E mM fiT inc dec oe al ee az a f1 gt fl El 121 2Guard s E m fi2 inc Frequency N Switch Test module M1 In the top level subsystem add a Step block together with a Data Type Conversion block as sensor input of M and a Scope block with three input ports to watch the output behavior of
67. onstants C Types Sensors E 4 Actuators Qa H Tasks E sum sumlmpl il Q i2 of hodes Property Identifier YHE nitial value Output Port H Mode Transitions The task function can be modeled in Simulink by simply double clicking on the sumImpl item in the tree This opens a Simulink editor window Guided Tour of the TDL VisualCreator tool e 63 1 IncDecSample TaskFunctions sumImpl Sele File Edit View Simulation Format Tool Help p 1 0 Normal g i The outport o corresponds to the output port of the task The inport o provides the value of o as calculated in the previous task invocation As we do not need this value in this case we connect it to a terminator block IncDecSample TaskFunctions sumImpl SEE File Edit View Simulation Format Tools Help gt mho Noma Bi Teminator o0 bods o g We model the straight forward functionality of task sum that is calculating the sum of its input ports i and i2 by means of the standard Simulink block Sum 64 e Guided Tour of the TDL VisualCreator tool Modeling with TDL IncDecSample TaskFunctions sumlmpl SEE File Edit View Simulation Format Tools Help C Es c p gt jo Noma R i Temminatar Edit mode main Each new module has already one mode called mode Rename this mode to main and set the mode period of mode main to 10 ms in the inspector Modeling with TDL Guided Tour of the T
68. p Modes Property alue Identifier Task Function Right click on the dec task not the decImp function in the Tasks folder and choose the New ouput port menu from the pop up menu This adds an output port labeled port to the task declaration of task dec 20 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL f Module M1 File Edit Tools Help om i Mi H Mode Transitions Imports Constants ia cl ial c C Types 5 Sensors s 4 Actuators al a2 E Tasks T inc E dec E decimpl Q Wlodes Property falue Identifier ype nitial Value Output Port Rename the output port to o and change its type to integer int with the Initial Value of c2 select the constant from the pop up menu f Module M1 File Edit Tools Help anj E g tli H Mode Transitions Imports H Constants H ci i c2 p L Types roae E 4 Sensors s 4 Actuators al a2 E 2 Tasks O inc El dec decimpl Modes Property Identifier YHE nitial Value Output Fort We model the task function again in Simulink by simply double clicking on the decImpl item The decImpl decrements its output value by 10 starting with the initial value 200 down to the lower limit 50 Guided Tour of the TDL VisualCreator tool e 21 A IncDecSample TaskFunctions decImpl Seles File Edit View Simulation Format Tools Help ce ed bh ES
69. periment with the tool yourself For example you could extend the original inc dec case study and replace the basic int type by an array as sketched above and comapre your solution to the one provided by us as IncDecSample2 mdl Of course we encourage you also to transform existing models to TDL A case study called Active Rear Steering was modeled based on existing controller functionality Generating platform independent code for TDL modules Once a module provides the required behavior the TDL VisualCreator supports the export of the TDL source code and the generation of C code for each task function of a TDL module currently with MathWorks Real Time Workshop Embedded Coder tool In order to export the TDL source code select the File gt Export TDL Code menu item and specify the directory in which the TDL source code file named according to the module name should be written In order to export the C code for each task function of a TDL module select the File gt Export Functionality Code menu item and specify the directory in which the C source code files named according to the tasks should be written Platform specific code is generated with the TDL VisualDistributor tool For the detailed description how to work with the TDL VisualDistributor we refer to its documentation Transparent distribution of TDL modules Modeling with TDL Remember that TDL modules can be executed on a single node or can be distributed to several nod
70. perty Modeling with TDL TDL VisualCreator e 89 2 Module SampleTDLModule Seles File Edit Help i mr S SampleTDLModule C Imports Constants aay Om El F Rename a E Delete Cc g Add struct member m5 TT mE mi i Sensors Actuators Tasks i Modes In case of using the TDL VisualCreator within Simulink a signal connected to an array typed port is expected to be multiplexed combined signals of the same type A struct typed port expects a Simulink bus as in output TDL provides a set of basic types which matches those found in the programming language Java For details check the description in the language report TDL Sensor declaration A sensor declaration requires the definition of the following properties Identifier name Public enable or disable access from other modules Type choose one of the supported types from a pop up menu in the Value column Getter name of an external getter function If you do not specify a getter function the default name getSensorName is used where SensorName is the Identifier starting with a capital letter In the following example this would be getS1 as the Identifier has the value s1 The properties are listed in the navigator 90 e TDL VisualCreator Modeling with TDL Modeling with TDL f Module SampleTDLModule Mode Transitions File Edit Tools Help i no et SampleTOLModule Imports E Constants _ Types E 4 Sensors gl
71. pose A read only editor view displays the TDL program text The TDL VisualCreator tool also supports the importing of a TDL program text File gt Import TDL Code and the exporting of a TDL program text File gt Export TDL Code The following sections explain the properties of the TDL constructs import declaration constant declaration type declaration sensor declaration actuator declaration and task declaration Further sections explain how to model tasks and modes TDL Import declaration In case of using the TDL VisualCreator as stand alone tool another module can only be imported if it was saved with the TDL VisualCreator in the TDL VisualCreator format A file dialog allows the selection of the particular module In case of using the TDL VisualCreator tool within Simulink the TDL modules that are available for an import need to be placed in the same Simulink model as the module that wants to import them The following dialog box exemplifies how an import declaration is specified if the TDL VisualCreator tool is used within Simulink Importing a module Choose a module to be imported TOLModule abbrechen TDL VisualCreator e 87 88 e TDL VisualCreator In order to visualize existing import relations between TDL modules within a Simulink model choose the Tools gt Show Import Relations menu item Start Simulation Rebuild Model Import Task Show Import Relations For further details
72. re available Actuator updates without LET delay Digital controllers might require an actuator update as soon as possible not after a task s LET period To define that an actuator update should be accomplished synchronously in locigal zero time after a task invocation you select both the task declaration and the actuator in the Mode editor Modeling with TDL TDL VisualCreator e 99 Module SampleTDLModule File Edit Tools Help om ke P 8 SampleTOLModule M Mode mode Imports Constants C Types 4 Sensors si 4 Actuators Gal E 24 Tasks T sample E samplelmpl in out sample out amp s E 9 Modes iM model M mode Then you right click the mouse and choose Group to sequence from the pop up menu The grouped task and actuator appear in a bounded gray box gt Module SampleTDLModule File Edit Tools Help am B SampleTOLModule M Mode modet Imports Constants C Types E 4 Sensors si 4 Actuators al E A Tasks E T sample samplelmpl in out s E 9 Modes M modet M mode sample Task Invocation 100 e TDL VisualCreator Modeling with TDL If you click then on the task in the tree the property Release function is set to true gt Module SampleTDLModule File Edit Tools Help am ke Pe 8 SampleTOLModule M Mode modet Imports Constants C Types E 9 Sensors si a 4 Actuators al E amplelmpl in
73. s ACU at Or declaration csser aer ae e EE E e EET 91 TBL TASK declara ON ei E A 92 TDC Modedecla ations a todos taawmaniasnded ent 94 Migration of existing Matlab Simulink subsystems to TDL modules eee 102 Functionality code generation 1n Simulink misse aroia aai 107 Simulink Buses and TDL Structure Types cccccccceeccceeeeeeececeaeseesseeeeeeeeeeees 108 Appendix The Timing Definition Language TDL 109 TDL delivers deterministic portable software components cccccececeeeeeeeaeeseeseeseeeeeeeess 109 PC Ce GaN SU a 65 eciea doce secs Monee uacstentovecnnto E EEE 109 FONADE suntesVecn ie nd ea etdan baad anata d cit aon asundateds Wak cnentdede oat nause 110 COMPOSI V Sach see tices Foncca argu ceacser vate a E daronkaneutdeae Seavuane 110 A TOT COMCE US wastes snaiccus situates dactvicna nts wvaamnas on tateadesnbuel asta dcue funk E E die reondentabeeeesonseiaes 110 TDC COMpPOnent Modelyer esenesca aed at war douatcanehas neta angus acaveal aserecede Caboanes 111 Comparison witi the State Of the ai sena n E E E 112 Modeling with TDL The Timing Definition Language TDL in a nut shell Modeling with TDL The Timing Definition Language TDL is the first technology that allows you to develop an embedded real time software component once and deploy it on any potentially distributed platform that offers sufficient computing and communication resources The following figure illustrates this port
74. s and structures For the sake of clarity we outline the usage of such data types in the context of a slightly modified variant of the example shown above The complete Simulink model stored in IncDecSample2 md1 is located in your installation directory Modeling with TDL Guided Tour of the TDL VisualCreator tool e 73 IncDecSample2 is based on the previous example but uses an array type instead of the basic integer type In this extended example both tasks of M1 namely inc and dec produce two values Therefore we define an array type Adding new types New TDL types are added by right clicking on the Types folder in the tree and selecting New Type from the pop up menu This creates a new type typel In the inspector we can choose the Category of our new type We can either define the type to be an alias for an already existing type an array or a struct For array types we have to specify the element s type of the array with the Designator property and its Length In our example we need an integer array with length 2 Struct types have no additional property but would require the specification of structure members To add a new member to a struct type right click on the type in the tree and select Add struct member from the pop up menu We use the integer array consisting of two integers for our actuators al a2 and for
75. s that its LET in mode f 2 is also 10 ms as in the other mode f 30 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL f Module M1 Mode 12 File Edit Tools Help oli on amp E Mi Imports H Constants ig ci A c2 C Types 9 Sensors s H Actuators al G a2 E 4 Tasks T inc derc 5 Modes im f11 E iM fi2 Property Falue Task Ine Task eee EEx Next drag the task dec from the Tasks folder in the tree and drop it on the Mode editor Set the Frequency property of task dec to 2 which means that its LET is 10 ms 2 5 ms Guided Tour of the TDL VisualCreator tool e 31 f2 Module M1 Mode f12 File Edit Tools Help ie mm g M1 Imports E Constants Hci H c2 C Types E 4 Sensors s E 4 Actuators al Gaz Fl Tasks T inc dec E 4 Modes im f11 El iM fl2 Gr inc Task Invocation Next we drag and drop the actuators a and a2 from the tree into the Mode editor We set the Frequency property of a2 to 2 and leave the Frequency property of a set to 1 32 e Guided Tour of the TDL VisualCreator tool Modeling with TDL 2 Module M1 Mode 12 Sel File Edit Tools Help i mom ke Mt Imports Constants H ci ig c2 Lj Types 49 Sensors s 9 Actuators al a2 4 Tasks T inc dec E 9 Modes m fi a M fiz inc dec J al ad Actuator Update Then we connect the output port of ta
76. seamlessly integrated in Mathworks Matlab Simulink so that the behavior of TDL components can easily be simulated For TDL Matlab Simulink is yet another platform So we also guarantee that the simulated behavior is identical with the behavior on any other platform for which code was generated What is a TDL component module TDL itself offers a textual notation for defining the timing behavior TDL offers a language construct the socalled module construct which allows the definition of a TDL component We use the terms module and component synonymously A TDL module forms a unit that consists of sensors actuators and modes A mode is a set of periodically executed activities The activities are task invocations actuator updates and mode switches All activities can have their own rate of execution and all activities can be executed conditionally The tasks represent the functionality particularly the control laws Any suitable language can be chosen to implement the functionality If MathWorks tools are used the functionality is modeled in Matlab Simulink Actuator updates sensor readings and mode switches are considered to be much faster than task invocations thus they are executed in logical zero time Whereas task invocations adhere to the so called Logical Execution Time LET semantics explained below 2 e The Timing Definition Language TDL in a nut shell Modeling with TDL Logical Execution Time LET LET
77. sk inc with actuator a This corresponds to the assignment al inc o in the textual version of a TDL program In an analogous way we connect the output port of task dec with actuator a2 Modeling with TDL Guided Tour of the TDL VisualCreator tool e 33 f Module M1 Mode f12 File Edit Tools Help i ow Siri BM Imports Constants ial ci ig c2 C Types E 9 Sensors s E 4 Actuators al az E Tasks T inc dec E 9 Modes mfi a im fi2 inc dec fe al ou a2 What is missing is the specification when a mode switch occurs For that purpose we switch to the Mode Transition editor by selecting the module name M or the Modes folder in the tree 34 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL f Module M1 Mode Transitions File Edit Tools Help i ana BR E g Mli Imports E 4 Constants cl c2 C Types 4 Sensors s 4 Actuators al a a 4 Tasks T inc dec a tM fi a m f2 inc dec fo al fo a2 Then we add a mode transition from mode f to mode f 2 by clicking in the f box and dragging the connecting line to f72 Note that the mouse cursor has to be a hand when you are inside the mode box f The mouse cursor becomes a hand if you click the left mouse button inside the box that represents a mode in this case mode fil but a bit off the center area of the box Only if the mouse cursor is a hand you can start connecti
78. sor s was added in the tree as input of the guard function 2 Module M1 Mode Switch f11 gt 12 File Edit Tools Help g Mi Imports 4 Constants SENERA Target f12 c H c2 C Types E y Sensors s a 4 Actuators al a2 E Tasks T inc T dec El 9 Modes fl mM fit inc dec g al de a2 o ti gt f12 E fli2tl2Guard eG E iM fl2 40 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL The guard function can now be modeled in Simulink by simply double clicking on the f7 2f12Guard item in the tree This opens a Simulink editor window Add a Data Type Conversion block and a Fen block from the Simulink library and set the condition to u gt 1 The Fen block returns 0 if the condition u input lt 1 is true and returns 1 if the condition u gt 1 is true The specification of the guard function should look like that IncDecSample GuardFunctions f112f12Guard Seles File Edit View Simulation Format Tools Help L aie amp lt 2 co gt i Normal E FixedStepDiscrete _ In an analogous way as the mode switch from f to f12 we define the mode switch from f 2 to f1 1 This mode switch should take place if the sensor s reads a value smaller than 1 s lt 1 For that purpose we switch to the Mode Transition editor by selecting the module name M1 or the Modes folder in the tree f Module M1 Mode Transitions File Edit Tools Help i nna D
79. stem add another input port to the Scope block to also be able to watch actuator a of M2 Guided Tour of the TDL VisualCreator tool e 69 t IncDecSample File Edit View Simulation Format Tools Help Clete keel 2c gt af MZ Hea 100 ixed5tepDiscrete In order to show the import relationship between these two modules choose the Tools gt Show Import Relations menu item in one of the TDL VisualCreator windows b Start Simulation Rebuild Model Import Task Show Import Relations This shows the import relationship between module M1 and M2 in the form of a Simulink bus IncDecSample File Edit View Simulation Format Tools Help Miz Ready 100 FixedStepDiscrete Simulation Start the simulation either by pressing the Start simulation icon in the tool bar of the Simulink editor or choose the Start menu item in the Tools menu of the Simulink editor Tools gt Start Simulation This causes the TDL VisualCreator tool to invoke the TDL Compiler and to generate internally used Simulink blocks that deliver the TDL semantics when the overall model is simulated After the simulation has finished the Scope block should show the following output 70 e Guided Tour of the TDL VisualCreator tool Modeling with TDL 6B SAS Ae Gar Actuator M1 a1 200 150 100 Ee a ee OO Actuator M1 a2 ppp Sensor M1 s Actuator M2 a
80. t problem and no code would be generated In other words if code is generated that generated code is always correct We can offer the formal proof of that Significant cost reductions The TDL benefits are significant No other product can offer these benefits today First the original development costs are reduced significantly at least by ca 30 in particular if the software should be distributed We have even measured development cost cuttings by a factor of 20 and more in the context of FlexRay based systems The reason for the significant cost savings is that developers do not deal with platform details when specifying the functionality and timing behavior As we guarantee that the behavior of the generated code is the same on any execution platform as specified in TDL testing is also more straight forward Another cost saving benefit is the greatly enhanced flexibility regarding the platform For example you could decide to move from a FlexRay based platform to a time triggered communication system based on Ethernet You only need to generate code for the new platform Even if you just change the topology of the platform by adding or removing a node Electronic Control Unit or ECU in the automotive jargon and thus the mapping of TDL components to nodes you will appreciate the automatic generation of the executable code Developers do not deal with the numerous platform details Simulation within Matlab Simulink TDL is also
81. t Tools Help a 4 Constants Oy reset oa cl H c2 CI Types Sensors E 9 Tasks z inc j El g dec j Constants C Types Sensors Actuators GJ Tasks Modes Edit actuator a Each new module has already one actuator In order to rename this actuator open the Actuators folder click on the symbol left to the Actuators folder in the tree pane Modeling with TDL Guided Tour of the TDL VisualCreator tool e 55 amp Module M2 File Edit Tools Help oaj a i M2 H Mode Transitions El 9 Imports E w y Constants W ci fa c2 C Types Sensors Tasks a ginc g El go dec g Constants Types Sensors 4 Actuators a J Tasks Actuator Either choose the Edit gt Rename menu item or right click on the listed a item and choose Rename from the pop up menu Rename the actuator from a to a As with the sensors and all other TDL constructs you can also click twice no double click speed on the a item in the tree to edit the name directly or you can change the Identifier in the inspector Also change the actuator Type property to integer int and the Initial Value property to M1 c2 56 e Guided Tour of the TDL VisualCreator tool Modeling with TDL f Module M2 File Edit Tools Help oem kk E Me E 4 Imports E 4 fyi 4 Constants W cl W c2 Types Sensors El Tasks amp rl inc g E g dec g iH Mode Transitions Constants Types Sensors E 4 Actuators
82. tants E cl ial c oie rose 4 Sensors Gs 5 Actuators C Tasks Modes Property ifi YHE nitial alue etter Actuator In an analogous way edit actuator a2 Choose the File gt New gt Actuator menu item or right click on the Actuators folder in the tree We stick to the suggested default name a2 Change the Type property to int and set the Initial Value to c2 by selecting that constant from the pop up menu 14 e Guided Tour of the TDL VisualCreator tool Modeling with TDL Modeling with TDL f Module M1 H Mode Transitions Imports 9 Constants ig ci c3 C Types E 4 Sensors s Actuators Gal B Tasks Modes Property Yalue Identifier int nitial Value c2 a Actuator The editor window which contains module M also shows that M has one inport s and two outports al and a2 ec IncDecSample i File Edit View Simulation Format Tools Help O ed S ES b gt m fio Noma Edit tasks inc and dec From the File gt New submenu choose Task or right click on the Tasks folder in the tree and choose the New Task item from the pop up menu Analogous to editing constant sensor and actuator names change the name to inc and make the access public set the Public property to true Ignore for now the Release function property which indicates whether the task is part of a task sequence or not The concept of task sequences
83. te the Mode Transition editor again either by selecting the Modes folder in the tree or by selecting the module name in the tree 2 Module SampleTDLModule Mode Transitions I File Edit Tools Help FELEL SampleTOLModule E4 Imports Constants Types Sensors Actuators Task DEAE ee co T Gi M mode model gt mode model mode2 Guard M mode e The Mode editor allows the specification of task invocations and actuator updates You activate the Mode editor by selecting a particular mode in the Modes folder When you start editing a mode the editor is empty such as in the following example Modeling with TDL TDL VisualCreator e 97 2 Module SampleTDLModule Mode mode File Edit Tools Help 8 SampleTOLModule Imports Constants OV Types a 2 Sensors s1 Actuators Tasks E S Modes EEO mode model gt mode E model mode Guard 5 modez Task invocations Select the task that should be invoked in the edited mode in the Tasks folder of the tree Then drag it into the Mode editor The Mode editor then displays the task as box with its name such as task sample with one input port in and one output port out Module SampleTDLModule Mode mode1 File Edit Tools Help ie owl 8 SampleTDLModule Imports Constants C Types 5 Sensors s1 Actuators S Tasks sample H samplelmpl in out s 9 Modes M modet model gt mode2 m
84. that allow the updating of actuators in logical zero time is explained in the section about synchronous actuator updates Guided Tour of the TDL VisualCreator tool e 15 f Module M1 File Edit Tools Help mow G i Mi H Mode Transitions Imports Constants i ci ial c oa Oy rn H Sensors s E 4 Actuators Gal G a2 E 4 Tasks a mi Modes Property falue Identifier Public Release function Open the inc folder in the tree click on the symbol left to the inc folder in the tree the inc folder is a subfolder of Tasks and rename the item labeled t Impl to incImpl The incImpl item refers to the task function implementation f Module M1 File Edit Tools Help om E M1 S Mode Transitions Imports 4 Constants if cl ial c _ Types roast 5 Sensors s Actuators al a Wlodes Property alue Identifier Task Function Right click on the inc task not the incImp function in the Tasks folder in the tree and choose the New ouput port menu from the pop up menu This adds an output port labeled port to the task declaration of task inc 16 e Guided Tour of the TDL VisualCreator tool Modeling with TDL f Module M1 File Edit Tools Help om g g Mi H Mode Transitions Imports Constants ig cl ig c2 C Types et 3 Sensors s 4 Actuators Gal a2 4 Tasks E Tine incimpl Modes Property Value
85. that the demonstration version stores the models in a specific format let us call it demo format Files in the demo format can be read by the product version of the TDL VisualCreator tool So you can easily migrate your models to the product version but you cannot transfer models from the product version back to the demo format For using the product version you need a hardware lock dongle The demonstration version executes without a hardware lock dongle Set up as stand alone tool Execute the TDLVisualCreatorSetup exe file The installation wizard will guide you through the installation F TDLVisualCreator Setup DABCTECY Welcome to the TDLVisualCreator Setup Wizard This wizard will guide you through the installation of TOLVisualCreator tis recommended that you close all other applications before starting Setup This will make it possible to update relevant system files without having to reboot your computer Click Next to continue i Cancel For starting the TDL VisualCreator tool connect the hardware lock dongle to a free USB port and select the TDLVisualCreator entry from your start menu The demonstration version does not require a hardware lock For working with the TDL VisualCreator product and demonstration versions you need the Java 2 Platform Standard Edition v 1 4 2 J2SE download it from http java sun com 2se 1 4 2 download html for executing the TDL VisualCreator tool Set up as add
86. the two actuators a and a2 of M and of the generated sensor input a IncDecSample File Edit View Simulation Format Tools Help Cle He tf BERS b mfi Normal E eae 100 FixedStepDiscrete Zz Modeling with TDL Guided Tour of the TDL VisualCreator tool 49 Set the simulation stop time to 1 0 that is 1 second as shown in the window above Define the Step block properties as shown in the following dialog Block Parameters Step Step Output a step Parameters Step time E Initial value Final value 1 Sample time 0 if Interpret vector parameters as 1 D lf Enable zero crossing detection The Step block generates an ouput value of O for the first 319 milliseconds Then it generates an output value Thus the module M is in mode f for the first 319 milliseconds and then in mode f 2 Simulation Start the simulation either by pressing the Start simulation icon in the tool bar of the Simulink editor or choose the Start menu item in the Tools menu of the Simulink editor Tools gt Start This causes the TDL VisualCreator tool to invoke the TDL Compiler and to generate internally used Simulink blocks that deliver the TDL semantics when the overall model is simulated After the simulation has finished the Scope block should show the following output 50 e Guided Tour of the TDL VisualCreator tool Modeling with TDL By eal 48 92 9 ABE eas
87. ty which is often violated in real time programs especially when the programs are hand optimized to meet timing constraints This programming discipline offers additional benefits in the verification optimization integration and reuse of embedded components All of these activities are easier to carry out independently for timing and functionality programs Similarly the separation of timing and functionality further facilitates code generation the TDL program can be compiled into executable timing code independent of the compilation of the functionality e g C programs into executable pieces of functionality code After linking the timing code supervises the execution of the functionality code TDL component model Can you imagine modern programming without classes modules or components We assume that we use Matlab Simulink as modeling tool for control applications Though Simulink is a great tool for modeling and simulating controller functionality it lacks the modeling constructs for building software components Simulink s structuring unit is called a subsystem which corresponds to functions and procedures in programming languages Modules or classes for defining components are missing This is what TDL adds a way to specify components and their interactions in particular their temporal behavior TDL components modules Simulink subsystems functions Simulink blocks Due to the clear separation of timing and f
88. ule SampleTDLModule Mode Transitions Ele Edit Tools Help iS mow Le o 8 SampleTOLModule Imports 4 Constants a C Types Sensors Actuators E Tasks Modes Property ifi ublic pression Constant Editing a TDL construct All instances of TDL constructs are listed by their name Identifier in the corresponding folders in the tree To edit the properties of a particular instance of a TDL construct open the corresponding folder by clicking on the symbol left to that folder or double click on the folder 84 e TDL VisualCreator Modeling with TDL Modeling with TDL Then select the particular item by single clicking on it in the tree to see its properties in the navigator Editing modes and editing tasks is more complex and explained in the particular sections below If you only want to change the name Identifier you can select the item with a left click and edit its name in the navigator The following sample screen shot illustrates this for constant cl f Module SampleTDLModule Mode Transitions File Edit Tools Help SAna E 8 SampleTOLModule Imports 2 Constants a Gl C Types Sensors C Actuators Tasks Modes Identifier Expression a Constant Alternatively you can right click on the item in the tree and choose the Rename pop up menu item The following sample screen shot illustrates this for constant c1 f Module SampleTDLModule Mode Transitions Mele File Edt
89. unctionality in TDL the functionality that is the control laws can be implemented in any language for example in C generated from your Simulink models In other words with TDL components we have added the missing link for structuring hard real time embedded software systems TDL modules serve multiple purposes In addition to structuring your software TDL modules are also the unit of distribution So you can map TDL modules to nodes on your distributed platform The code generators create the code that ensures that the modules behave exactly as specified in TDL This is another significant advantage compared to Simulink The code generated for Simulink subsystems cannot easily be mapped to computing nodes in a distributed system The following figure illustrates schematically a TDL component module a TDL module forms a unit that consists of sensors actuators and modes A mode is a set of periodically executed activities The activities are task invocations actuator updates and mode switches All activities can have their own rate of execution and all activities can be executed conditionally The tasks represent the functionality particularly the control laws As mentioned above any suitable language can be Appendix The Timing Definition Language TDL 111 chosen to implement the functionality If MathWorks tools are used the functionality is modeled in Simulink cann Init mode J
Download Pdf Manuals
Related Search
Related Contents
User Manual Tripp Lite FCC Radio/TV User's Manual Télécharger le rapport au format Acrobat Reader User's Manual - Van Mechelen 取扱い説明書 zbzweugv1 - Zipabox User manual v1.2 (English version User Manual Focal Easya Copyright © All rights reserved.
Failed to retrieve file