TaskScript TechnologyThe main technical components that embody the TaskScript development methodology are the TaskScript Studio IDE (Integrated Development Environment), a graphical environment that supports the whole development lifecycle and the TaskScript Kernel, a kind of lightweight Operating System residing onto the target microcontroller that helps the code generated out of the model to perform the intended behavior. Before covering the details of the above mentioned technical components, it is necessary to discuss the TaskScript Modeling Language, that is the foundation of the whole TaskScript design methodology. 1. The TaskScript Modeling LanguageWithin the TaskScript language a model is expressed by means of two "orthogonal" views: the higher level one is focused on the system behavior, while the lower level one is dedicated to model the data transformations that take place within the system under its various states. The two modeling views combine together in a synergic way into a single formalism; the consistency between the two views is enforced by the IDE:
The use of two modeling views, the former mostly dedicated to partition the system into smaller complexity Tasks and to express the control of each Task as possibly parallel sequences of Steps, and the latter mostly dedicated to express the transformation of system variables that take place within each Step, synergically integrated into one single formalism, gives the language a really high expressivity while keeping its use straightforward and efficient even for complex applications. The whole modelling language supports both the textual and the graphical form; actually the TaskScript Studio IDE lets designers operate at graphical level only, maintaining automatically the textual form without even expliciting it to the user. As it has been shown by the picture, the formalism chosen for the Data Flow view exploits the analogy with arithmetical and boolean operators. The analogy is complete: whichever (legal) network of devices is drawn, it will produce a Transfer Function in the synthesized software whose behavior is strictly adherent to the expected behavior of a (ideal) network made of the respective physical elements. The formalism used in the Control Flow was first proposed by the Grafcet group (in France) in the seventies (and later standardized as IEC 848); actually it can be seen both as an extension of the State Machines concept, to allow parallelism, and a simplification of the Petri Nets formalism, to keep it simpler; the resulting formalism is straightforward and easy to understand by the average designer. As a whole, the TaskScript Modeling Language can be compared with two of the five languages proposed in the IEC 61131-3 standard, although the standard refers exclusively to PLCs while TaskScript is oriented to the wider class of Reactive Systems: the Control Flow is similar to the language called Sequential Function Chart (SFC) in the norm (they both derive from Grafcet); the Data Flow is can is similar to the language called Function Block Diagram (FBD) in the norm. However, while inheriting a large part of the theoretical background from the IEC 61131-3 standard and its own ancectors, the TaskScript Modeling Language was deliberately designed to address the larger class of Reactive Systems, including the ones built with low performace (and low power) CPUs, at the sacrifice of not being strictly compliant with the norm. In the following, the main optimizations over the norm are listed:
2. The TaskScript Studio IDEThe TaskScript Studio IDE (Integrated Development Environment) is powerful graphical model based development environment that supports the whole product lifecycle of an Embedded application, and in particular:
As already pointed out, the whole design process takes place at the model level, without the need of "going below the model level", that is to tweak or even to look at the code that was generated out of the given model. In the following, a typical design path is considered, starting from model design all the way to the deployment of the model onto the physical system, at the purpose of illustrating in detail the strong support offered by TaskScript Studio to designers. The picture below shows a typical TaskScript Studio screen during the editing phase. Three graphic windows are shown in the picture, showing the 3 main editing modes of TaskScript Studio; from left to right there is: (1) the Context Diagram of the design (the model's top level view), where the Tasks are defined and global variables are declared and possibily allocated; (2) the Data Flow view for Step main.ST_38 and (3) the Control Flow view for the Task main, containing Step ST_38 and an start of Task TSK1 (named st_TSK1), among others. For each editing mode a different palette is available (see the rightmost part of the picture); the one shown is the Data Flow palette. Within all the views, all the basic editing options are available, such as cut, paste, copy, drag, multistep undo, alignment, zooming, etc; left clicking on any drawing element pops up a menu of properties specific to that kind of element(e.g. one of the specific properties of an ALU module is its operation: available choices are: Sum, Subtract, Multiply, Divide, Modulo, bitwise And, Or, Exor); right click to any drawing object pops up a general purpose menu of operations. Right clicking upon a port of an element will activate a rubber band wire, that can be terminated dropping it onto another port (connections rules must be satisfied, like port type and direction compatibility). Once drawn, the model can be simulated, in order to check its actual behavior and spot possible flaws in the design. Simulation is usually performed modeling the sensor periphery within TaskScript Studio and "connecting" the model of the Reactive System with the model of the sensor periphery. This is what is called Environmental Simulation; in other words, taking advantage of the easiness of use of the TaskScript Modeling Language, the sendor periphery is modeled as well (kept apart from the "real" Reactive System, placed in a different Task of type "Environment"; this task will be used for simulation purposes and then discarded when generating the code for the real Reactive System to be deployed onto the target board). Simulation is performed compiling the model and executing the generated (Virtual) Machine Language form on a special TaskScript Virtual Machine running on the TaskScript Studio PC; such a special virtual machine, instead of interacting with I/O signals, generates a simulation trace that can be loaded and traversed by the Studio. Two are the ways in which the trace can be visualized:
After the model has been verified an deemed correct, the generation of the actual executble code out of the TaskScript (Virtual) Machine form can take place; notice that the compilation phase (e.g. the generation of the TaskScript (Virtual) Machine form) is shared with the simulation; however, if the model contained Environment Tasks and other checking instrumentation, they are left out before this compilation. The TaskScript Virtual Machine form is then expanded as needed acording to the target processor/board; such an operation is actually a macro-assembly step, where each Primitive of the TaskScript Virtual Machine is replaced by the respective sequence of low level operations of the target microprocessor, with possible calls to helper functions residing in the TaskScript Kernel. The expanded code is then assembled and an executable code is produced, ready to be uploaded to the target microprocessor. All the above mentioned process takes place automatically and needs only the selection of the desired target processor/board. Boards equipped with the pre-installed TaskScript Kernel are ready to run the generated code, since the Kernel has built-in the helper functions needed to support the TaskScript Virtual Machine Language. The Deployment of the executable code to the target board iis one of the verbs defined in the Development Protocol (other verbs are the download the actual state from the controller, the start and the stop of the controller); such a protocol allows communication among TaskScript Studio and the TaskScript Kernel installed onto a physical board; the communication can take place over various means; however, for the simplest boards an RS-232 interface is used; hence the PC hosting the Studio must have a serial interface (in case it does'nt have one, a USB-to-RS232 cable could do the job, as well) and the two must be connected by a RS-232 cable. In order to allow the TaskScript Kernel to service the Development Protocol, the "Load/Run" switch must be placed in the "Load" position. The actual steps are as follows:
The picture below reports an advice that pops up after step 4. Testing of the model at physical level, as well as physical Diagnostics are the other features supported by the Development Protocol; loke the download, they can be performed within the Studio provided that the board is connected with the PC through an RS-232 cable and the the "Load/Run" switch is placed in the "Load" position. The two operations leverage upon the ability of the Kernel to answer to a query of the PC sending back the whole state of the controller at the time of the query. The state is received by the studio, shown on the screen in the same form as a Structural visualization (actually, in this case the colouring reflects the actual state of the controller) and appended as a frame to a trace file for further navigation. Having access to the actual state of the model when immersed into its actual physical environment opens the two above mentioned features:
3. The TaskScript KernelThe TaskScript Kernel is a lightweight Operating System residing onto the target microcontroller that helps the executable code generated by TasjScript Studio out of the model to perform the intended behavior on the target board. At run time, on the target microcontroller, 2 pieces of software are tigthly cooperating in order to have the physical board strictly reproduce the behavior contained into the model:
The Kernel code has the highest efficiency, being written in Assembler native for each microcontroller family it has been ported to; on the other hand, the code coming from the model is also very efficient, since it derives from a compilation of the TaskScript Model Language into the TaskScript Virtual Machine form (the two languges have been designed in order to be perfectly adapted one to the other, hence the translation produces a highly efficient form) and the TaskScript Virtual Machine form is translated into executable code by means of a macro-assembly step. The main task performed by the TaskScript Kernel include:
The picture below illustrates a detail of the scheduling algorithm implemented by the Kernel, showing the operations performed during one scan. The various phases are: (1) update of the state of Steps for the current scan, (2) storage of last scan values, (3) sample of input variables (4) reset of non retentive variables, (5) evaluation of Transfer Functions of each and every active Steps, (6) update of timing, counter and communicator resources, (7) refresh of output variables. The whole TaskScript Technology has been designed to maximize the performances for physical implementations ranging from low-cost low-energy consumption 8 bit microcontrollers like the PIC16 familiy runnig on OS-less boards up to powerful boards equipped with high performances microprocessors running full OSs. In order to give an estimation of the available performaces, a medium sized model, with a few Steps active at the same time out of 20 Steps has a scan time (time needed to evaluate once the Transfer Functions of all the active Steps) of less than 1 mS on a PIC 16 board; the same model has a scan time of less than 0.2 mS on a PIC18 board. Such performances make TaskScript a unique and powerful technology to develop very low cost controllers able to manage a huge range of physical systems. Further detail about the TaskScript technology can be requested via e-mail to cto<AT>taskscript<DOT>com (this e-mail address is protected from spambots: just substitute <AT> with @ and <DOT> with .); click here to quickly to send a request. |