18.01.2015 Views

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Introduction<br />

Executing and switching modules<br />

IWS is a SCADA system composed of modules that must be executed simultaneously. Based on the multitasking<br />

concept, each runtime module (Viewer, Driver, and so forth) is a thread and the operating system<br />

switches from one thread to other automatically. It is a common misconception that you execute a SCADA<br />

system when you execute a PLC program. A PLC program contains a simple loop:<br />

PLC Program Loop<br />

However, in a SCADA system, there are several modules running simultaneously, and most of them can read<br />

and write data. Because a SCADA system modifies data (tag values) continuously during task execution, the<br />

preceding diagram is not applicable.<br />

IWS only has one process: Studio Manager.exe. When you execute a runtime project, the Studio<br />

Manager.exe process starts the Tags database and all of the runtime modules configured for the project. You<br />

can specify which modules (such as Viewer and Driver) will start during the runtime.<br />

Each process keeps a list of active threads for the operating system. Actually, each process activates and<br />

deactivates each thread during the runtime, according to the algorithm of each process. Also, when you create<br />

a thread you specify a priority value. The operating system continuously scans all currently active threads,<br />

and executes the threads according to their priority value — executing the higher-priority threads first. When<br />

threads with higher-priority values are active, the threads with lower-priority values are not executed at all.<br />

If there is more than one thread with the same priority value, and there are no other threads with higherpriority<br />

values, the operating system keeps switching between the threads with the same priority.<br />

Note: All IWS threads are set to priority 7, which is THREAD_PRIORITY_NORMAL. (Most programs<br />

contain this priority value.)<br />

Real-time program (such as SoftPLCs and Device Drivers) threads are assigned a higher-priority<br />

value (THREAD_PRIORITY_HIGHEST); however, these programs must provide a mechanism to keep<br />

them inactive for some period of time or the threads with normal priority would never be executed.<br />

IWS uses the UNICOMM.DLL library for serial drivers. This library creates a<br />

THREAD_PRIORITY_HIGHEST thread that "sleeps" (remains inactive) until data arrives in the serial<br />

channel. When IWS detects new data in the serial channel, the THREAD_PRIORITY_HIGHEST thread<br />

"wakes up" (becomes active) and transfers the data from the operating system buffer to the thread<br />

buffer, where it can be read by the Driver. This thread is the only highest-priority thread created by<br />

IWS.<br />

If you allowed threads to remain active all the time, the CPU usage would be 100% all the time, which must<br />

be avoided for performance reasons. Every program provides a mechanism to prevent threads from staying<br />

active all the time.<br />

IWS uses the following parameters to prevent threads from staying active continuously:<br />

Page 24<br />

<strong>InduSoft</strong> Web Studio

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!