HTC

ControlH Language and Tools


ControlH Language

The look-and-feel of the ControlH language was developed to mirror traditional notations in the fields of guidance, navigation and control, which rely on the mathematics of dynamical system modeling and systems of differential and difference equations. ControlH allows specification of hierarchical block diagrams constructed from primitive mathematical operations. In ControlH, the inputs and outputs of operators are time-varying signals. The operators provide a mapping from time-varying input signals to time-varying output signals, where feed-back loops from outputs to inputs almost invariably appear. Computer simulations or implementations of such specifications are performed using a sampled data computation paradigm in which the operators are evaluated periodically at some rate, mapping discrete-time samples of input signals to discrete-time output samples. This model of behavior and computation underlies the basic constructs of the ControlH language: variables and named constants, states, operators, processes, global blocks of variables and named constants, and conditionals.

The ControlH language has both a textual and a graphical syntax. The figure below illustrates the general structure of ControlH specifications using the graphical syntax. The operator shown on the left has as its implementation the block diagram shown on the right. This graphical specification can be automatically translated to a ControlH textual version. The graphical editor allows the implementation of a graphical operator to be defined textually where this is more convenient (e.g. equations).

ControlH provides a set of primitive or basic data (signal) types and operators that are appropriate for GN&C applications. The data types defined in ControlH currently include booleans; switches (essentially enumerated types); integer scalars, vectors and matrices; real scalars, vectors and matrices; discrete-time and continuous-time state spaces; and one-, two-, three-, and four-dimensional data tables. An extensive set of primitive operators is provided for all these primitive types.

A key feature of the ControlH language is the ability to specify generic or polymorphic operators. These are operators whose exact meaning depends on the types of the input values used in a particular invocation or call to that operator. To put this another way, certain details of the definition of the operator can be automatically tailored based on the diagram in which that operator is used. This finds its greatest use in writing generic operators that can manipulate scalars, vectors or matrices interchangeably without built-in knowledge of dimensionality, but the mechanism is a fairly general one that can also be applied in other ways. Such features provide essential support for developing reusable GN&C architecture specifications.

Within the context of ControlH and GN&C engineering, the term "state" has a rich and precise meaning. In ControlH, a state provides retention of values between successive executions of an operator, encapsulation of data within an operator, initialization, and assurance of semantic correctness with respect to the sampled data computation model. The features of the language support and help assure the correct maintenance of state in a ControlH specification and the resulting code.

Many GN&C applications are designed to be run at multiple rates when implemented in software. Different operators in a GN&C algorithm often sample their inputs and produce outputs at different rates, which is to say they are periodically executed with differing periodicities. For these reasons, ControlH supports a multi-process programming environment by incorporating a process object. The specification of a process currently consists of the declaration of its name and its period. Operators can be explicitly assigned to a particular process. Otherwise, an operator defaults to the process of the diagram in which that operator appears. The introduction of a process concept into the language not only supports a clean and intuitive mapping between the ControlH and MetaH views, it also provides a mechanism that allows the GN&C engineer to develop parallel algorithms.

ControlH allows conditional selection of input and output signals through constructs that resemble if-then-else and case statements (typically called switches in GN&C block diagrams).

ControlH allows the specification of global blocks of constants and variables. Global constants make it convenient to define parameterized models and controllers. Global variables make it possible for different operators to access common values in a synchronized manner, including operators executing at different rates in different processes.

There are algorithms which defy a declarative description in pure ControlH. ControlH recognizes this fact by including certain escape mechanisms in the language. In particular, true procedural (sequential) execution of conditionals, loops and assignments is provided in a way that allows users to directly write procedural algorithms for an operator where this is deemed essential.

ControlH Tools

The figure below shows the ControlH tools. ControlH architecture specifications can be developed using either the graphical or the textual syntax, where the tools can automatically translate a graphical into a textual format. The graphical editor allows a textual specification to be entered for an operator that appears in a diagram if this is more convenient than drawing a subdiagram (e.g. direct entry of equations).

Code Generator

The ControlH code generator currently produces either Ada or C software. An important aspect of our approach is the generation of well-structured code. There is a reasonably intuitive mapping from ControlH objects to the language constructs generated from them, and a reasonably intuitive mapping from ControlH objects to objects in the MetaH specification that describes the source code. It is important to note that the mapping between ControlH operators and source language subprograms preserves the modularity of the algorithm. The resulting ease of traceability between specification and implementation is extremely useful during multi-disciplinary trade-off studies and during verification and validation.

The set of primitive operators and the library of code templates used during translation can be fairly easily modified. We use a rule-based approach for code generation in which the tool does not necessarily insert a particular fixed block of code for a particular primitive operator. Instead, the code generator may be given a rule to invoke, passing as parameters any user-specified pragmas and the results of the generator's type inference, data flow and constant propagation analysis. This operator-dependent rule then selects and tailors the final code generated for a particular primitive operator. Although it is transparent to the typical GN&C engineer using the ControlH toolset, in fact the ControlH code generator is more like a module assembly tool than a traditional compiler whose coding idioms are largely immutable.

By default, ControlH performs a number of advanced optimizations whose effects are to evaluate portions of a specification at development time rather than at run time. ControlH provides mechanisms that allow the GN&C engineer to tune the time and space properties of generated code during trade-off studies when different optimization policies would favor faster code or more compact code. For example, multiple instances of an operator might appear in multiple diagrams, where some of the parameters of that operator are constant (e.g. limiter range, filter bandpass, linear operator state space). The user can selectively control whether a single shared subprogram is to be generated for each instance of the operator, or whether the constant parameters are to be folded into multiple customized implementations. The former produces smaller but slower code, the latter produces bigger but faster code. As another example, a suite of sparse matrix optimizations can be enabled by the developer.

Simulation

Functional simulation is performed by combining the generated code modules with with a simulation executive, which is an idealized (non-real-time) scheduler and state update function. The resulting simulation does not provide any feed-back about computer resource utilization or timing, but does provide the GN&C engineer with the ability to perform dynamical system simulations and assess the mathematical functionality of the specified GN&C algorithms. Note that this assessment is made using the generated code modules that will ultimately be the actual implementation, since these same modules will be passed on to the MetaH toolset for inclusion in the embedded software. This greatly increases the assurance that the behavior observed by the control engineer will be exhibited by the final product.

Equilibria Determination and Linearization

By substituting a linearization executive for the simulation executive, the user can perform linearizations about points of interest. The executive numerically computes an equilibrium for the nonlinear discrete-time system implemented by the software, and the Jacobian for the system about that equilibrium. The equilibrium search is configurable in terms of the value of the state and input perturbations, initial estimates for the trim condition, exit criterion from the equilibrium search, and specification as to which inputs and states are fixed within the equilibrium search.

Other Control Analysis and Development Tools

Linearizations can be passed to linear analysis toolsets through easily written interfaces (e.g. we currently have interfaces to MatLab, some plotting tools, and an internal development toolset called HoneyX). The ControlH code generator also allows the user to specify that a particular operator is in fact a transfer function imported from a linear analysis toolset. Design and analysis of linear systems or subsystems can be performed in another toolset, with the results incorporated into a ControlH specification and, ultimately, into the generated code and the final embedded implementation.

DSSA for GN&C Languages and Tools Page

DSSA for GN&C Home Page