Real time system

Thread Starter

Anoop kumar (Anoop kumar)

Joined Nov 14, 2017
10
I do not understand difference between normal and real-time program. I do not understand when we will be use normal program and when will use real time program. I understand we write two types of programs. first normal type of program and the other is a real-time program. We write real time programs when we have to complete the task in a certain time..

The robots working in factories will have real time program because they have to do multiple work within time limit. If they do not work on a fixed schedule, the factory may suffer a big loss. That's why we need real time program.

I think the ATM machine is a real-time system because it also works for a certain time. The time to enter the password is also fixed. If you do not enter the password within a certain time then the process starts again If you do not take money for a certain amount of time then money goes back into machine.

I think we use the real-time system only when we have to do multi task within a certain time. Please tell when will you use the Normal program and when will you use the Real-time program. Is the example given by me right? If not, Then what are the real time systems
 

MrChips

Joined Oct 2, 2009
34,807
There is no such thing as a true real-time system. By the time the system recognizes and analyzes an input event, the event may be over.

You are correct. "Real-time" is used in the context of how much time delay can the user or application tolerate. For a human sitting in front of a computer screen and keyboard, a delay of 100ms may be considered real time.

A system that responds to musical input such as FX boxes may have to respond within 50μs.

Your example of an ATM waiting for a password is not a valid example of real-time systems. The time window that a user is allowed before the request times out is simply a programmed value in the input function.

Real-time systems is not just for multi-tasking. You can have a single-task system that must respond within a limited time to be considered acceptable, a digital camera for example.
 

MrChips

Joined Oct 2, 2009
34,807
There is another trick that can be used to create a true real-time system. If you can look into the future you would be able to analyze an event before you experience it.

In a similar fashion, this is what analog oscilloscopes do. They can display information leading up to an event even though it is the event itself that is detected. They do this by displaying the information delayed by micro or nano-seconds. Digital oscilloscopes do the same thing by continuously recording information allowing you to see data leading up to an event.
 

MrChips

Joined Oct 2, 2009
34,807
Can you give more example of single-task system
Musical instrument FX boxes come to mind.
Suppose a guitar player plays a note by plucking a string on the guitar. A real-time system can detect the note, alter its frequency, add notes to create a chord or chorus, modify the envelop, create waa-waa, vibrato, tremolo and echo, all in real time.
 

qrb14143

Joined Mar 6, 2017
112
Under normal circumstances, a processor will carry out the instructions given to it as fast as it possibly can. It is limited only by bottlenecks in the system.

Consider the example of someone opening a word processor to type a report. When you click on the desktop icon for Microsoft Word for example, the windows operating system will do its very best to open it as fast as it possibly can. It makes no promises as to how long this will take, if you have a fast computer it may take half a second, if you have an old computer it may take a minute.

Now consider some sort of measurement device, like a weather station recording the temperature over the course of a day. If we had a function called say logTemperature() and we called it in an endless loop, the processor would log temperatures as fast as it possibly could. This could potentially mean that we took thousands of temperature readings per second and filled up our memory very quickly. What would be better is if we could take a measurement every five minutes.

This is where the Real Time Operating system comes in. We can assign tasks to the processor and give it a frequency to take measurements at or a deadline by which we want the measurements taken. MrChips is correct in what he says as no system is truly real-time. We can program our sensor to measure temperature every five minutes but what this really means is that the measurement will be TRIGGERED every five minutes but we have no idea how long it will actually take to capture. Of course, if we really wanted to we could work out the number of clock cycles for the instruction to complete but this may not be useful to us as the processor master clock is generally not very accurate.

This brings us on to the real-time aspect. In order to do things in a "human" timescale ie Seconds, minutes or days we need an accurate reference for how much time has passed. You will often see embedded systems using 32768Hz oscillators to do this. Microprocessors are very good at dividing by two. You will find that if you divide 32768 cycles by two fifteen times you will arrive at precisely one second. Embedded systems can then use this to keep track of how many seconds have passed so that they can schedule tasks in "real time"
 

MrChips

Joined Oct 2, 2009
34,807
Anti-lock braking system is another example.

ABS has to measure car speed, wheel rotation, displacement on the brake pedal, analyze and convert that to a pneumatic signal to the power brakes, all in real-time.
 

Thread Starter

Anoop kumar (Anoop kumar)

Joined Nov 14, 2017
10
Your example of camera sounded good. Can we make this example in daily life. If we make real time system by connecting a camera with controller. where we can use it office , home, park
 

MrChips

Joined Oct 2, 2009
34,807
Your example of camera sounded good. Can we make this example in daily life. If we make real time system by connecting a camera with controller. where we can use it office , home, park
Ok, let us take an extreme example using a digital camera.
Remote surgery is now possible. A patient is on an operating table while the actual surgeon is located somewhere in another part of the globe. The camera itself (not to mention the robotics) and all the communications channels have to provide images to the surgeon in real-time. You can appreciate why such systems cost millions of dollars.
 
Real Time OS - A guaranteed response to an event

Regular OS - Each task gets an equal share of time

Preemtive multi-tasking - Windows
Co-operative multi-tasking - The old Macintosh system. A program gives up control.

In an example, I had to move a motor a varying amount of time (mS to seconds) every minute or so. I could not keep track of the movement time or could not stop the motor in time without incurring significant errors. This https://stackoverflow.com/questions...-current-windows-system-wide-timer-resolution shows windows has a resolution of 15.6 mS per tick. That may not be good enough.

A good example of an RTOS would be something that generated the firing angle for phase angle firing of the AC power line and displaying the power.
 

MrChips

Joined Oct 2, 2009
34,807
Can we see into the future? More importantly, how can you get information ahead of your competitors?

There is no place in the world besides Wall Street where real-time is most important.
In this particular example, you want to delay information on your order before your competitor can act on it.

Read how a 350μs delay line using 38 miles of fiber optics can make a difference.
 

Thread Starter

Anoop kumar (Anoop kumar)

Joined Nov 14, 2017
10
I am studying electronics communication engineering. I am in 3rd year and I have to submit class project for my practical exam. I want to make a project on real time system. I got a five-day time to decide topic. I have been searching on internet. But I still can’t decide topic.

I want to make a project that may complete within three months. I have to complete project within three months at any situation. Otherwise I will be fail in exam. Also I want to make project Which is less expensive.

I gave the example of a robot that works in the factory and told about ATM machine for example. Both of these projects are big I don’t think I can make such a big project right now. You gave example like camera , Anti-lock braking system. Musical instrument.. these are some good examples to understand real time system. But it will take a long time to make. If I make system for doctors, I will have to go at hospital I will have to get information about equipment used during operation’s and If I make Anti-lock braking system I have to work with mechanical guys. I think my studies will also be distracted.
So that’s why I want make my project in electronics so that I can study for exams and also can complete the project. I was looking for example where I can connect few sensors with the controller to create a real time system. Do you have some ideas, If so, how implement it into project?
 

MrChips

Joined Oct 2, 2009
34,807
Automated fishway.

What is an automated fishway? A fishway or fish barrier is a system of gates and ladders in a channel that allows certain species of fish to enter while prohibiting others.

An automated system would use a video camera to identify the fish species. When a fish is identified as being preferred a gate is opened to allow the fish to enter the fishway. In other words, the system sorts fish in real time.
 

Thread Starter

Anoop kumar (Anoop kumar)

Joined Nov 14, 2017
10
Yes this is also good But from your example, I have idea in mind. We are using a video camera, so why do not we use it in toll plaza. Like automated toll plaza system, We will monitor the car’s via video camera on real time. I request you to make this idea as real time system. It seems a little bit good project as computer to fish system.
 

MrChips

Joined Oct 2, 2009
34,807
Yes this is also good But from your example, I have idea in mind. We are using a video camera, so why do not we use it in toll plaza. Like automated toll plaza system, We will monitor the car’s via video camera on real time. I request you to make this idea as real time system. It seems a little bit good project as computer to fish system.
There are automated toll highways in existence. A camera takes a picture of the car's licence plate when the car enters and exists the highway. The system then bills the owner for the distance traveled. This is not necessarily a real time system because there is no time limit on the plate recognition.

However, a private controlled parking system needs to recognize the plate within 1 or 2 seconds.
 

Thread Starter

Anoop kumar (Anoop kumar)

Joined Nov 14, 2017
10
I told my teacher about this idea, but They did not like it. He said that search for something else.
He said, make a multi-purpose project So that I could learn more programming.

I really appreciate you. You have already helped me a lot. If you still want to help me I will be very grateful to you
 

MrChips

Joined Oct 2, 2009
34,807
Here is something simpler: A parking lot capacity counter.

It counts the number of cars entering and leaving a closed parking area and it displays to incoming drivers how many spaces are available. (Hardly real time but let's see if your teacher approves.)
 
Top