Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Universal Framework for Science and Engineering - Part 3: Control systems. Processing of signals.

0.00/5 (No votes)
13 Sep 2007 2  
An article on universal scalable engineering framework applications to automatic control and processing of signals.

For more information, visit the following websites:

The main form of the framework

Contents

Introduction

The universality of this framework has one disadvantage. It is difficult to study it, since it has a large number of facilities. Even the author of this software was frequently discouraged. The best method of studying or using this software is handling a lot of samples of its applications. This article contains samples devoted to automatic control and processing of signals.

Background

Automatic control and processing of signals is, in general, a pure math. In principle, it is possible to use MatCAD for it. However, the purpose of this framework is not only calculation. Calculations should interoperate with other facilities of this software, for example, 3D graphics. So, I'll show application examples of automatic control and the processing of signals.

What's new (2014)

There are a lot of improvemets of this software. Now it is compatible with Visual Studio2013. Also it supports Simulink and real-time. These new features are briefly described here. I fixed the bug with the phase detector sample.

What's New (2007)

Now I'm engaged by a very interesting job, so I've little time for writing a profound description of the framework. Also, I cannot find assistants. A person who can catch the problem usually has their own excellent work. However, the framework is being intensively developed and I would like developers to know about its new updates. Therefore, instead of a profound description, I put in brief remarks about changes to the framework.

Testing

Now the framework can test a set of situations. Testing code belongs to the TestCategory.csproj and AstronomyGL_Test.csproj projects. The user can put a set of *.cfa files into a directory or database and the framework can test all of them.

User Interface

Editors of properties in previous versions can be opened in separate windows only. Now you can find them on the desktop.

New layout

Now charts are placed directly on the desktop. Right mouse-clicking on the caption (for example, Chart) shows the old layout in a separate window:

Separate window

Also, a new version of the software contains DockManager developed by Weifen Luo. I've found that open file operation is very exhausting work. So, the new version enables us to drag a *.cfa file to the desktop. The result is the same as file open.

The framework uses drag and drop in other situations, as well. For example, if we put the series Series component component on the desktop and drag a *.gra file onto it, then whatever is contained in the file series will be loaded to the component:

Putting series

Time Derivations

The new version of the formula editor contains a new operation, Time derivation. Let us consider usage of this operation. For example, we have the following picture:

Time derivation usage

The Init component has following property editor:

Property editor of Init

Init has a single formula and accepts Derivation order 3. This means that any client of Init may use derivations of the formula by order up to 3. Der is a client of Init. Its property editor is exhibited below:

Property editor of Der

We have two formulas with one input variable, x. This variable is, in fact, Formula 1 of Init. The variable is provided by Init. So, we can calculate such formula derivations that require derivations of x of orders that do not exceed 3.

Other Features in Brief

The present day version of the framework contains lots of new components: magnetic field, sensor of 3D field, inertial navigation system, etc. Although these features do not belong to pure automatic control theory, they are related to concrete automatic control systems. For example, magnetic field and field sensor components can be used for simulations of spacecraft orientation control systems.

Now there exists a website devoted to the framework. I and my colleagues are more engineers and scientists than software developers or architects. A lot of our work does not correspond to The Code Project. If you wish to know this work, you can visit the framework site. This article contains a new chapter devoted to transfer functions and the Dirac Delta function.

Two-channel Follow-up System

This example contains a simulation of a follow-up system of radar. See the picture above. It has two channels: the channel of azimuth and the channel of elevation angle. The geometry of this system is represented in the following picture:

Geometry

In this situation, an antenna is installed on gimbal suspension with two degrees of freedom: azimuth and channel of elevation angle. Let us construct the situation.

Situation

We have the Ground frame. We've installed the Azimuth frame on it and the Elevation frame on the Azimuth frame. The Azimuth frame is rotated around the y-axis of the Ground frame and the Elevation frame is rotated around z-axis of the Azimuth frame. In result, the Elevation frame is the frame of the antenna.

We also have the Vehicle frame. Its motion is defined by the Motion component. We've chosen such motion that the following graphs look beautiful. The Measurements component performs measurement parameters of the Vehicle frame relative to the Elevation frame. These measurements shall be used below for the construction of the control system. We let that antenna perform an angular measurement of the axisrving line. These measurements are unambiguously defined by y/d and z/d where y, z and d are the y-coordinates, z-coordinates and the distance of the Vehicle expressed in the reference frame of the antenna. We shall use the following control law:

Control law

...where Control law and Control law are angles of gimbal suspension and a, b, c, f, g and h are constants. This control law is, in fact, standard of the control theory. Constants are usually selected by stability and other criteria of this theory. Then we shall construct the control law:

Control law

The Delta calculates y/d and z/d:

Delta

The data-in of Delta are parameters of Measurements:

Delta

The System component solves differential equations of the control law. These two equations of second order are decomposed by four ordinary differential equations of first order. It looks like this:

Delta

Then we add another component to calculate orientation quaternions of the Azimuth and Elevation components. We also add indication components. Click here to download this situation. A graphical analysis of control quantity is presented in the following picture:

Delta

Light red and dark red curves correspond to the azimuth of Vehicle and antenna orientation. Similarly, light blue and dark blue curves correspond to elevation channel. Thus, a control system is constructed. Also, we may install a virtual camera on the antenna (Elevation) and observe 3D video of Vehicle motion. At part 7, I installed a camera on the Ground or the Vehicle. Virtual cameras are used at part 2 of this software description. Later, we may to install a virtual radio transmitter/receiver on the antenna and virtual electronic equipment, etc. Click here to download this sample.

On-off Control Element

A lot of control systems use on-off control elements that have the following in-out function:

Delta

This function has the following math description:

If we have several sets of photos of a 3D object, we can obtain its 6D position. In this example, the problem is solved in the following way. From the photos and virtual cameras, we obtain the contours of the object as it is presented in the following picture:

Delta

...where Deltaare input and output on the nth time moment. We shall use a recursive element for simulation of this element. A simple situation of usage of this element is presented below:

Delta

The Recursive component contains recursive equations of the on-off control element. These equations look like this:

Delta

As a result, we have the following charts:

Delta

A red curve is an input and a green one is an output. Click here to download this sample.

Continuous Filter

Usually, continuous filters are described by systems of ordinary differential equations. Since we have considered systems of ordinary differential equations above, our description will be very brief. You should click here to download a sample of a continuous filter. The result of filtration is presented in the following picture:

Delta

A red curve is an input of the filter and a green one is an output. The output looks more smooth. It is shifted by phase. You can process obtained inverse time signals through this filter to avoid the shift.

Digital Filter

A digital filter is any electronic filter that works by performing digital math operations on an intermediate form of a signal. We'll consider a digital version of the third order Butterworth filter. A Z-transform of this filter looks like this:

Delta

...where...

Delta

The Delta is a cut-off angular frequency. I've constructed the filter as a cascade of recursive elements with transfer functions Delta. As well as continuous filtering, it performs smoothing. Click here to download this sample digital filter.

Frequency Difference Detector

In this example, I've used a digital version of the standard frequency demodulation of FM signal. The method looks like this:

Delta

The Diff component performs numerical differentiation. The Abs component is a digital rectifier. The Integral component is a digital low frequency filter. The input signal is a chirp. The result of demodulation is presented below:

Delta

The error of demodulation is caused by the non-linearity gain frequency characteristic of the filter. Click here to download this sample.

Phase Discriminator

This example is devoted to determining the differences cosine of two signals' phases. I've used the following correlation scheme:

Delta

The p1 and p2 contain two harmonic signals, x(t) and y(t), having almost equal frequencies. The Multiplication calculates the squares and product of these signals. The Integration performs a digital calculation of the following integrals:

Delta

The Integration also performs digital filtering with the following transfer function:

Delta

The Post calculates the cosine by the following expression:

Delta

As was expected, this discriminator shows the following determination picture of the differences cosine of the phases:

Delta

Click here to download this sample.

Transfer Functions

A transfer function is the ratio of the output of a system to the input of a system in the Laplace domain, considering its initial conditions to be zero. If we have an input function of X(s) and an output function of Y(s), we define the transfer function H(s) to be:

H(s) = {Y(s) \over X(s)}

Readers who have read a circuit theory book will recognize the transfer function as being the Laplace transform of a circuit's impulse response. The new version of the framework contains the new component Transfer function component. Its properties editor is presented in the following picture:

Transfer function editor

Using the formula editor, we can enter the transfer function. This editor also exhibits transients:

Transient

It also represents frequency characteristics using both linear...

Linear frequency char

...and logarithmic scales:

Logarithmic frequency char

An example of its usage is presented below:

Transformation function sample

The Input generates a harmonic input signal. The Transform transforms it. The red curve is input and the blue curve is the result of the transformation. Click here to download this sample.

Dirac Delta Function

As has been said above, this task requires the Dirac Delta function. The formula editor supports it. The presence of the Delta function at the right part of the ordinary differential equation shows that the resulting function is not continuous. It is presented in the following chart:

Delta function result

The framework can operate with Dirac Delta functions. For example, the following formula...

Delta function formula

...is allowed. You can use these formulae as the input of transformation functions, as presented in the following picture:

Usage of Delta function

Also, the Dirac Delta function can be used in ordinary differential equations. Click here to download samples with Dirac Delta function.

Compatibility with Simulink

Simulink is a powerful software it is used for digital signal processing. Current verion of my soft suppotrs compatibilty with Simulink. Following pictire contains digital signal processing with a Simulink component.

Above picture contains a Simulink PID controller.

Download these sample 4.37 KB

Real time

Now my soft suppotrs real-time, so it supports real time control and signal processing. Following movie shows real-time example of digital filtering.

Download this sample 4.37 KB

More details about real-time are contained in my articles:

Conclusion

The name "Universal Framework" looks like pure advertisement only. However, if I say that this software enables me to operate with every kind of absorbing layer, then it results in the shock of my interlocutor. When I show how I can operate with every kind, "Indeed, your software enables you operate with every kind," replies the interlocutor.

History

  • 24 July, 2006 -- Original version posted
  • 13 September, 2007 -- Article and downloads updated
  • 14 August, 2014 -- Article and downloads updated and extended

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here