Jump to content

russellb78

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by russellb78

  1. Thanks for the quick reply and that makes sense why some of the timing is close to zero. I will definitely go watch that video, I missed it at NI Week.  I moved all of the controls and indicators outside of the sequence structure, but it didn't change the result that the speed improvements are not there when the value array indicators are present.  I am still curious why this is the case?   

  2. 4 hours ago, hooovahh said:

    Because you're doing all the operations in parallel, this is a poor test and should be only doing one thing at a time.  Also you should disable debugging, and automatic error handling.  I also think your time is too small to measure well enough.  Maybe try a larger sample size.

    Here is a speed test I did on the writing of the new IPE and it shows improvements.

    https://forums.ni.com/t5/LabVIEW/Correct-way-of-using-the-Variant-Get-Replace-In-Place-Element/m-p/3334502#M978560

    Thanks for the feedback. By incorporating your feedback, I discovered that I got similar speed improvements to your speed test if I do not show the returned values as array indicators. If I showed the indicators the IPE and Get Variant Attribute were pretty similar if not the same.  I also discovered that if I don't show the array indicators or the variant as indicators then my test times were basically zero. Attached is my VI showing these behaviors.

     

    Lookup Table.vi

  3. Hello,

     

    I am trying to save a LV project created in LV 2012 to the previous version of LV 2010, but when I try to open the VIs in LV 2010 the data member access property nodes are broken and LV is unresponsive.  I can manually add a new property node and delete the old property, but LV is still unresponsive.  I wanted to see if anyone else has run into this issue.

     

    Thanks,

     

    Russell 

  4. Thanks for your response,

     

    I have tried hardcoding the path and passing it into the DLL. It is working properly from the LV project today and I did not change anything. I know when I get this error I have to shutdown LV and run the vendor's VB example program before the error is cleared.  There is something strange with the way this DLL is interacting with LV. I am just worried because I am not getting consistent results.

     

    Russell

  5. Well, it is quite possible that the first section of the structure needs to be filled in with specific values that tell the function what to return in the union and for what resource (device, subunit, or whatever). So having even one value off might simply cause the function to error out. Have you checked the function return value itself to not indicate some error condition?

     

    Rolf,

     

    I do sometimes get an error from the return value (which the vendor said happens at times). He suggested retrying until the return value is zero (i.e no error). When I do get a zero return value the output cluster has the same values as the input cluster (i.e the incorrect output values).  In terms of filling the specific values in the function I have copied the same input values that are used in the vendor's VB example executable.  The VB example executable executes properly, after several retries of course, and returns the output values I would expect. So I can't tell what I am doing differently from the VB code. I have web meeting with one of the vendor's support engineers on Monday so he can see exactly what is happening on my computer and hopefully determine what might be wrong.  Unfortunately he doesn't have LV at his site and isn't familiar so he can't test it at his site. 

     

    Thanks again,

     

    Russell

  6. Well the sval is not a pointer but a fixed size string or byte array and as such must be inlined in the structure. Your bdrbag_byte_cluster.ctl is as such the most accurate control to use. However it only matches the Visual Basic definition not the original C definition as in there it is really 1500 bytes long, not just 127. As long as you are sure that the underlying function is not trying to write past byte 127 there won't be a problem though.

    All the other typedefs are not suited to resemble the C structure declaration in any way.

    And candidus, alignment is not an issue for this particular structure. The alignment rule specifies that each structure element is aligned on the smaller value of either the integral element size or the alignment value. Here all numerics are 32 bit sized and align therefore automatically on their natural position and the string has an integral size of 1 byte and has therefore no alignment requirement.

     

    Thanks Rolf,

     

    I was thinking that cluster option was the most acccurate option, but it doesn't seem to return an updated value so there must be something else wrong with the dll or my interpretation of the struct.  I did have 1500 elements before, but seemed to make editing the cluster and VI in LV very slow and also caused the dll to error out at times. 

     

    Thanks,

     

    Russell 

  7. Hello,

     

    I am trying to call a function from a dll with a pointer to a complex struct. I have tried multiple ways to represent the string in the struct (see attached typedefs), but the output clusters from the dll call always has the same values as input (i.e the dll isn't updating the output values).  The ref ptr is based on an example from this link and I have attached a screenshot of my code for this case:

     

    https://decibel.ni.com/content/docs/DOC-9079

     

    Here is how the vendor defines the struct:

     

    typedef struct {

      dword  passkey;  //password

      dword  request;  //0=readprop, 1=writeprop, 2=writerelinquish

      dword  deviceid;  //device instance

      dword  objectid;  //objectid

      dword  propid;  //property id

      dword  arrindex;  //array index

      dword  datatype;  //see simpletypes

      dword  value;

      dword  errorclass;

      dword  errorcode;

      dword  priority;  //1..16

      union {

      char  sval[1500];

      wchar_t  wval[1500/2];

      byte  bval[1500];

      BACnetDate dval;

      BACnetTime tval;

      datetime dtval;

      directaddr da;

      HWND  listbox;

      bufptr  buf;

      Range  rg;

      bdrCOV  cov;

      pxfer  *px;

      }aux;

      } bdrbag;

     

    Here is how the vendor defines the struct in their vb example:

     

    Type bdrbag

      passkey As Long 'password

      request As Long '0=readprop, 1=writeprop, 2=writeproprelinquish

      deviceid As Long   'device instance

      ObjectID As Long   'objectid

      propid As Long   'property id

      arrindex As Long   'array index

      datatype As Long   'see simpletypes

      value As Single

      errorclass As Long

      errorcode As Long

      priority As Long   '1..16

      sval(0 To 127) As Byte   'string value

    End Type

     

    Thanks,

     

    Russell

     

    TYPEDEF_BACNET_bdrbag_byte_cluster.ctl

    TYPEDEF_BACNET_bdrbag.ctl

    TYPEDEF_BACNET_bdrbag_ref_ptr.ctl

    post-5002-0-85015700-1385148023.png

  8. Hello David,

    Thank you for your code it is communicating with the PLC 5, but I have two issues that I thought you might be able to help me overcome. It looks like the element number is an U8 so I can't enter element numbers greater than 255. The other issue is that negative numbers are not read correctly. I tried to read from element 201 which should of been -22 and I read -17.

    Thank you,

    Russell

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.