Featured post

Arduino FreeRTOS Mutex Examples

In this section, we will explain using an example to demonstrate mutexes in Arduino using freeRTOSThere are two freeRTOS Mutex examples in this tutorial, the first example demands some hardware (LCD) While the second does not need any hardware, you can try out both if you have the resources.

In the last tutorial, we considered in detail: semaphores and mutexes and we also established the difference between binary semaphores and mutexes.
Just for a review:Recall that a mutex is a locking mechanism that implements the take and gives functionality in itself, unlike a binary semaphore. See this tutorial if you have not before continuing.
Example 1: Protecting the LCD Resource Using Mutex in freeRTOS
Program Description

In this program, we Demonstrated the use a 16x2 LCD display to implement a mutex.

The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. you can usually tell them by their 16-pin interface.


* LCD RS pin to digital…

Digital Systems and Stability Analysis using Jury's Stability Test

In this post, we will be introducing digital control systems, their advantages, and disadvantages, we will also perform a comparison between digital and analog control systems. Then we will proceed to sampling and Shannons sampling theorem and how it is applied practically, we will also see some sampling circuits and review Zero Order Hold DAC. Finally, we will look into analysis of the response of digital systems using difference equations and Stability analysis of Digital Control Systems using Jury's stability criterion, we will explain how to plot the Jury's table using an example to illustrate the process and how to make statements about the stability of the system.

So many theories and analytical tools exist in classical analog control system analysis, however, due to the shifts in technology, control algorithms are now been implemented using digital systems and microprocessor-based controllers, this is because of its numerous advantages, recent studies have shifted focus into the analysis of digital control systems.

Assumption: This tutorial assumes that you have an introductory knowledge of Z transforms.

What is a digital control system?

A digital control system is a  control system which utilizes digital computing devices (Microcontrollers, microprocessors, System On Chip, Application SPecific Integrated Circuits - ASIC) for process or system control operations.

Examples of Digital control systems

  • Flight Control Systems

  • HVAC Systems

  • Military Drone Systems

  • Missile Launchers

  • Smart Positioners etc

Advantages and Disadvantages of Digital Control Systems

Advantages of Digital Control Systems

Digital Control Systems come with numerous advantages that have facilitated its development. These advantages include:

  1. Cost Effective: Due to the Integration technologies like VLSI (Very Large Scale Integration) digital systems are now comparatively cheaper than what they were in the past

  2. High Computational power: Microprocessors chips can compute large amounts of data in splits of nanoseconds.

  3. Flexibility: It can be easily programmed and reprogrammed

  4. Complex algorithms can easily be implemented

  5. Reliability, Speed and Accuracy etc

Disadvantages of Digital Control System

Despite the enormous benefits of Digital systems, they also have some disadvantages, which are:

  1. Loss of information: Due to the fact that signals in nature are analog, the transformation of these analog continuous signals to digital discrete signals is accompanied with a loss of information, according to Shannon, for a signal to be accurately represented by a discrete set of sampled values, then the sampling frequency must be greater than twice the bandwidth of the signal. It is practically difficult if not impossible to sample at such frequency, thus no digital approximation of an analog signal is 100% accurate.

  2. Digital systems can behave unpredictably at high temperatures in industrial conditions, thus their performance is inhibited at such places and requires an air-conditioned environment which in turn increases the cost of operation. However, this is not so much a disadvantage in established industries.

Differences between the Digital and Analog Control Systems

Discrete signalsContinuously varying signals
Z transforms for analysisLaplace transforms for analysis
Can be used for discrete and analog systemsUsed only in analog systems

Ideal Sampling

For digital systems to be applied in process control, there is an obvious need for sampling. Digital systems are discrete and cannot comprehend analog data thus sampling helps bring the signal to their domain.

Sampling is basically a process of converting analog continuous signal to a discrete signal, this it does by taking a snapshot of the continuous signal at specified time intervals defined by the sampling period.

How Sampling is performed

The basic idea of sampling is explained using a sample and hold circuit. This circuit picks the value of a signal at a particular instant and holds the data for it to be converted into its equivalent digital representation.

The simplest sample and hold circuit is illustrated with a switch and a capacitor, the switch is closed at intervals at a rate determined by the sampling frequency.

When the switch is closed, the capacitor gets charged to the instantaneous value, there is no delay (time constant) in charging the capacitor. You could recall that

Vc = V(1 - e(-t/RC))

Since R is zero, the exponential term becomes zero and the Vc = V at every point in time.

However, there is a little problem with this circuit, using this circuit to sample a signal can introduce distortions into the system it is sampling by loading the system, thus the improved model shown below.

