How to compose PCs for semi-real time control.

  • Thread starter Yamashita Taiichiro none
  • Start date
The example code was just to show something, see other posts.

while (1) {
Sleep(1000);
}

In a real application the loop would be something like.

while (1)
{
::WaitForSingleObject( hEvent, MILLISECONDS ); // will run
every MILLISECONDS if ( bExit )
return 0;

// control stuff.
}

Bill Code
MPM Engineering Ltd.
4-6240 202nd St., Langley, B.C., Canada, V2Y-1N2
Phone: 604-534-6605 Fax: 604-534-6693
E-Mail: [email protected] WWW: http://WWW.MPM-
ENG.COM
 
S

Sage, Pete (IndSys, GEFanuc, Albany)

I have found that Windows can be rather unpredictable when it comes to timing even on the order of seconds. For instance, we've found that when the user compresses an Access database we can certainly miss large scale timing windows. Somehow compressing the database goes right through the core of the OS - no wonder the feds want to break those guys up!

My recommendation for meeting timing requirements in the order of hundreds of milliseconds is to create your process as a real-time process. I have done this with software processes and it does
make them execute within those sorts of timing constraints. From Win32 you do the following:

// this process needs to be a realtime process to function correctly
SetPriorityClass(GetCurrentProcess(),
REALTIME_PRIORITY_CLASS);

In our tests this provides quasi-reliable timing ( +- 100ms) and we've certainly been able to maintain a 1 second window even with the CPU pegged at 100%.

You need to be very careful about what your process does. If it infinite loops it is over for the computer. As a result I recommend
creating a seperate real-time process that does nothing but the sleep loop you've demonstrated below. The simpler the program the better change of working. I'd move all other non-time critical
processing into a seperate process running at Normal priority.

Good luck,

Pete

> -----Original Message-----
> From: Yamashita Taiichiro none [mailto:[email protected]]

> Hello friends, this is Yamashita.
>
> My system is a combination of PLC and WinNT.
> For "real" real-time control, PLC could be used, and for user
> interface and for data strage and data transefer, WinNT used.
>
> So, I don't need real time response for WinNT, but when PLC request
> for data, it should respond in about 100ms to 1000msec time
frame. ...<clip>
 
Hi Yamashita

If you write Windows NT Kernel Mode device driver ( and not the user mode which deals with threads and like that ) you will be able achieve 100 ms timeframe EASILY, irrespective of whatever
you are doing on frontend. It will give you the same performance even if you are using printing service, disk access, heavy GUI intensive application etc. The kernel mode device driver has to be developed for protected mode ring 0 on 80x86 architecture to achieve the level 1 proirity for your process. You only need to have
a hold of good kernel mode driver developer(s).

SCSI HDDs definitely will help in increasing overall performance of disk access.

We have developed a data acquisition and Direct Digital Control system for Windows NT 4.0 which gives a performance of 256 Hz comfortably with a large processing stuff in interrupt service routine. It is used in automotive engine test system. We call it a Soft Real Time system.

Pl visit ataria.com and subscribe for a list [email protected] which discusses the NT based real time control system development.

I am sure that for your need of 100ms guranteed performance, you do not need any real time extension to Windows NT as windows NT is capable of doing it.

If you need any more information or performance bench mark data, pl write me.

Thanks & Regards

Prashant Deshpande
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Systems Manager
KPIT Systems Limited
6, Mayur Colony
Kothrud,=20
PUNE - 411 029 (INDIA)
Tel : +91 20 5468654, 5460200, 5435283
email : < mailto:[email protected] >
website : < http://www.kpit.com >
 
N

Nickels, Bob

Think & Do Software has been available for Windows 2000 for several months now, in addition to NT and CE. This is a commercial software package where all the "under the hood"
development needed for realtime ontrol has already been done for you...

Regards,
Bob Nickels
Honeywell Sensing and Control
 
Since you do not trust using Microsoft's OS, but apparently are "stuck" with it; why not consider an add-on to make things more real-time?

VenturCom http://www.venturcom.com/

Dale Ross
Mitsubishi Electric Automation

WinBBS +1.704.588.2669
http://WinBBS.DynIP.com/ telnet://WinBBS.DynIP.com

"These are my opinions and not necessarily those of Mitsubishi Electric Automation"
 
