Real World Instrumentation with Python. Automated Data Acquisition and Control Systems - Helion
ISBN: 978-14-493-9663-3
stron: 624, Format: ebook
Data wydania: 2010-11-15
Księgarnia: Helion
Cena książki: 160,65 zł (poprzednio: 186,80 zł)
Oszczędzasz: 14% (-26,15 zł)
Learn how to develop your own applications to monitor or control instrumentation hardware. Whether you need to acquire data from a device or automate its functions, this practical book shows you how to use Python's rapid development capabilities to build interfaces that include everything from software to wiring. You get step-by-step instructions, clear examples, and hands-on tips for interfacing a PC to a variety of devices.
Use the book's hardware survey to identify the interface type for your particular device, and then follow detailed examples to develop an interface with Python and C. Organized by interface type, data processing activities, and user interface implementations, this book is for anyone who works with instrumentation, robotics, data acquisition, or process control.
- Understand how to define the scope of an application and determine the algorithms necessary, and why it's important
- Learn how to use industry-standard interfaces such as RS-232, RS-485, and GPIB
- Create low-level extension modules in C to interface Python with a variety of hardware and test instruments
- Explore the console, curses, TkInter, and wxPython for graphical and text-based user interfaces
- Use open source software tools and libraries to reduce costs and avoid implementing functionality from scratch
Osoby które kupowały "Real World Instrumentation with Python. Automated Data Acquisition and Control Systems", wybierały także:
- GraphQL. Kurs video. Buduj nowoczesne API w Pythonie 169,00 zł, (50,70 zł -70%)
- Receptura na Python. Kurs Video. 54 praktyczne porady dla programist 199,00 zł, (59,70 zł -70%)
- Podstawy Pythona z Minecraftem. Kurs video. Piszemy pierwsze skrypty 149,00 zł, (44,70 zł -70%)
- Twórz gry w Pythonie. Kurs video. Poznaj bibliotekę PyGame 249,00 zł, (74,70 zł -70%)
- Data Science w Pythonie. Kurs video. Algorytmy uczenia maszynowego 199,00 zł, (59,70 zł -70%)
Spis treści
Real World Instrumentation with Python. Automated Data Acquisition and Control Systems eBook -- spis treści
- Real World Instrumentation with Python
- SPECIAL OFFER: Upgrade this ebook with OReilly
- A Note Regarding Supplemental Files
- Preface
- Who Is This Book For?
- The Programming Languages
- Why Python?
- The Systems
- Methodology
- How This Book Is Organized
- Conventions Used in This Book
- Using Code Examples
- Safari Books Online
- How to Contact Us
- Acknowledgments
- 1. Introduction to Instrumentation
- Data Acquisition
- Control Output
- Open-Loop Control
- Closed-Loop Control
- Sequential Control
- Applications Overview
- Electronics Test Instrumentation
- Laboratory Instrumentation
- Process Control
- Summary
- 2. Essential Electronics
- Electrical Charge
- Electric Current
- Basic Circuit Theory
- Circuit Schematics
- DC Circuit Characteristics
- Ohms Law
- Sinking and Sourcing
- More About Resistors
- AC Circuits
- Sine Waves
- Capacitors
- Inductors
- Other Waveforms: Square, Ramp, Triangle, Pulse
- Interfaces
- Discrete Digital I/O
- Analog I/O
- Acquiring analog data
- Generating analog data
- Counters and Timers
- PWM
- Serial I/O
- Parallel I/O
- Summary
- Suggested Reading
- 3. The Python Programming Language
- Installing Python
- The Python Programming Language
- The Python Command Line
- Command-Line Options and Environment
- Objects in Python
- Data Types in Python
- Numeric data as objects
- Sequence objects
- Lists
- Strings
- Tuples
- Mapped objectsdictionaries
- Expressions
- Operators
- Arithmetic operators
- Logical operators
- Comparison operators
- Bitwise operators
- Assignment operators
- Membership operators
- Identity operators
- Operator precedence
- Statements
- Indentation
- Comments
- Keywords
- Simple statements
- assert
- Assignment
- Augmented assignment
- pass
- return
- break
- continue
- global
- Compound statements
- The if statement
- The while statement
- The for statement
- The try statement
- Strings
- String quotes
- String methods
- String formatting
- Program Organization
- Scope
- Local scope
- Global scope
- Built-in scope
- Modules and packages
- Functions, classes, and methods
- Docstrings
- Scope
- Importing Modules
- Import methods
- Import processing
- Cyclic imports
- Loading and Running a Python Program
- Basic Input and Output
- User input
- Command-line parameters
- Files
- Console output using print
- Redirecting print
- Hints and Tips
- Module global variables
- Latent defects
- Deferred imports
- Dictionaries as function parameters
- Function return values
- Think of modules as objects
- Use docstrings and descriptive comments
- Coding style
- Python Development Tools
- Editors and IDEs
- Editors
- IDE tools
- Debuggers
- Editors and IDEs
- Summary
- Suggested Reading
- 4. The C Programming Language
- Installing C
- Developing Software in C
- A Simple C Program
- Preprocessor Directives
- #include
- #define
- Standard Data Types
- User-Defined Types
- Operators
- Arithmetic operators
- Unary operators
- Assignment and augmented assignment operators
- Comparison operators
- Logical operators
- Bitwise operators
- Operator precedence
- Expressions
- Statements
- if-else statement
- switch statement
- while loop
- do-while loop
- for loop
- break statement
- continue statement
- goto statement
- Arrays and Pointers
- Arrays
- Pointers
- Structures
- Functions
- Function syntax
- Function prototypes
- The Standard Library
- Building C Programs
- Header files
- Object files
- Libraries
- Linking
- make
- C Language Wrap-Up
- C Development Tools
- Summary
- Suggested Reading
- 5. Python Extensions
- Creating Python Extensions in C
- Pythons C Extension API
- Extension Source Module Organization
- Python API Types and Functions
- The Method Table
- Method Flags
- METH_VARARGS example
- METH_KEYWORDS example
- METH_NOARGS example
- Passing Data
- Using the Python C Extension API
- Generic Discrete I/O API
- Generic Wrapper Example
- Calling the Extension
- Pythons ctypes Foreign Function Library
- Loading External DLLs with ctypes
- Basic Data Types in ctypes
- Using ctypes
- Summary
- Suggested Reading
- 6. Hardware: Tools and Supplies
- The Essentials
- Hand Tools
- Be kind to your tools
- Where to purchase tools
- Digital Multimeter
- DMM resolution
- DMM usage tips
- Soldering Tools
- Nice-to-Have Tools
- Hand Tools
- Advanced Tools
- The Oscilloscope
- Logic Analyzers
- Test Equipment Caveats
- Supplies
- New Versus Used
- Summary
- Suggested Reading
- The Essentials
- 7. Physical Interfaces
- Connectors
- DB-Type Connectors
- USB Connectors
- Circular Connectors
- Terminal Blocks
- Wiring
- Soldering
- Crimping
- Wiring caveats
- Connector Failures
- Serial Interfaces
- RS-232/EIA-232
- RS-232 data formats
- RS-232 signals
- DTE and DCE
- RS-485/EIA-485
- RS-485 signals
- Line drivers and receivers
- RS-485 multi-drop
- RS-232 versus RS-485
- USB
- USB classes
- USB data rates
- USB instrumentation
- Windows Virtual Serial Ports
- RS-232/EIA-232
- GPIB/IEEE-488
- GPIB/IEEE-488 Signals
- GPIB Connections
- GPIB via USB
- PC Bus Interface Hardware
- Pros and Cons of Bus-Based Interfaces
- Data Acquisition Cards
- GPIB Interface Cards
- Old Doesnt Mean Bad
- Summary
- Suggested Reading
- Connectors
- 8. Getting Started
- Defining the Project
- Requirements-Driven Design
- Stating the Need
- Project Objectives
- Requirements
- Why Requirements Matter
- Well-Formed Requirements
- The Big Picture
- Requirement Types
- Use Cases
- Traceability
- Capturing Requirements
- Designing the Software
- The Software Design Description
- Graphics in the SDD
- Block diagrams
- Flowcharts
- State diagrams
- Message sequence charts
- Pseudocode
- Divide and Conquer
- Handling Errors and Faults
- Identifying potential failures
- Failure responses
- Functional Testing
- Testing to the Requirements
- Test Cases
- Testing Error Handling
- Regression Testing
- Tracking Progress
- Implementation
- Coding Styles
- Why coding style is important
- Adopting existing coding style guidelines
- Organizing Your Code
- Code Reviews
- Unit Testing
- Defining a unit test
- Implementing unit tests
- assert versus assertEqual() and friends
- Code coverage
- Connecting to the Hardware
- Documenting Your Software
- Version Control
- Defect Tracking
- Coding Styles
- User Documentation
- Summary
- Suggested Reading
- Defining the Project
- 9. Control System Concepts
- Basic Control Systems Theory
- Linear Control Systems
- Nonlinear Control Systems
- Sequential Control Systems
- Terminology and Symbols
- Control System Block Diagrams
- Input-output relationships
- Feedback
- Transfer Functions
- Time and Frequency
- Time and frequency domains
- Time and control systems behavior
- Discrete-time control systems
- Control System Types
- Open-Loop Control
- Closed-Loop Control
- Controlling positionBasic feedback
- Controlling velocityFeed-forward and PWM controllers
- Nonlinear Control: Bang-Bang Controllers
- Sequential Control Systems
- Proportional, PI, and PID Controls
- Off-the-shelf controllers versus software implementation
- PID overview
- The proportional control term
- PI and PID controls
- Hybrid Control Systems
- Implementing Control Systems in Python
- Linear Proportional Controller
- Bang-Bang Controller
- Simple PID Controller
- Summary
- Suggested Reading
- Basic Control Systems Theory
- 10. Building and Using Simulators
- What Is Simulation?
- Low Fidelity or High Fidelity
- Simulating Errors and Faults
- Interface faults
- System faults
- Using Python to Create a Simulator
- Package and Module Organization
- Data I/O Simulator
- DevSim internals
- DevSim methods
- Some simple examples
- User-defined functions
- Cyclic functions
- Noise
- AC Power Controller Simulator
- The SPC model
- The SPC serial interface and virtual serial ports
- Communicating with SPC
- The SPC command set
- Command descriptions
- SPC simulator internals
- Configuring the SPC
- Interacting with the SPC simulator
- Serial Terminal Emulators
- Using Terminal Emulator Scripts
- Displaying Simulation Data
- gnuplot
- Installing gnuplot on Windows
- Using gnuplot
- Method 1: Using Pythons popen() method
- Method 2: gnuplot.py
- Testing gnuplot.py
- Using gnuplot.py
- Plotting Simulator Data with gnuplot
- gnuplot
- Creating Your Own Simulators
- Justifying a Simulator
- The Simulation Scope
- Time and Effort
- Summary
- Suggested Reading
- What Is Simulation?
- 11. Instrumentation Data I/O
- Data I/O Interface Software
- Interface Formats and Protocols
- IVIInterchangeable Virtual Instrument
- IVI-compliant drivers
- VISAVirtual Instrument Software Architecture
- SCPIStandard Commands for Programmable Instruments
- Unique protocols
- IVIInterchangeable Virtual Instrument
- Python Interface Support Packages
- pySerial
- pyParallel
- PyVISA
- Alternatives for Windows
- Using Bus-Based Hardware I/O Devices with Linux
- The Comedi project
- Comedi hardware support
- Using comedi with Python
- Interface Formats and Protocols
- Data I/O: Acquiring and Writing Data
- Basic Data I/O
- Reading data
- Writing data
- Blocking Versus Nonblocking Calls
- Data I/O Methods
- On-demand data I/O
- Polled data I/O
- Acquiring data using a thread
- Handling Data I/O Errors
- Classes of errors
- Error retry and system termination
- Error/warning message single-shot logic
- Handling Inconsistent Data
- Waiting for stability
- Dealing with noise: Averaging
- Basic Data I/O
- Summary
- Suggested Reading
- Data I/O Interface Software
- 12. Reading and Writing Data Files
- ASCII Data Files
- The Original ASCII Character Set
- Pythons ASCII Character-Handling Methods
- Reading and Writing ASCII Flat Files
- Records
- Writing ASCII data files
- Reading ASCII data files
- CSV files
- Configuration Data
- Basic configuration file organization
- Using configuration files
- Module AutoConvert.pyAutomatic String Conversion
- Module FileUtils.pyASCII Data File I/O Utilities
- Binary Data Files
- Flat Binary Data Files
- Handling Binary Data in Python
- Using the ctypes module to handle structured binary data
- Using struct to handle structured binary data
- Image Data
- PGM
- PGM file structure
- Summary
- Suggested Reading
- ASCII Data Files
- 13. User Interfaces
- Text-Based Interfaces
- The Console
- Example console display
- Reading user input
- OS-specific console I/O
- Linux and Windows text display differences
- Using Pythons msvcrt library module
- ANSI Display Control Techniques
- ANSI and Windows
- Basic ANSI control sequences
- The SimpleANSI library
- Using SimpleANSI
- Python and curses
- curses background
- Pythons curses library module
- A simple data display using curses
- Adding a subwindow
- To Curse or Not to Curse, Is That the Question?
- The Console
- Graphical User Interfaces
- Some GUI Background and Concepts
- Using a GUI with Python
- GUI objects
- Basic GUI display structure
- GUI functionality
- The GUI main loop
- TkInter
- Planning your GUI
- Geometry management
- Simple TkInter example
- Tools and resources for TkInter
- wxPython
- Designing a wxPython GUI
- Building a simple wxPython GUI
- Tools and resources for wxPython
- Summary
- Suggested Reading
- Text-Based Interfaces
- 14. Real World Examples
- Serial Interfaces
- Simple DMM Data Capture
- Serial Interface Discrete and Analog Data I/O Devices
- Serial Interfaces and Speed Considerations
- USB Example: The LabJack U3
- LabJack Connections
- Installing a LabJack Device
- LabJack on Windows
- LabJack on Linux
- LabJack and Python
- Installing and testing LabJackPython
- LabJack driver structure
- U3 configuration
- Using the Python interface with the getFeedback() method
- Summary
- Suggested Reading
- Serial Interfaces
- A. Free and Open Source Software Resources
- B. Instrument Sources
- Manufacturers
- Used Test Equipment Sources
- Manuals
- Index
- About the Author
- Colophon
- SPECIAL OFFER: Upgrade this ebook with OReilly