A method has been developed for resolving algebraic loops that occur in closed-loop systems when using MathWorks Simulink modeling and simulation tools. This variable fidelity method improves accuracy and reduces runtime significantly for users of Simulink Coder applications. The method improves the Simulink Coder tool’s ability to more efficiently and quickly generate C code based on algorithms modeled in the simulation tool. By replacing transfer functions that require high sampling rates with embedded function integration schemes, users can achieve continuous transfer function accuracy at almost no computational cost. The innovation also enables computationally intensive block diagrams to run faster in real time, and satisfies Nyquist frequency requirements in models. Algebraic loops are resolved through fast sampling, making the innovation especially applicable to high-speed systems with saturation limits, dead-bands, and other constraints that create fast dynamics.

The method was designed to achieve variable fidelity without changing base sampling rates. NASA engineers developed the method while working to auto code and run several different electrical system models for aircraft act uator dynamics on a single-board processor. Problems occurred when the memory blocks required to reduce algebraic loops during system autocoding introduced a lag into the system that invalidated results. Conventional fixes (increasing sampling rate, introducing function generators) proved unworkable.

The software is unique in that it uses embedded MATLAB code to resolve algebraic loops introduced during autocoding, achieving higher accuracies while running at the lower base sample rate. Discrete transfer functions tend to attenuate signals before their continuous counterparts. This may be problematic for designers who would like to replicate the continuous transfer function attenuation or other behavior exactly. The new method presents a workaround, allowing users to iterate between the base step size, which effectively increases the Nyquist frequency of discrete transfer functions, and allowing accuracy in discrete systems comparable to continuous systems. By bypassing the Simulink tool’s complex methods for solving algebraic loops, designers can run computationally intensive systems at much faster rates while staying within the Simulink environment in order to generate the autocode and interact with all of the Simulink toolboxes. A demonstration model running at 100 kHz with a base sample rate of 800 Hz ran 13.4 times faster than an equivalent model solved using the Simulink tool.

Within the Simulink Coder environment, designers must resolve algebraic loops with memory blocks, which cause a time delay that can cause inaccuracies due to data sampling requirements. Workarounds such as function generators, rate transitions, atomic subsystems, and higher sampling rates are not successful for various reasons. When changing the sample rate, users sacrifice runtime. When changing the overall model, users may sacrifice accuracy. In either case, time is wasted in attempting to determine the best compromise. The new method is most useful for increasing the accuracy of systems that require a boost in sampling rate above the base rate.

This work was done by Peter M. Suh of Armstrong Flight Research Center. DRC-009-027

NASA Tech Briefs Magazine

This article first appeared in the September, 2014 issue of NASA Tech Briefs Magazine.

Read more articles from this issue here.

Read more articles from the archives here.