Chapter 2 Hardware Architecture
2.2 Three phase induction motor…
2.2.4 The derivation of vector control
architecture.
2.2.3 Vector control theorem
Up to now, the vector control strategy and technique is used in all kinds of AC motors. The concept of the control method is equivalent to the separately excited DC motor. The separately excited DC motor, if we neglect the magnetic saturation and the armature effect, the torque is direct proportional to the armature current.
In the torque control of induction motor, the magnetic field of stator and rotor varies according to the running condition and it’s not orthogonal. Through the coordinate transformation technique, we transfer the three-phase static coordinate to the two-axis (d,q) synchronous rotating coordinate system in order to make the control close to the separated DC excited motor. The current can be divided into two orthogonal, independent parts. If the flux of the rotor is fixed, the q-axis current of the stator is direct proportional to the torque.
2.2.4 The derivation of vector control
The dynamic equation of three-phase cage-type induction motor in the synchronous rotating coordinate is
(2-5)
p is the Laplace operator, is the stator resistance, is the rotor resistance,
Rs Rr
ωeis the synchronous rotating speed,ω r is the rotating speed of the rotor, is stator inductance, is the mutual inductance, the torque equation of the motor is
Ls Lm
T =e 3 PL (i i -i i )m qs dr ds qr
2 2 (2-6) The torque is produced by the vector cross product of the two axis current of the stator and rotor, it can not attain the control characteristic like the separately DC excited motor. We represent the rotor current by the rotor flux and the stator current Substitute (2-7), (2-8) to (2-5), we can obtain the following matrix:
The torque equation can be rewritten:
e m eqs dre eds qre Using the state equation to represent the third and fourth row of (2-9)
slip frequency of the motor should satisfy
e The torque equation can be rewritten as follow
In the torque control of the induction motor, if the rotor flux is fixed, the torque is direct proportional to the ieqs.
The most important step of vector control is to let the direction of the rotor
flux axis the same to the direction of the synchronous d-axis.
Rotor flux rotates as the speed of electrical angular frequencyωe.From the equationθ θ θe= +r sl,θe=∫ωedt= ( +∫ ω ωr sl)dt, the synchronous
rotating d-axis coincides to the direction of the rotor flux. At the time , all the rotor flux falls in the direction of d-axis. When deciding the d-q axis, we can use vector control theorem through the coordinate transformation.
e qr=0 φ
2.2.5 The comparison between V/f control and vector control
V/f control and vector control are the two main control theorems of the inverter nowadays. There are some disadvantages of the V/f control:
The torque can not be adjusted in the whole speed range.
Due to the open loop control characteristic, the dynamic response is bad.
The characteristics of the vector control are:
Provides the constant torque in the whole speed range.
Provides the accurate speed control owing to the closed loop control system.
2.3 The electric and mechanic system
In our treadmill system, using the inverter to control the induction motor to drive the running belt. The figure 2.3 is the mechanism of the treadmill. The induction motor drives the left side of the rotating axis; the right side of the rotating axis that has the radius R connects to the left side of the rotating axis by use of the belt. The rotating axis that has the radius r connects to the running belt.
Considers the mechanism that has the speed ratio a=2.2/6, f is the output frequency (Hz) of the inverter, and P is the poles of the motor, and V is the speed (m/s) of the running belt, and S is slip. Derives the following equation.
120* *f 2 *(1-S)*a*R=V*R/3.6
P 60 r
π (2-17) From the actual measurement, P=4, R/r=3/2, R=0.06 m, when the frequency of the inverter is 5.3 Hz, the linear speed of the running belt is 0.8 km/hr.
substitutes the above data to the equation 2-17, the slip is 0.09. When the frequency of the inverter is 122 Hz, the linear speed of the running belt is 20 km/hr, from the equation 2-17 the slip is 0.012. From the data of the specification on the motor, the rotating speed of the motor is 1735 rpm when the frequency is 60 Hz. From the equation 2-1, the rotating speed of the motor when the frequency is 60 Hz is 1800 rpm, and we can calculate the value of slip:
0.036.
Chapter 3 Software architecture
3.1 Embedded system
Embedded system is application-oriented special computer system which is scalable on both software and hardware. It can satisfy the strict requirement of functionality, reliability, cost, volume, and power consumption of the particular application. With the rapid development of IC design and manufacture, CPUs become cheap. Lots of consumer electronics have embedded CPU and thus become embedded systems. For example, PDAs, cellphones, point-of-sale devices, VCRs, industrial robot control, or even toasters can be embedded system. There is more and more demand on the embedded system market. Some report expects that the demand on embedded CPUs is 10 times as large as general purpose PC CPUs. As applications of the embedded systems become more complex, the operating system support and development environment became crucial.
3.2 Embedded operating system
The difference in operating system between embedded system and the desktop computer is that the embedded operating system is closely relative to the application environment and needs the ability of real time performance.
The execution result of the real time operation is relative not only to the
correctness of the logic but also to the time requirement. If the real time operation can not be done before the deadline, it can not be accepted.
A real time task responses appropriately according to some events, and the event usually happens instantly. So a real time task needs to keep up with the speed of the event or it may lose the meaning of real time. A real time system is designed to complete the task within the assigning time.
The different system needs the different level of real time performance.
The real time system can be divided into two kinds according to the different level of time requirement: hard real time system and soft real time system.
Hard real time: Any task in the system must satisfy the time requirement or it may cause great damage. It’s used in the condition such as weapon, aviation, and transportation, and industrial control.
Soft real time: The system should satisfy most of the time requirement, but it can tolerate some level of latency. It’s used in the condition such as mobile phone, PDA and daily entertainment.
The embedded operating system can be divided into two kinds according to the application environment: the general-purpose operating system, and the specific-purpose operating system. The typical general-purpose operating system is: WinCE.NET [8], VxWorks, Embedded Linux, and Windows XP Embedded.
And the specific-purpose operation system such as: Palm, which is used in the PDA; Symbian, which is used in the mobile phone.
When choosing the operating system, we consider the function of the treadmill and the need to the real time ability, and it is better to choose the
embedded operating system.
Considering the Microsoft and Linux embedded operating system, the advantage of the Linux embedded operating system is that the source code is open to the public. Under the open environment, many engineers can participate to test, and debug, so the stability of the operating system is good, and in the aspect of Microsoft, the early version of product inherits the drawback of the original Microsoft operating system: consumes more system resource, bad execution efficiency, and bad stability. But there is a great improvement of the new Microsoft embedded operating system. The similarity of the desktop operating system and the embedded operating system is the advantage of the Microsoft product. From the operating system to the integrate development environment, it is similar to the desktop environment, and it may take less time to familiar to the new environment. Due to the reason, we use the Microsoft embedded operating system.
There are two Microsoft embedded operating system nowadays:
WinCE.NET and WindowsXP embedded. The following is the comparison between the two embedded operating system.
CPU architecture: WinCE.NET supports four kinds of microprocessors:
ARM, MIPS, SHx, X86.
WindowsXP embedded only supports X86.
Real time performance: WinCE.NET is the real time embedded operating system, and WindowsXP embedded needs the third party software to achieve the real time performance.
Memory requirement: WinCE.NET needs at least 200 Kb and WindowsXP embedded needs at least 5 Mb.
The memory requirement depends on the function of the device.
From the above discussion, WinCE.NET supports more microprocessors, and the real time performance is better, and the requirement of the memory is fewer, so we choose WinCE.NET to be the embedded operating system of our treadmill.
3.3 WinCE.NET
Windows CE .NET is an open, scalable, 32-bit operating system (OS) that
is designed to meet the needs of a broad range of intelligent hardware devices, from enterprise tools such as industrial controllers, communications hubs, and point-of-sale terminals to consumer products such as cameras, Internet appliances, and interactive televisions. A typical Windows CE–based embedded platform is targeted for a specific use; often runs disconnected from other computers, and requires a small-sized OS that has a bundled, deterministic response to interrupts.Windows CE .NET offers the application developer the ease and versatility of scripting languages, along with the versatile environment of the Microsoft Win32 application programming interface. It also offers bundled support for multimedia, Internet, LAN, and mobile communications and security services.
The following are the features of Windows CE .NET.
Shell and User Interface
Windows CE.NET combines the Microsoft Win32 application programming interface, user interface, and graphics device interface libraries into the Graphics, Windowing, and Events Subsystem (GWES) module. GWES is the interface between the user, the applications, and the operating system.
GWES supports all the windows, controls, and resources that make up the Windows CE UI, which enables users to control applications. GWES also includes support for user input and for GDI, which includes support for fonts, text drawing, line and shape drawing, palettes, and printing.
Core OS Services
The kernel, which is represented by the Nk.exe module, is the core of the Windows CE operating system. The kernel provides the base OS functionality for any Windows CE–based device. This functionality includes process, thread, and memory management. The kernel also provides some file management functionality. The kernel services enable applications to use this core functionality. Use the kernel process and thread functions to create, terminate, and synchronize processes and threads and to schedule and suspend a thread.
Processes, which represent single instances of running applications, enable users to work on more than one application at a time. Threads enable an application to perform more than one task at a time. Thread priority levels, priority inversion handling, interrupt support, and timing and scheduling are all included in the Windows CE kernel architecture.
The Windows CE kernel uses a paged virtual-memory system to manage and allocate program memory. The virtual-memory system provides contiguous blocks of memory, so that applications do not have to manage the actual memory allocation.
Object Store and Registry
The object store, up to 256 MB of compressible, nonvolatile, random access memory (RAM) storage, is the default storage device on Windows CE-based platforms. The object store integrates the read-only files that are stored in read-only memory (ROM) with the read/write files of both the application and the user. In addition to the object store, Windows CE supports multiple, installable file systems, which include FAT12, FAT16, and FAT32, used by the ATA and SRAM PCCARD and Compact Flash (CF) cards, as well as proprietary systems that have their own drivers.
3.4 Development Tools
When we want to develop an application using in the embedded WinCE.NET system, the first important thing we should do is to choose one development tool. From now on, there are two main development tools for developing WinCE.NET application.
The table 3.1 summarizes two application development tools for Windows CE and the platforms and APIs they support for Microsoft Windows CE-based development.
To build Win32 applications or dynamic link libraries, we can choose Microsoft Embedded Visual C++ 4.0, for Windows CE.NET-based platforms.
To build a .NET Compact Framework application, we need Microsoft Visual Studio .NET 2003. A useful feature of this environment is that we can drag-and-drop controls from a toolbox onto a form, then click on elements in the form to add code behind the controls.
3.4.1 Win32 API
The Win32 API is the core programming interface for Windows CE. In the early 1990s, Microsoft announced that its two core strategic technologies were Win32 and the Component Object Model.
Windows CE was the first Microsoft operating system to use the Win32 API for both device drivers and applications. Sixteen-bit Windows systems use the Virtual drivers at their lowest layer, and 32-bit Windows systems have a proprietary kernel-mode API that is decidedly not Win32. Therefore, Windows CE is more deeply connected to Win32 than any other Microsoft operating system.
Win32 has been referred to as the "assembly language of Windows,"
because it is a very low-level API with very primitive functions. Just as multiple machine language instructions are needed to accomplish even the simplest task, multiple Win32 function calls are often needed to do real work. This is, however, the API that all other APIs and development tools ultimately rely on to get things done. In the context of the .NET Framework, Win32 code is referred to as
"unmanaged code." This is because the Common Language Runtime does not manage the memory, or guarantee the security and type-safety, of Win32 code. .NET code, by contrast, is called "managed code" because all these features and more are provided by the .NET runtime.
The following are the features of the Win32 API:
Fastest executables
Win32 provides the fastest executables. Part of the reason is that Win32 executables ship as native machine instructions. .NET Compact Framework executables, by contrast, ship as Microsoft Intermediate Language/Common
Intermediate Language (MSIL/CIL), which must be converted to native code.
This conversion takes time and cannot anticipate when it occurs.
The IL-to-native conversion takes place when a page of code is decompressed from the object store and/or read-only memory (ROM) and moved to program memory. This conversion is only needed when the code is brought into program memory, so after that the code can be executed with no further conversion required, as long as it is not deleted by the system memory manager.
Another aspect of .NET Compact Framework code that can cause delays is the Garbage Collector. The Garbage Collector moves objects on the heap as part of its operation. Any managed thread that is running in a process might need to access one or more object on the heap, so to prevent this, all threads are halted.
There is no question that the Garbage Collector provides a valuable service, but there is no way to schedule or control when it will run. This means that the execution of managed code might be inconsistent.
Best real-time support
The recommendation to use Win32 for real-time support is related to its support of the fastest executables. At its core, real-time processing demands both a correct algorithm and a timely algorithm. Real-time handling is used for data collection, as well as control for devices as varied as robots in a manufacturing arena or mice and keyboards used for input.
Real-time support means more than just doing things as fast as possible.
Windows CE real-time support provides a guarantee of consistency for the highest-priority thread in the system and for the highest-priority interrupt handler. Windows CE supports 256 thread priorities. It also provides the ability to manipulate the scheduling quantum of individual threads.
As described earlier, the Garbage Collector requires all managed threads to halt. But threads running in native code can continue running even when the Garbage Collector is running. If such threads return to managed code while the Garbage Collector is running, they are blocked until the Garbage Collector is finished. This means that a Win32 thread running native code can co-exist peacefully with managed code.
Source code portability
Both Win32 and .NET Compact Framework applications provide a degree of portability: Win32 provides source-code portability, and the .NET Compact Framework provides binary portability. Win32 portability makes some source code to run on a wide range of Windows CE platforms possible, even on platforms without the .NET Compact Framework runtime. The limitations on Win32 executables is that they rely on having the necessary Win32 functions and are CPU-dependent.
Windows CE is a highly configurable operating system. This means that the set of Win32 functions supported on one platform might not match the set of Win32 functions on a second platform. Even when using the Win32 API, getting the portability to a broad range of platforms requires some diligence.
Ability to create device drivers
All device drivers should be written using Win32. Some of the reasons have already been mentioned: size, speed, real-time support, and portability to the broadest range of platforms.
3.4.2 .NET Compact Framework
Whereas Win32 is good at creating low-level code for device and operating system support, the .NET Compact Framework is good for interacting at a high level. It is best suited for building an application with a user interface that collects data, stores it in a local database, and, from time to time, forwards that data to a server-based database.
As mentioned earlier, Win32 code is referred to as unmanaged code and .NET code is called managed code. The term "managed code" refers to the fact that the Common Language Runtime (CLR), which might also be called the
"code manager," provides several assurances for such code:
Managed code cannot have bad pointers.
Managed code cannot create memory leaks.
Managed code supports strong type-safety.
The following are some conditions to use .NET Compact Framework:
Using platforms that have the .NET Compact Framework
To be able to run .NET Compact Framework applications, platforms must support the .NET Compact Framework runtime. A second requirement for running .NET Compact Framework applications is that platforms must support a sufficient subset of the Win32 API, the foundation on which the .NET Compact Framework was built. The set of Win32 APIs that are required to support .NET Compact Framework must be present. .NET Compact Framework cannot run on headless Windows CE.NET-based platforms, which include Media Appliance, and Residential Gateway. To run the .NET Compact Framework, a Windows CE .NET platform must have a display screen.
Building user interfaces
The .NET Compact Framework does a very good job of building a user