The improved model makes use of an input buffer and an output buffer to provide high input impedance such that the introduction of the S&H circuit will not cause any change to the signal being sampled.

Shannon's Sampling Theorem

Shannons Sampling theorem has it that for a signal with a bandwidth (Wb) to be accurately represented by a discrete set of sampled values, then the sampling frequency must be greater than twice the signal bandwidth. This frequency (2Wb) is called Nyquist frequency.

As said earlier, this is very difficult to obtain, so the general rule of thumb for practical application is to sample at a frequency greater than 10 times the Highest frequency component present in the signal.

Note: Whenever sampling is done at a frequency less than the Shannon frequency, a low-frequency signal called an alias is formed. This alias must be removed from the sampled signal. That is the reason behind the low pass filter you see in Analog to Digital conversion circuits.

After the computer or digital controller has received the converted digital input, it processes this and generates an output, this output is a digital output and needs to be converted back to analog to be used in the plant. Thus there is a need for Digital to analog converters. For the scope of this work, we will be restricting DAC to Zero Order Hold.

Zero Order Hold (ZOH): Zero Order Hold is a circuit model that practically produces an analog signal from a digital signal. This it does by holding each individual sampled value for one sampling period. It is the simplest model for Digital to Analog Converter.

Digital Control System Analysis.

In performing or analyzing digital control systems, two major areas come into mind:

  • Analyzing the system's response to a digital input

  • Analyzing the stability of the system

Analyzing the response of the system to a digital input.

When a digital system is subjected to an input (digital), we can obtain the response of the system using the difference equation.

The difference equation is given as shown in the image below:

Where Xo is the output and Xi is the input. I will update this post with an illustration later.

Analyzing the stability of the system

In analog control systems analysis, so many methods have been postulated to predict the stability of the system, examples are Routh-Hurwitz, Root Locus, etc. In Digital systems, there are also such systems, however, at this point in time, we will be restricting our domain to Jury’s Stability test.

Jury’s stability test

To apply Jury’s stability test on a digital control system, We follow the following steps:

  • First, obtain the characteristic equation. Note: the characteristic equation can be gotten from the transfer function since it is defined as the denominator of the transfer function.

  • Secondly, plot the Jury's table.

In plotting the Jury's table, the number of rows to be plotted is given by 2n - 3. Where n is the order of the characteristic equation.

For instance, if the characteristic equation of the system is given as Z4+3Z3+2 = 0; the order is 4 (the highest power of z).

Thus, in this case, the number of rows:  2(4) - 3 = 5

  • Arrange as shown below, Where Z0 => Z0 and Zn = ZnAnd A is the coefficients of the corresponding Z term.

A0A1A2……….. An-1An

Note also that to get the Bkth terms and subsequent terms, you find the determinants of the matrixes formed.

Jury's stability Criterion: Given a system with characteristic equation F(z), For this system to be stable, the following neccessary and sufficient conditions must hold true:

  • F(1) > 0

  • (-1)nF(-1) > 0

  • |Ao| < An

  • |Bo| > |Bn-1|

  • |Co| > |Cn-2|

  • |Do| > |Dn-3| and so on.

Let's consider a quick example to further understand this.

Illustration: Given a system with the characteristic equation: Z2 + 3Z + 10 = 0. Is this system stable, marginally stable or unstable?


1. The characteristic equation F(z) is already given as Z2 + 3Z + 10 = 0. With order(n) = 2

2. Number of rows in Jury's table: 2(2) - 3 = 1

Plotting the Jury's table for the question above


Testing for Condition 1, F(1) > 0:
F(z) = Z2 + 3Z + 10 = 0; 

Thus F(1) = (1)2 + 3(1) + 10 = 14.

Inference: [14 > 0, Condition Satisfied]

Testing for Condition 2, (-1)nF(-1) > 0
Where n =  2;

(-1)nF(-1) =(-1)2 [(-1)2 + 3(-1) + 10] = 8.

Inference: [8 > 0, Condition Satisfied]

Testing for Condition 3: |Ao| < An
Where n = 2; Thus A2 = 1 while Ao = 10;

1<10. Condition 3 is also satisfied. 

Note we would have gone further to test for conditions 4 -> ∞ but we have only one row, thus our checks end at 3.

Since all conditions are met, the system described by the characteristic equation is stable.

Features of Jury's Stability Test

  • Jury's stability test provides an absolute stability analysis

  • It only shows the existence of instability but neither gives the number of unstable roots nor their locations.

Questions, contributions? Use the comment box. Please share to encourage us.


Popular posts from this blog

Arduino FreeRTOS Tutorial 05: Binary Semaphores and Mutexes

Arduino FreeRTOS Beginner Tutorial: Task Creation, Scheduling, Deleting