Global Sources
EE Times-Asia
Stay in touch with EE Times Asia
?
EE Times-Asia > FPGAs/PLDs
?
?
FPGAs/PLDs??

Domain-specific languages for medical device design

Posted: 08 Apr 2014 ?? ?Print Version ?Bookmark and Share

Keywords:Domain-specific languages? Programmable Logic Controllers? PLCs? run-time system? general-purpose languages?

Industrial automation, and the medical domain in particular, demands high quality from the software and related systems. The domain-specific language follows the constraints and rules of the domain, guiding engineers to create correct, consistent and complete specifications. For example, the language does not allow connecting a motor to other objects other than through its ports (figure 3, ports Enabled, Direction and Speed of the TopStepMotor).

The same language is also used to specify control logic, like calibration of the balance (figure 4). As before, this model directly applies the domain concepts, like Switch and Balance. Here the whole model is specified with plain domain concepts, without using functions or other general-purpose constructs.

Figure 4: Specification for balance calibration.

Independently of the hardware employed to realise the device, the operating system, and any libraries used in implementation, a typical balance calibration procedure consists of the following steps:
???Pressing a switch to start and stop calibration (TopBalCalib)
???Reading previous reference values, for possible comparison with new ones (TopBalRefVal)
???Selection of the switch that shows if a calibration weight is placed on the scale (TopBalMax)
???Reading of numerical values, with and without the presence of the weight, using an A/D converter (TopBal and TopBalCtrl)
???Updating appropriate values of TopBalRefVal, depending on whether TopBalMax is on or off
???Repeating the calibration routine while the switch (TopBalCalib) is on

The specification of balance calibration in figure 4 is used for generating control logic code for different programming languages and for different target platforms. For embedded systems, a particularly useful platform is a Run-Time System (RTS) which interprets or executes IEC 61131 and IEC 61499 specifications. Such a RTS provides execution of code generated based on function block diagrams. Also, it enables synchronisation of distributed components, and reporting on the state of the system using events. From the code generation point of view, such a target system significantly simplifies the definition of the code generator, which needs to synchronise control logic with drivers and task scheduler.

Figure 5: Code generator for calibration.

Generators for code and configuration
Building a generator is about defining how model concepts are mapped to program code or other output like library calls. The access of the model elements is dictated by the language definition (metamodel). Consider the generator script in figure 5 as an example: it accesses AnalogControllers (like TopBalCtrl on figure 4), and then connections to two state switches and controllers. The green text refers directly to concepts of the language. The generator is defined in the same MetaEdit+ tool ( )we used for language definition. In this way changes in the metamodel can be immediately seen and tested while making the generators, significantly speeding up language and generator development.

This generator is then executed during code generation to produce the code needed for calibration of the machine. Other generators produce other parts like code for press, position detector, etc. Listing 1 shows the piece of code generated from the model shown in figure 4. The generator script described above produces the code for the if-then-else structure, and another generator script produces the variables and initialisations given in the first half of Listing 1.

Listing 1: Code produced from Figure 4.


?First Page?Previous Page 1???2???3???4???5???6?Next Page?Last Page



Article Comments - Domain-specific languages for medica...
Comments:??
*? You can enter [0] more charecters.
*Verify code:
?
?
Webinars

Seminars

Visit Asia Webinars to learn about the latest in technology and get practical design tips.

?
?
Back to Top