Calculated Real working unreliable

Forum Home Forums Understanding the Software Using Formulas Calculated Real working unreliable

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #957
    inpelsa
    Participant

    Hi!

    I have four channels with this equivalent formula: Input channel 808=Cnl/( Val(768)*100 + (1-Val(768)) )
    input Channel 768 is just a “1” or “0” to indicate ‘divide by 100’
    (of course each channel formula refers to their respective 768 input channel)

    As I read the documentation I should use a Calculated Real for 808 as it depends on another channel and 808>768 so it should already have updated the lowest channel

    But three scenarious can happen along the time without changing the config:

    – It works perfectly as spected
    – It stores an old value forever (while seeing Communications service getting the right value)
    – Sometimes when the value changes from 0 to 1 it doesn’t changes until next cycle.

    If I restart the whole server or some service (WWW, commserv, scadaserv) it updates the value (but keeps it forever again) or starts to work well for some time.

    Any clue?

    #961
    Mikhail
    Moderator

    If you receive data from Communicator in the channel 808, you have to turn it to Real channel type.

    If the channel type is Real, the formula is calculated only when SCADA-Server receives data from SCADA-Communicator.

    So you need to create an additional channel of Calculated Real type that will be quickly response to changes of the channel 768, and it depends on 768 and 808 channels.

    #962
    Mikhail
    Moderator

    Cnl/( Val(768)*100 + (1-Val(768)) )
    you can change to
    Cnl / (Val(768)>0?100:1)

    #965
    inpelsa
    Participant

    All done! 🙂
    Let’s see how it works…

    #970
    inpelsa
    Participant

    mmm… no data on source channels = 0 on the new channel

    I would like to have the new channel as nothing/null/no data.

    Is this possible?

    #971
    Mikhail
    Moderator

    Provide more details, please.

    #973
    inpelsa
    Participant

    Its easy, communicator service was not able to retrieve data from any channel because the souece (virtual COM port from a lantronix RS485-Ethernet converter) had no TCP/IP connectivity.

    Real channels got no data and nothing is shown on the graph, and you notice it. But the calculated channel reflects 0 and no way to know it was disconnectes.

    Should I play with the status part of the channel to reflect the wrong situation??

    Thanks in advance!

    #975
    Mikhail
    Moderator

    Yes, you should set status of calculated channel by a formula.
    Formula example:
    Val(1)+Val(2); Stat(1)

    #1004
    inpelsa
    Participant

    At the end the calculated real was not reliable enough…

    Once a day data rises above 100 and it doesn’t get the right number, graph is useless with a data point 100 times above the rest.

    Maybe it needs a perfect channels sync read or power regulator device updates too fast.

    Anyway, it has an easy fix: Cnl>100 ? Cnl/100 : Cnl

    #1007
    Mikhail
    Moderator

    After getting every block of data from Communicator, the calculated channels are updated. Could you describe the issue in details?

    #1099
    radix
    Participant

    Hi,

    We required formula to be calculated as below.

    Input channel data is 9 -> which is then converted to 1001
    This value denotes alarm for 2 address, (10 for channel 2 , next 01 for channel 1)
    (1 means either High or Low based on which position it occurs , & 0 is normal alarm stage). Based on this formula we need to update the input channel value

    So how we should implement it ?
    Thanks in advance.

    #1100
    inpelsa
    Participant

    Maybe you can use the byteorder field to split it in two channels right in the origin.

    One channel has byteorder “0” and on the other just “1”

    #1101
    inpelsa
    Participant

    Forget it, I didn’t read it well.

    But splitting it as string and then playing with bit operators in a function should work.
    You have some examples of bit-level working on the forum

    Sorry, not able to help you more at this moment.

    #1102
    Mikhail
    Moderator

    Radix, could you write the required formula using C++, C# or math? In this case, I can tell how to apply it to Rapid SCADA.

    #1106
    radix
    Participant

    Hi,

    I can write function in c#. Please let me know How & where to implement it in rapid Scada? Below is sample function for our requirement.
    Output from below function (Alarm High/Low) need be stored into separate channel & then will be shown from front end to user.

    
    void CalAlarm(int number, out string Channel1HighAlarm, out string Channel1LowAlarm, out string Channel2HighAlarm, out string Channel2LowAlarm)
            {
                //number = 20;
                var result = Convert.ToString(number, 2); // result = 1010
                
                // Channel 1 calculation
                if (result.Substring(result.Length-1 , 1) == "1")
                    Channel1HighAlarm = "HIGH";
                else
                    Channel1HighAlarm = "NORMAL";
    
                if (result.Substring(result.Length-2, 1) == "1")
                    Channel1LowAlarm = "LOW";
                else
                    Channel1LowAlarm = "NORMAL";
    
                // Channel 2 calculation
                if (result.Substring(result.Length -3, 1) == "1")
                    Channel2HighAlarm = "HIGH";
                else
                    Channel2HighAlarm = "NORMAL";
    
                if (result.Substring(result.Length - 4, 1) == "1")
                    Channel2LowAlarm = "LOW";
                else
                    Channel2LowAlarm = "NORMAL";
    
                //Output
                //Channel1HighAlarm =NORMAL
                //Channel1LowAlarm  =LOW
                //Channel2HighAlarm =NORMAL
                //Channel2LowAlarm  =LOW
            
            }

    Thanks in advance

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