in
Creating Smarter Networks

Network variable array

Last post 02-26-2010 1:50 AM by troggendorf. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 01-29-2010 7:32 AM

    • Sven Ruin
    • Top 25 Contributor
    • Joined on 12-17-2008
    • Posts 9
    • Points 120

    Network variable array

    Hi,

    Does anyone know if a network variable array, such as nvoL[10], can be used in a FPM (and if so, how do you do that)?

    Sven

    • Post Points: 20
  • 01-29-2010 4:28 PM In reply to

    • rmhair
    • Top 10 Contributor
    • Joined on 12-14-2007
    • San Jose CA
    • Posts 17
    • Points 240

    Re: Network variable array

     Greetings Sven,

    It is my understanding that you cannot create an array of network variables as you describe.  However, you can create a network variable that contains an array of elements:

    e.g. nvoL.point[10]

    note that the single network variable needs to be les than 32 bytes in size...

    You would need to define your own user data type in the nodebuilder resource editor.  You can review example data structures at http://types.lonmark.org/   There are a variety to examine.  e.g. SNVT_str_asc is actually a structure.

    Richard Hair
    Kenmark Controls
    www.kenmarkcontrols.com
    LonMark Certified System Integrator
    • Post Points: 20
  • 02-23-2010 6:42 AM In reply to

    • Sven Ruin
    • Top 25 Contributor
    • Joined on 12-17-2008
    • Posts 9
    • Points 120

    Re: Network variable array

    Hi Richard,

    Thank you for your reply! Wish this could be improved in future versions of the SmartServer, because some types of applications would be much easier to program with a network variable array.

     Sven

    • Post Points: 20
  • 02-24-2010 2:51 AM In reply to

    Re: Network variable array

     Hi Sven

    I don't know if it works but you can at least try the following. Write an FPM that has only one input - let's call that input. Now create such an FPM on the SmartServer with a SOAP Set. In the Set add 10 E_DpRefs to the DataPoint array of the FPM all with dpType == input. Now you may get updates for all ten NVs each in the input variable in your FPM. If you want to discriminate them, you may be able to get their UCPTname. This is in principle how the SmartServer's built in modules work and the FPMsshould work the same, but as I said, I'm not sure if it really does work.

    If it does not work: would it be sufficient for you to make it work that way in future versions of the SmartServer or do you think you require the array approach?

          Regards

          Thorsten

    • Post Points: 20
  • 02-24-2010 11:25 AM In reply to

    • Sven Ruin
    • Top 25 Contributor
    • Joined on 12-17-2008
    • Posts 9
    • Points 120

    Re: Network variable array

    Hi Thorsten,

    I have not yet tried your method, but I will try to explain what I would use the network variable array for. The aim is to control a large number of identical nodes, say 10-100 pcs. Each of these nodes has a SNVT_switch input according to a LonMark functional profile. Therefore my idea was to make a FPM with a network variable array to control them all. I have done this using ordinary network variables, such as nvoL5, nvoL6, ..., (each variable has a binding to a separate node) but that is not the most efficient programming, especially if I would like to increase the number of nodes. The algorithm in the FPM is ideal for an array. However, if I would create a network variable containing an array of elements in the FPM, like Richard suggested, I don't think I could bind that to SNVT_switch inputs.

    Do you think your method is useful for what I'm trying to do?

    Sven

    • Post Points: 20
  • 02-26-2010 1:50 AM In reply to

    Re: Network variable array

     Hi Sven

    No my method is not useful for your usecase as far as I understand it. You could use Richard's approach but you'd have to use an additional Typetranslator FB to separate the fields of your output "array". This is a bit cumbersome.

    However, there may be other more elegant approaches with the currently available technology. That depends on your actual problem though. It could for example be possible that you could use one instance of your FPM per output node. Or it could be possible to generate few fixed outputs and distribute them intelligently ... Could you describewhat you are trying to achieve (how the outputs in the array would differ)?

    Regards

    Thorsten

    • Post Points: 5
Page 1 of 1 (6 items)
©2008 Echelon Corporation