Calculated Channel computing current minimum value of multiple channels

Forum Home Forums Understanding the Software Using Formulas Calculated Channel computing current minimum value of multiple channels

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16970
    rapidscadaaks
    Participant

    Hi

    Please assist for making a formula to calculate minimum value of current date of several channels.

    I excel, one would have used min(aa:xx)

    Thanks in advance

    #16971
    rapidscadaaks
    Participant

    Hi

    Please assist for making a formula to calculate minimum value of current date of several channels.

    I excel, one would have used min(aa:xx)

    Thanks in advance

    #16976
    rapidscadaaks
    Participant

    Hi

    I used formula below in a calculated channel and it did not work:

    Min(Val(1601),Val(1602),Val(1603))

    Server returned following error:

    2025-09-08 09:16:30 [SCADA][SCADA$][ERR] Error compiling the source code of the scripts and formulas:
    (929,53): error CS1501: No overload for method ‘Min’ takes 3 arguments
    Check the source code in Z:\SCADA\ScadaServer\Log\CalcEngine.cs
    2025-09-08 09:16:30 [SCADA][SCADA$][ERR] Normal execution is impossible

    Please help

    Thanks in advance

    #16977
    rapidscadaaks
    Participant

    Found a solution by using following script

    public double GetMinValue(params int[] channelNumbers)
    {
    if (channelNumbers == null || channelNumbers.Length == 0)
    return double.NaN;

    double minVal = double.MaxValue;

    foreach (int cnlNum in channelNumbers)
    {
    minVal = Math.Min(minVal, Val(cnlNum));
    }

    return minVal;
    }

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.