1 / 81

儀器電控

儀器電控. 陳彥穆 July 11, 2008. Outline. Computer-based Measurement Automation Design Flow A Comprehensive Overview & some history Labview Introduction Control Examples – Matlab Introduction Control Examples – Graphic User Interface Design Comparison Merits and Defects Hybrid.

felcia
Download Presentation

儀器電控

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 儀器電控 陳彥穆 July 11, 2008

  2. Outline • Computer-based Measurement Automation • Design Flow • A Comprehensive Overview & some history • Labview • Introduction • Control Examples – • Matlab • Introduction • Control Examples – Graphic User Interface Design • Comparison • Merits and Defects • Hybrid

  3. Instrument Control !? The abilities to • Write Write some bits or bytes to the instruments as commands • Read Read information or measured data from the instruments

  4. Instrument Control !? In order to do that, we require • Interface Physical connections between computers and instruments • Interface driver It tells computers how to interpret the data on the interface ( Protocols )

  5. Instrument Control !? and we still need • Command book The language of “the” instrument. We call a complete and well-capsulated command set as “Instrument Driver.” • Control Program combinations of commands to finish our job

  6. Why? • Save time and man power • Your instrument has no front panel (CAMAC VXI PXI)

  7. Part-I: Design Flow

  8. Measurement Automation • Design flow • Control Procedure The Control Flow Chart Problem Define Nature of Signal • Type? • Magnitude? • Duration? Instruments • Resolution? • Dynamic Range? • Field of View? • Instrument Interface Programming Language / Environment Programming • VB, C/C++, VC.Net, BCB… • Matlab • Labview Instrument Command Interface Drivers • Serial port driver • GPIB driver • USB driver • Instrument Command User Interface Testing

  9. Problem Define: The control flow chart A sample control flow chart

  10. Problem Define: Nature of signal • Type • Electro- voltage/current impedance • Photon wavelength • Magnitude • Duration

  11. Problem Define: Instruments • Resolution • Intensity • Time response of instrument • Dynamic Range • Intensity • Frequency • Field of View • Instrument Interface • Crate Instrument: CAMAC / VXI / PXI • GPIB / RS-232 / USB / IEEE1394 • PCI / ISA

  12. A real example: measure laser contrast automatically

  13. A real example-measure laser contrast automaticallyControl Flow Chart

  14. A real example-measure laser contrast automaticallyThe Instruments

  15. A real example-measure laser contrast automaticallyThe Instruments Increase dynamic range by filters, which can be changed by a stepping motor.

  16. Programming: Programming Language / environment • text-based languages • C/C++, VC.Net, BCB • Visual Basic • Matlab (Scientific environment) • graphical programming language • Labview

  17. Programming: Instrument Command / Interface Drivers • Interface Drivers • Serial port driver • GPIB driver • USB driver … • VISA(Virtual Instrument Software Architecture) • Instrument Command • SCPI (Standard Commands for Programmable Instrumentation) • VXI Plug&Play • IVI (Interchangeable Virtual Instrument) • Instrument specific command

  18. Part-II: History

  19. A Comprehensive Overview of Measurement Automation • CAMAC (Computer Automated Measurement And Control) A CAMAC “crate” CAMAC is an IEEE-standard (583), modular, high-performance, real-time data acquisition and control system concept born in 1969. 擷取自 http://www.kscorp.com Register-based command

  20. HP-IB becomes IEEE-488.1 standard SCPI Specification introduced for IEEE 488 instruments HP designs HP-IB for instrumentation systems IEEE 488.2 adopted IEEE 488.2 Standard revised 1965 1987 1990 1993 1975 A Comprehensive Overview of Measurement Automation • GPIB (General Purpose Interface Bus / IEEE-488) For monolithic instruments Text-based command

  21. A Comprehensive Overview of Measurement Automation • VXI (VME eXtensions for Instrumentation / IEEE-1155) 1987 Text-based / Register-based command 擷取自 Matlab Instrument Control Toolbox Help documents

  22. A Comprehensive Overview of Measurement Automation • Serial Port RS-232 COM1 very common on personal computers • Parallel Port printer port LPT

  23. Difficulties in developing a measurement automation system • Differences in all Instruments • every company has its own interface • every instrument has its own command • Different software support in different environments • Interface driver for UNIX / DOS / Window/ … • Instrument driver written in C/ Fortran/ Non-Interchangeable Time inefficient

  24. Computer Industry Standards (DDE, DLL, OLE, TCP/IP, etc.) Vendor A Application Software Environment Vendor B Test Executive Application Vendor C Instrument Programming Tool End Users Application Programs NI-488.2 API NI-VXI API Other API Other API VISA API A Comprehensive Overview of Measurement Automation • VISA (Virtual Instrument Software Architecture) Is a superset of all interface driver (from VXI plug&play)

  25. A Comprehensive Overview of Measurement Automation • VISA provides us a unified communication “channel” from your program to the instrument with any physical interface. VISA-GPIB, VISA-VXI, VISA-serial port, VISA-TCP/IP … • Same I/O function for open, send, read, query, close…, but not same command. • Now, The VISA specifications, formerly maintained by the VXI plug&play are now being maintained by the IVI.

  26. A Comprehensive Overview of Measurement Automation • IVI (Interchangeable Virtual Instrument) The IVI standards define an open driver architecture, a set of instrument classes, and shared software component.

  27. A Comprehensive Overview of Measurement Automation • Utilizing VISA to achieve interface I/O (other interface drivers are also available) • IVI defines several Instruments class to achieve same “command” ( just like SCPI) • DC power supply • Digital multimeter (DMM) • Function generator & Arb • Oscilloscope • Power meter • RF signal generator • Spectrum analyzer • Switch • The IVI Config server – for instrument interchangeability • Two instruments with different vendors, different interfaces (e.g. GPIB and USB) can be interchanged just in a few minutes.

  28. The Structure Software Application Most of the time, we start here…… IVI class driver Instrument driver GPIB/VXI/USB/serial… interface drivers Or just VISA VISA others Hardware Interface GPIB/CAMAC/VXI/USB interface Instrument Hardware

  29. Part-III: LabVIEW

  30. What is LabVIEW? LabVIEW (Laboratory Virtual Instrument Engineering Workbench) is a program development application, much like C or BASIC. However, other programming systems use text-based languages to create lines of code, while LabVIEW uses a graphical programming language, G, to create programs in block diagram form. Writing programs in Labview is just like building real instruments.

  31. Front Panel The GUI of your program VI : Virtual Instrument The front panel is the graphical user interface of your LabVIEW VI. This interface collects user input and displays program output. The front panel can contain knobs, push buttons, graphs, and other controls and indicators.

  32. Block Diagram The source code of your program The block diagram contains the graphical source code of your VI (Virtual Instrument). In the block diagram, you program your VI to control and perform functions on the inputs and outputs you created on the front panel. The block diagram can include functions and structures from the built-in LabVIEW VI libraries. It also can include terminals that are associated with controls and indicators created on the front panel.

  33. Front panel demo: a virtual instrument …\examples\apps\demos.llb\Two Channel Oscilloscope.vi

  34. Controls and indicators

  35. Palettes Functions Palette Controls Palette LabVIEW palettes give you the options you need to create and edit your front panel and block diagram. Tools Palette Front panel / Block diagram

  36. Data Flow LabVIEW VIs follow a dataflow model for program execution. The block diagram consists of nodes such as VIs, structures, and terminals from the front panel. These nodes are connected by wires, which define the flow of data through the program. The execution of a node occurs when all its inputs are available. When a node finishes executing, it releases all its outputs to the next node in the dataflow path.

  37. Arithmetic z = sqrt(abs(x)) + y; One may use a formula node:

  38. Boolean algebra D = A AND (B OR C) panel diagram

  39. Comparison and CASE structure if a > b then todo list 1…… else todo list 2…… end

  40. FOR loop LabVIEW diagram: C++ code: a=1; for (i=0, i<6, i++){ a=a+a*i; } Output = 720

  41. Sequence and While loop while loop sequence

  42. Graph and chart Example: plot a sine wave

  43. Mechanical Action Switch When Released Switch When Pressed Switch Until Released Latch Until Released Latch When Pressed Latch When Released

  44. RS-232 pin assignments PC serial port Output from computer Input to computer

  45. Remote control using RS-232 Some parameters to know before using the serial port 1. Port number: port number = 0 for COM1, 1 for COM2 2. Baud rate (or bits per sec, bps) 3. Data bits: number of bits in the incoming data 4. Number of stop bits 5. Parity bit? (None, Odd, Even) 6. Command characters used by the device Find parameters 2~6 from the manual of the device!

  46. RS-232 Serial character frame

  47. Serial Port VIs in (Labview 6.1 or older version) (Functions»Instrument I/O»Serial) Serial Port Init Initializes the selected serial port to the specified settings. Bytes at Serial Port Returns in byte count the number of bytes in the input buffer of the serial port indicated in port number.

  48. Serial Port VIs (Cont.) Serial Port Read Reads the number of characters specified by requested byte count from the serial port indicated in port number. Serial Port Write LabVIEW Function and VI Reference Manual 36-2 Writes the data in string to write to the serial port indicated in port number.

  49. VISA Serial Port VIs in (Labview 7.0 or later version) (Functions»Instrument I/O»Serial) VISA Serial Port Init Initializes the selected serial port to the specified settings. VISA Open Open the VISA channel according the VISA resource name VISA Close Close the VISA channel according the VISA resource name

More Related