Windows Multimedia timer. How long did I run the test? ~hour. It was encouraging, but it proved to me that if you want hard real-time control, you could not get there with Windows NT alone. Now what I should have done, and may do one day is run the tests with an HMI running say using OPC. That seems to be a common situation for PC Based control these days. And on Windows 2000.

Dale Ross
Mitsubishi Electric Automation

WinBBS +1.704.588.2669
http://WinBBS.DynIP.com/ telnet://WinBBS.DynIP.com

"These are my opinions and not necessarily those of Mitsubishi Electric Automation"
 
R

Rick L. Hudson EMCO Inc.

We've used IOWorks from VMIC for several installations requiring real-time control on NT4 WS. In one case it is doing motion and process control in a textile dyeing application and in another we are doing data collion on a plant floor with data rates in excess of 1 million records per 24 hour period. The package seems to do a good job in allocating system resources.

Rick Hudson
 
P

Phil Covington

> Sorry, but i couldn't resist begging the question of 'many' successful W2K
> apps. ;^} Given the newness of W2K.

When I said many successful applications I was refering to NT4 as well as NT5 (W2K)...

Phil Covington
 
P

Phil Covington

It is interesting to note that Think & Do worked on beta W2K without modification. Think & Do no longer relies on real-time extensions to NT...
A very nice soft PLC package if you can get used to the flow chart programming.

Phil Covington
 
P

Phil Covington

> If you write Windows NT Kernel Mode device driver ( and not the
> user mode which deals with threads and like that ) you will be
> able achieve 100 ms timeframe EASILY, irrespective of whatever
> you are doing on frontend. It will give you the same performance
> even if you are using printing service, disk access, heavy GUI
> intensive application etc. The kernel mode device driver has to be
> developed for protected mode ring 0 on 80x86 architecture to
> achieve the level 1 proirity for your process. You only need to have
> a hold of good kernel mode driver developer(s).

This is simply not necessary. A user mode program can easily meet sub 100 ms requirements...

A kernel mode device driver would also be very hard to develop and debug in a reasonable amount of time.

Phil Covington
 
P

Phil Covington

From: "Sage, Pete (IndSys, GEFanuc, Albany)"
> I have found that Windows can be rather unpredictable when it
> comes to timing even on the order of seconds. For instance, we've
> found that when the user compresses an Access database we can
> certainly miss large scale timing windows. Somehow compressing
> the database goes right through the core of the OS - no wonder the
> feds want to break those guys up!

I would believe this if you were talking about Win 9x... But under NT, no way...

Phil Covington
 
U

Unique Systems

I have used Think & Do software in a few applications and every time it has worked flawlessly.

In one application it is controlling a 2 axis servo pick and place robot. I am using 2 Automationdirect 205 Ethernet I/O bases and a Galil Ethernet motion controller. Running on NT 4.0 Server the logic solve time (which includes reading/writing I/O) is 5ms with a scan interval of 15ms. It has been running without a single hiccup or BSOD for over 6 months. The computer is a 550Mhz PIII with 64MB of RAM and IDE HDD.

The other application is using a DeviceNet network with 6 nodes (8in/8out). Running on NT 4.0 server the logic solve time is 1ms. I have set the scan interval to 50ms but it runs fine well below 10ms but the web server takes a little longer to server up the web pages. The computer is a dual 400Mhz Celeron with 128MB of RAM and IDE HDD. This computer is used as a file, print, and Intranet web server.

WinNT and Think & Do have worked just fine for the applications I have thrown at them. The only thing we did special on the computers was make
sure that all of the hardware was NT 4.0 compatible. Other than that everything works great. Every now and then there is an over scan of a couple of ms (at the most 5ms) but they are rare. How many applications or processes will be totally messed up if there is a 1 to 2 ms over scan a couple of times?

Just my 2 cents worth. By the way I do not work for Think & Do, just a happy customer.

Steve
 
J

Johan Bengtsson

If the system is properly dimensioned you will never get this for any long time. The usual idea is that you allow the system to be unresponsive for some seconds at most to mouse and keyboard events, but the control (the RT parts) should continue undisturbed even during this periods


/Johan Bengtsson

