Showing results 1 to 7 of 7

Thread: Auto Scaling problem

  1. #1
    Join Date
    30.12.2008
    Posts
    4

    Default Auto Scaling problem

    Hello,
    I am new in this forum
    I work on a Zenon supervision project
    I have a question concerning the implementation of the Auto Scaling of curves in vba,
    I would like to retrieve the min and max date in the curve display before I can look in the archives the maximum value of the variable,

    Here are a few lines of code that I do,
    Thank you in advance for your reply,

    //-------------------------------------------vba code----------------------------------------
    Public Sub autoSCale()
    Dim obFctTrend As RtFunction
    Dim strDynProp As String
    Dim iCurves As Integer
    dim vStart, vEnd as Date

    Set obFctTrend = thisproject.RtFunctions.Item("Courbe")
    For iCurves = 0 To obFctTrend.DynProperties("PictFilter.Curve[-1]")
    strDynProp = "PictFilter.Curve[" & iCurves & "]"
    If InStr(1, "Empty", obFctTrend.DynProperties(strDynProp & ".VarInfo.VarName")) = 0 Then

    'She always give me the date value 01/01/1970 01:00:00
    vStart = obFctTrend.DynProperties("PictFilter.TimeAxe.TimeFilter.ARVTime1")

    'She always give me the date value 01/01/1970 02:00:00
    EndDate = obFctTrend.DynProperties("PictFilter.TimeAxe.TimeFilter.ARVTime2")

    'Search in the archives the min and max of the variable of the curve between the dates vStart and EndDate
    updateMinMax (obFctTrend.DynProperties(strDynProp & ".VarInfo.VarName"), vStart, EndDate)

    obFctTrend.DynProperties(strDynProp & ".XAxe.Scale.ScaleTop") = max
    obFctTrend.DynProperties(strDynProp & ".XAxe.Scale.ScaleBotton") = min
    obFctTrend.Start
    End If
    Next iCurves
    End Sub

  2. #2

    Default Re: Auto Scaling problem

    Hi, zenon

    I don't know if it is still relevant, but perhaps you could phrase your question?

    I'm not sure what your question or your issue is. Feel free to upload a sample project backup, if that makes it easier to explain.

    Regards,
    Mark

  3. #3
    Join Date
    30.12.2008
    Posts
    4

    Default Re: Auto Scaling problem

    Hello, thanks for your response,
    what i want is juste how to read the displayed trend values from vba.
    coordially

  4. #4
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    880

    Default Re: Auto Scaling problem

    It is not possible to read the displayed archive values out of the ETM via VBA
    -> since zenon >= 6.50 it is possible to export the shown data in the ETM to i.e. a text file

    If you want to implement a autoscaling on the y-axis (based on min/max of the archived values) you would have to do something like this:
    - evaluate via vba the min/max values for the given timespan directly on the archive itself (not ETM)
    - modify the picture switch function to the ETM (adapt min/max of the y-axis)
    - execute modified function

    As far as i know there exists already the requirement for this feature to have this available in a future version of zenon....

    Regards,
    Herbert

  5. #5
    Join Date
    30.12.2008
    Posts
    4

    Default Re: Auto Scaling problem

    Hello, thanks for your response,
    Yes, I taught both solutions before I post my question, but I had some problems.
    First, when using the export function of Zenon into text file, it does not export the displayed values in the curves, but all the variables values.

    Second, and we suppose that all the variables must be archived (witch is not the case for all variables of our project).
    How I can read the min max time-Span in the displayed curves from vba.

    Best regards

  6. #6
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    880

    Default Re: Auto Scaling problem

    How I can read the min max time-Span in the displayed curves from vba
    again:
    It is not possible to read the displayed archive values out of the ETM via VBA

    If you want to implement a autoscaling on the y-axis (based on min/max of the archived values) you would have to do something like this:
    - evaluate via vba the min/max values for the given timespan directly on the archive itself (not ETM)
    - modify the picture switch function to the ETM (adapt min/max of the y-axis)
    - execute modified function
    Have a look into the help documentation (Programming Interface -> Object Model). Here you can find example how to get values out of an archive

  7. #7
    Join Date
    30.12.2008
    Posts
    4

    Default Re: Auto Scaling problem

    Hello, thank you again for your response

    Here attached a sample program that I tried to do for autoscaling.

    cordially
    Attached Files Attached Files

Similar Threads

  1. Auto Logoff
    By yara in forum zenon Service Engine Supervisor
    Replies: 11
    Last Post: 31st July 2011, 23:29
  2. User managment Problem, Snapshot relativ Problem
    By jusufs in forum zenon Service Engine Supervisor
    Replies: 4
    Last Post: 13th September 2010, 23:06
  3. y-scaling trendelement
    By affoltep in forum zenon Service Engine Supervisor
    Replies: 1
    Last Post: 22nd July 2009, 13:38
  4. Auto start runtime when windows starts
    By craigdouglas in forum zenon Service Engine Supervisor
    Replies: 5
    Last Post: 12th February 2009, 18:14

Posting Rules

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