Sifos Technologies PowerSync PDA-300 Reference Manual

Sifos Technologies PowerSync PDA-300 Reference Manual

Device analyzer api library
Hide thumbs Also See for PowerSync PDA-300:

Advertisement

Quick Links

PDA-300 API Library Reference Manual
Sifos Technologies
PowerSync
Device Analyzer
PDA-300
API Library Reference
Manual
Version 3.3
Revised October 4, 2012
Copyright © 2012 Sifos Technologies
October 4, 2012
Sifos Technologies
page
1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PowerSync PDA-300 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Sifos Technologies PowerSync PDA-300

  • Page 1 PDA-300 API Library Reference Manual Sifos Technologies PowerSync Device Analyzer  PDA-300 API Library Reference Manual Version 3.3 Revised October 4, 2012 Copyright © 2012 Sifos Technologies October 4, 2012 Sifos Technologies page...
  • Page 2 (978) 640-4990 FAX Disclaimer The information contained in this manual is the property of Sifos Technologies, Inc., and is furnished for use by recipient only for the purpose stated in the Software License Agreement accompanying the user documentation. Except as permitted by such License Agreement, no part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, without the prior written permission of Sifos Technologies, Inc.
  • Page 3: Table Of Contents

    VB6 Compatible Declarations ..........................28 3.2. Visual Basic .NET................................ 30 3.2.1. Type Differences ..............................30 3.2.2. Enumerations ............................... 30 3.2.3. Service Functions ..............................30 3.2.4. VB .NET Compatible Declarations ........................30 3.3. LabView ..................................31 October 4, 2012 Sifos Technologies page...
  • Page 4 PDA-300 API Example Code ......................32 4.1. C Code Example ................................. 32 4.2. Visual Basic 6 Code Example ............................ 39 4.3. Visual Basic .NET Code Example ..........................40 4.4. LabView Code Example .............................. 46 October 4, 2012 Sifos Technologies page...
  • Page 5: Introduction

    1.1. PDA-300 API Library Introduction The Sifos Technologies PDA-300 Powered Device Analyzer is a test instrument designed to 1) assure interoperability of a Powered Device (PD) under the IEEE 802.3at standard, and 2) build confidence that PD’s are properly specified for purposes of classification and mutual identification with PSE’s.
  • Page 6: Installation

    Section 3 of this manual contains information related to using the PDA-300 API with different languages. Section 4 of this manual contains example code showing how to call functions in the PDA-300 API library. October 4, 2012 Sifos Technologies page...
  • Page 7: Pda-300 Api Function Definitions

    Table 2 Instrument Operation Functions pda300_MeasRdet pda300_MeasCdet pda300_MeasClass pda300_SetVportState pda300_GetVportState pda300_MeasPowerDraw pda300_AdjustVportLevel pda300_StartTraceCapture 2.1. Calling Convention On Microsoft Windows platforms, the calling convention required to call the API functions is __stdcall. October 4, 2012 Sifos Technologies page...
  • Page 8: Error Handling

    A user developed application program should always test the status returned by an API function. When an API function returns a status other than PDA300_NO_ERROR, the calling application can call the API function pda300_GetErrMessage to retrieve a message string associated with that error. October 4, 2012 Sifos Technologies page...
  • Page 9: Enumerations

    _pda300ClassEvents { ONE_EVENT = 1, TWO_EVENTS = 2 }; typedef enum _pda300ClassEvents pda300ClassEvents; enum _pda300VportState { VPORT_OFF = 0, VPORT_ON = 1 }; typedef enum _pda300VportState pda300VportState; enum _pda300Quadrants { ONE_QUADRANT = 1, FOUR_QUADRANTS = 2 }; typedef enum _pda300Quadrants pda300Quadrants; October 4, 2012 Sifos Technologies page...
  • Page 10: Functions

    The error 5 indicates that the Windows operating system returned the error ERROR_ACCESS_DENIED. returns: PDA300_NO_ERROR | PDA300_SERIAL_COMM_ERROR | PDA300_NULL_POINTER | PDA300_INVALID_FW_VERSION If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; status = pda300_Connect(“COM4”); October 4, 2012 Sifos Technologies page...
  • Page 11: Pda300_Disconnect

    NOTE: no I/O is performed when this function is executed. prototype: int pda300_GetHardwareVer(void); parameters: none. returns: an integer number, for example 2. example: int hwVersion; hwVersion = pda300_GetHarwareVer (); October 4, 2012 Sifos Technologies page...
  • Page 12: Pda300_Setalt

    For any language that does not support enumerations, the pointer passed in should refer to a 4-byte (32-bit) integer storage location. returns: PDA300_NO_ERROR | PDA300_NULL_POINTER If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; pda300AltSetting Setting; status = pda300_GetAlt (&Setting); October 4, 2012 Sifos Technologies page...
  • Page 13: Pda300_Setmdi

    For any language that does not support enumerations, the pointer passed in should refer to a 4-byte (32-bit) integer storage location. returns: PDA300_NO_ERROR | PDA300_NULL_POINTER If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; pda300MdiSetting Setting; status = pda300_GetMdi (&Setting); October 4, 2012 Sifos Technologies page...
  • Page 14: Pda300_Setevents

    For any language that does not support enumerations, the pointer passed in should refer to a 4-byte (32-bit) integer storage location. returns: PDA300_NO_ERROR | PDA300_NULL_POINTER If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; pda300ClassEvents Setting; status = pda300_GetEvents (&Setting); October 4, 2012 Sifos Technologies page...
  • Page 15: Pda300_Setvportlevel

    For languages other than C/C++, the storage space pointed to should represent a 4 byte (32-bit) integer. returns: PDA300_NO_ERROR | PDA300_NULL_POINTER If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; int Voltage; status = pda300_GetVportLevel (&Voltage); October 4, 2012 Sifos Technologies page...
  • Page 16: Pda300_Measrdet

    With the wire pairs shorted together, the value 00.00k. returns: PDA300_NO_ERROR | PDA300_SERIAL_COMM_ERROR | PDA300_NULL_POINTER If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; float Rdet; status = pda300_MeasRdet (&Rdet); October 4, 2012 Sifos Technologies page...
  • Page 17: Pda300_Meascdet

    With the wire pairs shorted together, the value 99.999uF. returns: PDA300_NO_ERROR | PDA300_SERIAL_COMM_ERROR | PDA300_NULL_POINTER If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; float Cdet; status = pda300_MeasCdet (&Cdet); October 4, 2012 Sifos Technologies page...
  • Page 18: Pda300_Measclass

    PDA300_NO_ERROR | PDA300_SERIAL_COMM_ERROR | PDA300_INVALID_ICLASS | PDA300_NULL_POINTER If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: float Iclass; int Class, Status; status = pda300_MeasClass (&Iclass, &Class); October 4, 2012 Sifos Technologies page...
  • Page 19: Pda300_Setvportstate

    PDA300_NO_ERROR | PDA300_SERIAL_COMM_ERROR | PDA300_NULL_POINTER If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; pda300VportState State; status = pda300_GetVportState (&State); October 4, 2012 Sifos Technologies page...
  • Page 20: Pda300_Adjustvportlevel

    For languages other than C/C++, the Voltage must be passed as a 4-byte (32-bit) value. returns: PDA300_NO_ERROR | PDA300_SERIAL_COMM_ERROR | PDA300_INVALID_PARAMETER_VALUE | PDA300_VPORT_NOT_ENABLED If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; status = pda300_AdjustVportLevel(51); October 4, 2012 Sifos Technologies page...
  • Page 21: Pda300_Measpowerdraw

    PDA300_NO_ERROR | PDA300_SERIAL_COMM_ERROR | PDA300_INVALID_ICLASS | PDA300_NULL_POINTER If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; float Iload; float Pload; status = pda300_MeasPowerDraw (&Iload, &Pload); October 4, 2012 Sifos Technologies page...
  • Page 22: Pda300_Starttracecapture

    PDA300_NO_ERROR | PDA300_NULL_POINTER | PDA300_FILE_ERROR | PDA300_TRACE_ERROR | PDA300_FAST_SAMPLE_RUNNING If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; status = pda300_StartTraceCapture (“/temp/pd_trace.csv”); October 4, 2012 Sifos Technologies page...
  • Page 23: Pda300_Stoptracecapture

    PDA300_NO_ERROR | PDA300_NULL_POINTER | PDA300_FILE_ERROR | PDA300_TRACE_ERROR | PDA300_FAST_SAMPLE_NOT_RUNNING If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; status = pda300_StopTraceCapture ( ); October 4, 2012 Sifos Technologies page...
  • Page 24: Pda300_Run802Dot3Attest

    PDA300_NO_ERROR | PDA300_NULL_POINTER | PDA300_FILE_ERROR | PDA300_FAST_SAMPLE_RUNNING | PDA300_TEST_NEVER_COMPLETED If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; status = pda300_Run802dot3ATtest (ONE_QUADRANT, “/temp/oneQuad.csv”); October 4, 2012 Sifos Technologies page...
  • Page 25: Pda300_Geterrmessage

    If the length is not specific accurately, unexpected behavior, such as a fatal error, may occur in the calling process. returns: PDA300_NO_ERROR | PDA300_NULL_POINTER example: #define LENGTH_ERR_MSG 256 int status; char ErrMsg[LENGTH_ERR_MSG]; status = pda300_GetErrMessage (&ErrMsg[0], LENGTH_ERR_MSG); October 4, 2012 Sifos Technologies page...
  • Page 26: Pda300_Setdebugpath

    ‘\0’, which is 0x00). returns: PDA300_NO_ERROR | PDA300_NULL_POINTER | PDA300_FILE_ERROR If an error is returned, the function pda300_GetErrMessage can be called to retrieve a related error message. example: int status; status = pda300_SetDebugPath (“/temp/debug.txt”); October 4, 2012 Sifos Technologies page...
  • Page 27: Pda300_Debugfilewrite

    - timeout used when changing menu contexts, value in msec. Value must be > 0. int measTimeout - timeout used when performing measurements, value in msec. Value must be > 0. returns: PDA300_NO_ERROR | PDA300_INVALID_PARAMETER_VALUE example: int status; status = pda300_SetTimeout (1500, 4500); October 4, 2012 Sifos Technologies page...
  • Page 28: Pda-300 Api Library Definitions For Other Languages

    API library. These strings are passed “ByVal”, even though they are being written to by the underlying library functions. For example, this function accepts strings as inputs, but does not write to those strings: October 4, 2012 Sifos Technologies page...
  • Page 29 Declare Function pda300_SetAlt Lib "pda300API.dll" (ByVal Setting As pda300AltSetting) As Long This function writes a value to the enumeration variable passed by reference: Declare Function pda300_GetAlt Lib "pda300API.dll" (ByRef Setting As pda300AltSetting) As Long October 4, 2012 Sifos Technologies page...
  • Page 30: Visual Basic .Net

    This function writes characters to the string that is passed in: Declare Function pda300_GetErrMessage Lib "pda300API.dll" (ByVal Buf As System.Text.StringBuilder, ByVal LenBuf As Integer) As Integer This function reads the value to the enumeration variable passed by value: October 4, 2012 Sifos Technologies page...
  • Page 31: Labview

    The VIs were re-worked to include Error In and Error Out clusters, which allow for easier inclusion in a LabView program, providing the necessary sequence control to insure the order of execution. The new form VIs are provided in the directory \API_Files\LabView\ Error_In_Error_Out_form. NOTE: these VIs were created with LabView 8.20. October 4, 2012 Sifos Technologies page...
  • Page 32: Pda-300 Api Example Code

    //Running the built-in 802.3at test - one quadrant //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //One quadrant 802.3at test results stored in /temp/oneQuadrantResults.csv //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //Running the built-in 802.3at test - four quadrants //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //Four quadrant 802.3at test results stored in /temp/fourQuadrantResults.csv //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% October 4, 2012 Sifos Technologies page...
  • Page 33 // cannot communicate with the instrument. // Define the ALT setting iRtn = pda300_SetAlt(ALT_B); checkRtn(iRtn); // Interrogate the library to check the ALT setting iRtn = pda300_GetAlt(&eAlt); checkRtn(iRtn); if (eAlt == ALT_A) printf ("ALT is set to ALT-A\n"); October 4, 2012 Sifos Technologies page...
  • Page 34 // powering on the PD, if an irrational Rdet is measured. // Measure Cdet iRtn = pda300_MeasCdet (&Cdet); checkRtn(iRtn); if (Cdet < 0.09 || Cdet > 0.15) printf("Cdet: %f uF is out of range\n", Cdet); October 4, 2012 Sifos Technologies page...
  • Page 35 Vport %d V, PD is drawing: %f mA and consuming: %f W\n", iVport, Iload, Pload); printf("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); printf("Removing Power, changing Alt and Polarity\n"); printf("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); // Remove power iRtn = pda300_SetVportState (VPORT_OFF); checkRtn(iRtn); // Change settings iRtn = pda300_SetAlt(ALT_A); checkRtn(iRtn); iRtn = pda300_SetMdi(MDI); October 4, 2012 Sifos Technologies page...
  • Page 36 // Measure the current demand and power consumed by the PD iRtn = pda300_MeasPowerDraw (&Iload, &Pload); checkRtn(iRtn); printf("With Vport %d V, PD is drawing: %f mA and consuming: %f W\n", iVport, Iload, Pload); printf("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); printf("Performing a 10 second trace capture\n"); printf("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); October 4, 2012 Sifos Technologies page...
  • Page 37 // Close the connection to the instrument, re-enabling the front panel iRtn = pda300_Disconnect(); checkRtn(iRtn); return 0; void checkRtn (int iRtn) int iDisplayErrorMsg = 1; char *pszMsg; char szErrMsg[LENGTH_PDA300_ERROR_BUF]; switch (iRtn) October 4, 2012 Sifos Technologies page...
  • Page 38 PDA300_TRACE_FILE_FORMAT_ERROR: pszMsg = "iRtn: PDA300_TRACE_FILE_FORMAT_ERROR"; break; case PDA300_TEST_NEVER_COMPLETED: pszMsg = "iRtn: PDA300_TEST_NEVER_COMPLETED"; break; default: printf("DEFAULT CASE: iRtn value: %d\n", iRtn); pszMsg = "iRtn: UNRECOGNIZED"; break; if (iDisplayErrorMsg == 1) pda300_GetErrMessage(szErrMsg, LENGTH_PDA300_ERROR_BUF); printf("%s\n%s\n", pszMsg, szErrMsg); October 4, 2012 Sifos Technologies page...
  • Page 39: Visual Basic 6 Code Example

    Private Sub TestAPI() Dim iRtn As Long Dim eAltSetting As pda300AltSetting Dim strTest As String Dim strBuffer As String * LENGTH_PDA300_ERROR_BUF iRtn = pda300_SetAlt(pda300AltSetting.ALT_B) iRtn = pda300_GetAlt(eAltSetting) iRtn = pda300_GetErrMessage(strBuffer, LENGTH_PDA300_ERROR_BUF) strTest = TrimAPIString(strBuffer) End Sub October 4, 2012 Sifos Technologies page...
  • Page 40: Visual Basic .Net Code Example

    'Running the built-in 802.3at test - one quadrant '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 'One quadrant 802.3at test results stored in /temp/oneQuadrantResults.csv '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 'Running the built-in 802.3at test - four quadrants '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 'Four quadrant 802.3at test results stored in /temp/fourQuadrantResults.csv '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 'Done! '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% October 4, 2012 Sifos Technologies page...
  • Page 41 ' Define the polarity setting iRtn = pda300_SetMdi(pda300MdiSetting.MDIX) checkRtn(iRtn) ' Interrogate the library to check the polarity setting iRtn = pda300_GetMdi(eMDI) checkRtn(iRtn) If (eMDI = pda300MdiSetting.MDI) Then Console.WriteLine("Polarity is set to MDI" + vbCrLf) October 4, 2012 Sifos Technologies page...
  • Page 42 Console.WriteLine("Invalid Iclass: " + Iclass.ToString + "mA cannot determine PD Class" + vbCrLf) Else Console.WriteLine("PD Class is: " + pdClass.ToString + ", measured Iclass: " + Iclass.ToString + "mA" + vbCrLf) End If Console.WriteLine("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" + vbcrlf) Console.WriteLine("Applying Power" + vbcrlf) Console.WriteLine("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" + vbcrlf) October 4, 2012 Sifos Technologies page...
  • Page 43 Console.WriteLine("Performing unpowered measurements" + vbcrlf) Console.WriteLine("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" + vbcrlf) ' Measure Rdet iRtn = pda300_MeasRdet(Rdet) checkRtn(iRtn) If (Rdet < 23.2 Or Rdet > 24.8) Then Console.WriteLine("Rdet: " + Rdet.ToString + "k is out of range" + vbCrLf) Else October 4, 2012 Sifos Technologies page...
  • Page 44 Console.WriteLine("Performing a 10 second trace capture" + vbcrlf) Console.WriteLine("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" + vbcrlf) ' Capture a 10 sec trace iRtn = pda300_StartTraceCapture(pszTraceFilePath) checkRtn(iRtn) ' loop for 10 seconds Delay = 1 While Delay <= 10 Delay = Delay + 1 October 4, 2012 Sifos Technologies page...
  • Page 45 Dim szErrMsg As System.Text.StringBuilder = New System.Text.StringBuilder(LENGTH_PDA300_ERROR_BUF) If iRtn = PDA300_NO_ERROR Then pszMsg = "" 'pszMsg = "iRtn: PDA300_NO_ERROR" 'Comment in to report Non-Errors ElseIf iRtn = PDA300_SERIAL_COMM_ERROR Then pszMsg = "iRtn: PDA300_SERIAL_COMM_ERROR" ElseIf iRtn = PDA300_INVALID_FW_VERSION Then October 4, 2012 Sifos Technologies page...
  • Page 46: Labview Code Example

    VIs error return, and modify application flow if an error occurs. It is expected that the user will use the VIs with the necessary flow control logic, as appropriate for their application. October 4, 2012 Sifos Technologies page...

Table of Contents