----------------------------------------
P&L, the Academy of Automation
Box 252, S-281 23 H{ssleholm SWEDEN
Tel: +46 451 49 460, Fax: +46 451 89 833
E-mail: [email protected]
Internet: http://www.pol.se/
----------------------------------------
 
R

Ranjan Acharya

<clip>
Every now and then there is an over scan of a couple of ms (at the most 5ms) but they are rare. How many applications or processes will be totally messed up if there is a 1 to 2 ms over scan a couple of times?
</clip>

Sorry, I cannot accept an overscan. It is either real time or it is not.

RJ
 
J

Johan Bengtsson

I have got delays of about maximum 2 seconds on my (quite unfriendly) test. The test lasted for about 10 minutes so I do not take this as some absolute maximum either. These delays are quite rare and might not occur that frequently if you not use up the entire system as I did in my test

Please note: I was definitively NOT fair to the OS in this test and the about 2 second delay occured one or two times. My test program took as much processor time as it could and measured how long time it to run each loop in a loop that ended 10 minutes after it started (measured by calls to timeGetTime())

/Johan Bengtsson

----------------------------------------
P&L, the Academy of Automation
Box 252, S-281 23 H{ssleholm SWEDEN
Tel: +46 451 49 460, Fax: +46 451 89 833
E-mail: [email protected]
Internet: http://www.pol.se/
----------------------------------------


-----Original Message-----
From: Vladimir Bunyakin <[email protected] >

Yamashita Taiichiro wrote:
>
> Hi, lists.
> This is Yamashita, from Japan.
>
> I want to ask you that what kind of composision should be for
> semi-real time control ?
>
> I got an advice that if I use WinNT on PCs for semi-real time
> control of my productive equipment, the boot HDD should not be IDE
> but SCSI.
>
> Because if I use IDE HDD for boot drive, some interupt could happen
> to prevent my process for semi-real time control, about 100ms time
> frame.

According to my tests maximum delay caused by system activity
(extensive disk and video operations) was 1 ms for
REALTIME_PRIORITY_CLASS process,
THREAD_PRIORITY_TIME_CRITICAL thread.
System: Intel CA810EA motherboard, Celeron 466 processor, IDE
disk, NT4 SP4. Test lasted approximately 8 hours. ...<clip>
 
J

Johan Bengtsson

This seems manageable, properly programmed and dimensioned you will almost always have your response in time. My guess is that you actually always will get it in time. What is the cost of going into this failsafe mode? how long is it before it is restored, can some automatic retry make it better?

/Johan Bengtsson

----------------------------------------
P&L, the Academy of Automation
Box 252, S-281 23 H{ssleholm SWEDEN
Tel: +46 451 49 460, Fax: +46 451 89 833
E-mail: [email protected]
Internet: http://www.pol.se/
----------------------------------------
 
P

Phil Covington

Then don't use a soft PLC solution!

Maybe you should give us *YOUR* definition of "real time". He was not saying that it misses a scan or two, just that a few scans are a millisecond or two long. In most cases this is not a problem.

A hardware PLC's scan times can vary by this amount easily so by your (implied) definition PLCs are not "real time" either.

Even if you built a controller out of discrete logic ICs, the response time of your controller to an external event will vary slightly ( a few nSecs ) with temperature, voltage, etc... So, unless you pin down exactly what you mean by "real time", this discussion can be taken to absurdity...

Regards,

Phil Covington
 
U

Unique Systems

Take a look at the response time on most I/O (especially AC Inputs) and see if a couple of ms either way will make that big of a difference. I still would like to know how many applications or process are so critical that if 1 scan out of 100 is 2% over the set scan time that we will have
catastrophe?

I am not an "expert" so maybe I am missing something here, if I am please let me know.

Steve
 
R

Ranjan Acharya

<clip>
I still would like to know how many applications or process are so critical that if 1 scan out of 100 is 2% over the set scan time that we will have catastrophe?
</clip>

Think of a high-speed packaging (hundreds per minute) machine where a package can be mishandled if it is not detected correctly i.e. because of an
overscan. The scan time should, in theory be way too fast, but sometimes when all the code is complete, the scan time starts to creep up. The next thing you know, you have jams (with all the associated mess and down time). Analysis by strobe photography reveals that your PLC programme is not responding correctly (every so often) -- because your scan time is too high -- and you bugger up the machine. You can perform a Nyquist analysis to prove your point.

We have seen just this exact situation and I can never accept an industrial control package that is "almost real time". To me scan time is a digital thing, not analogue -- it is either OK or it fails to meet requirements. What am I supposed to tell my customer when they are down for fifteen
minutes because of a jam that is a result of an overscan?

RJ
 
Top