debugging and fixing errors in published instrument

37
"Debugging and Fixing Errors in Published Instrument Drivers" Brad Hull Electrical Test Engineer

Upload: bradford-hull

Post on 27-Jan-2017

119 views

Category:

Documents


0 download

TRANSCRIPT

"Debugging and Fixing Errors in Published Instrument Drivers"

"Debugging and Fixing Errors in Published Instrument Drivers"Brad HullElectrical Test Engineer

Quartzdyne introduction is on next slide1

IntroductionBrad Hull Electrical Test Engineer, QuartzdyneQuartzdyne designs, develops, and manufactures the industry-standard resonating quartz pressure transducers for thedownholeoil and gas industryPurposeShare experiences working with NI Certified Instrument DriverBrief Introduction to IO TraceUsage of Semaphores

Point out I am a CLAD, will be CLD by end of year. Ask audience to feel free to correct if they notice errors or inaccuracies.2

The TaskEvaluation of pressure sensors required automatic cycling of hydraulic pressure with a Fluke PPCH Pressure controllerController had previously been cycled with a MATLAB script. Design engineer wanted to move pressure control over to LabVIEW

Goal is to eventually move both pressure cycling and data logging over to LV3

Pressure ControllerVendor DH Instruments (Fluke)Model PPCH-140M

Instrument is relatively new4

Slide 5/37 check time 5 minutes5

This is the unit NI actually tested the code with7

Instrument Driver Main VI Front Panel

8

Main VI Block Diagram

Red box animation time to look at the initialize block diagram9

Initialize.vi Block Diagram

First Discrepency

Slide 10/37, check time 11 minutes

First bump - Time to look at the serial configuration10

First Discrepency Front Panel

RS-232 Data Bits*The number of data bits in each character can be:5 - Baudot code (Predates ASCII)6 - Rarely used7 - For true (teletype) ASCII8 - For most kinds of data, as this size matches the size of a byte. Almost universally used in newer applications9 - Rarely used5 or 7 bits generally only make sense with older equipment such as teleprinters.

*From Wikipedia

Initialize.vi Block Diagram

Second Discrepency

Time to look at the second discrepency with IDN Being blank13

Second Discrepancy

Instrument Identification

15/37 Check time 16 minutes15

Standard Commands for Programmable Instruments (IEEE 488.2)*IDN? Is an IEEE 488.2 mandated commandIEEE 488.2 is purposefully vague about the content of each of the four fields in the response syntax.Research indicates this is not a user configurable data entry. It is unknown why the instrument had an inadequate response

Does anyone know if IDN is configurable?16

Initialize.vi Block Diagram

Third Discrepency

Third discrepancy with error query VI17

Third Discrepancy

Fault induced regardless of T/F case structure due to Error Query VI executing in both cases

Reset.vi Block Diagram

Default Block Diagram

20/37 check time - 22 minutes20

Default Commands and Responses

Instrument responds with each command

Error Query

Error Query.VI Block Diagram

Error Query.vi (If Error)

Case executes only if error is present

24

Error Query.vi (If No Error)

In the case of no error, the case structure simply passes through

Check time 27 minutes25

Error Query.VI

Next segment of VI

Source of Issue

Instrument IO buffer is not cleared of previous messagesVisa Read executes, parses buffer and outputs first string prior to line feed.VI executes error present case and generates error codeLabVIEW automatic error handling suspends executionTest execution of VI by itself on instrument had no errors

Potential SolutionsClear instrument IO bufferRegular expression matching for OK string

NI IO TraceNI I/O Trace is a utility that allows you to see what VISA driver calls are being made, the parameters passed to the VISA driver calls, and the resultsIt can be extremely useful in tracking down the nature of errors during comms with instruments

NI IO Trace

30/37 check time 33 mins30

Use of SemaphoresA semaphore is a variable or abstract data type that is used for controlling access, by multiple processes, to a common resource in a parallel programming or a multi user environment.

Implementation

Usage caseState machine created to cycle PPCH pressure controllerPPCH cycles to high pressure (5kPSI), soaks and cycles to low pressure (50PSI)First Loop sets pressure, and takes care of soakSecond loop is reading pressure from controller once per second and displaying it on UIIf attempt was made to read pressure while state machine was attempting to set a new pressure, an error would occur

Pressure Read Loop

Set Pressure Loop

The End