Showing results 1 to 4 of 4

Thread: non-linear value adjustment macros - how to set values without endless loop?

  1. #1
    Join Date
    07.11.2016
    Posts
    3

    Default non-linear value adjustment macros - how to set values without endless loop?

    Hello,

    after long searching and trying I came to no result.
    These options are poorly documented and I didn't find any examples.

    In the help one can find this:

    AdjustScadaValue

    Only available, if non-linear value
    adjustment is active
    :
    Macro is executed when setting a value in the
    control system to update the raw value (PLC).


    AdjustHardwareValue


    Only available, if non-linear value
    adjustment is active
    :
    Macro is executed with every change of the raw
    value (PLC) to update the value in the control system.



    I have no idea how I can set the value in these macros
    I tried it by setting obVar.Value = someValue wich results in an endless loop as the macro is called immediately when the value is set.
    How to tell the system that I want to set the hardware value or the control system value vice versa…?!

    Thank You,

    Stephan


  2. #2
    Join Date
    13.08.2013
    Posts
    57
    Best Answer

    Default Re: non-linear value adjustment macros - how to set values without endless loop?

    Hi,
    setting the obVar.Value will result in an endless loop, try this instead

    Public Function AdjustZenOnValue_Scaling330KV(obVar As Variable, vValue As Variant) As Double
    On Error Resume Next
    Dim W As Variant

    'Diese Function wandelt z.B. einen Sollwert in den BCD Code um,
    'damit dieser korrekt in die Steuerung abgesetzt werden kann
    W = vValue
    AdjustZenOnValue_Scaling330KV = W / 10
    End Function
    Public Function AdjustHardwareValue_Scaling330KV(obVar As Variable, vValue As Variant) As Double
    On Error Resume Next
    Dim W As Variant

    'Diese Function wandelt z.B. einen Sollwert in den BCD Code um,
    'damit dieser korrekt in die Steuerung abgesetzt werden kann
    W = vValue
    AdjustHardwareValue_Scaling330KV = W * 10
    End Function

    Best regards

  3. #3
    Join Date
    07.11.2016
    Posts
    3

    Default Re: non-linear value adjustment macros - how to set values without endless loop?

    Hi,

    thank You for the answer - seems like I'm out of practice with VBA

    I've failed to see the 

    Code:

    AdjustHardwareValue_xyz(obVar As Variable, vValue As Variant) As Double


    and also forgot how to return values in VBA functions wich is done by assigning the function name the desired value



    Code:

    AdjustHardwareValue_xyz = myValue
    Ok, so this is working for me, now 

    BUT - next problem: the values are set in the plc but zenOn doesn't update the values on the pages…

    any ideas?

    Cheers, Stephan


  4. #4
    Join Date
    07.11.2016
    Posts
    3

    Default Re: non-linear value adjustment macros - how to set values without endless loop?

    Sorry for bothering... I had a typo in the functionname 

    Thank You & cheers, Stephan

Similar Threads

  1. Logic, a loop for an array with type variables
    By genakust in forum straton / zenon Logic
    Replies: 1
    Last Post: 9th May 2018, 07:18
  2. VBA macros not appearing
    By dnaf in forum VBA
    Replies: 3
    Last Post: 6th April 2017, 08:29
  3. change "Value adjustment linear"
    By boykooo in forum VBA
    Replies: 1
    Last Post: 5th October 2015, 09:09
  4. non-linear value adjustment
    By sebastiank in forum VBA
    Replies: 1
    Last Post: 24th May 2013, 04:30
  5. My workspace Macros?
    By softart2 in forum VSTA
    Replies: 4
    Last Post: 27th December 2010, 00:58

Tags for this Thread

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •