Questions regarding formular

Forum Home Forums Understanding the Software Using Formulas Questions regarding formular

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #7607
    Avatarzzz
    Participant

    Hi there ,

    I am trying out RapidScada in my recent project. I have the following question regarding formula.

    I saw examples in RU forum defining global variable before the user defined function body in order to retain state information between each execution.. My question is:
    – Are these variables shared between input channels, among all user defined functions ?
    – Does input and output Channel also share the same scope to access them ?
    – Does Calculated Real and Real makes any difference in this aspect ?

    – Is it possible to retrieve channel properties e.g Object/Device Name/ID by CnlNum, or simply current channel’s such properties ?

    #7608
    MikhailMikhail
    Moderator

    Hi,

    – Are these variables shared between input channels, among all user defined functions ?

    Yes. You can see the result file C:\SCADA\ScadaServer\Log\CalcEngine.cs

    – Does input and output Channel also share the same scope to access them ?

    Yes.

    – Does Calculated Real and Real makes any difference in this aspect ?

    The difference is WHEN the channel formula is calculated. For Real channel – only when a value is received from a device. For Calculated channel – permanently.

    – Is it possible to retrieve channel properties e.g Object/Device Name/ID by CnlNum, or simply current channel’s such properties ?

    No. If you need channel properties, you should develop a module for the Server app.

    #7610
    Avatarzzz
    Participant

    Hi MikHal,

    > Yes. You can see the result file C:\SCADA\ScadaServer\Log\CalcEngine.cs

    Thank you, that’s very clear.

    Some more questions:

    – Is it possible to return an empty value (–) ?
    Since “–” and NaN are displayed differently on data table.

    – Is it possible to make a channel [Now Only] ?
    Making the channel data only appear in formula and Now table (for debug). But not shown in minute/hour archive.

    – Can you add code page option for “binary” type in Automatic Control plugin ?
    CJK strings got messed up with the current default setup. Or maybe provide a way to pass the specified string to output channel UDF for decoding?

    – Can you not grey out the “Copy value or data” in event trigger to make passing event data possible ? though Am not quite sure what is event data,
    e.g. for a event {Name:”Changed”, NewValue:1, CnlName:”State”}, is the event data “1”, or “Cahnged: 1” ?

    Thanks.

    #7615
    MikhailMikhail
    Moderator

    Hi,

    – Is it possible to return an empty value (–) ?

    If your formula returns double.Nan, channel status is set automatically to 0 and you will see —.

    Making the channel data only appear in formula and Now table (for debug). But not shown in minute/hour archive.

    You should create an input channel and set Active = false when it’s not needed. I debug complex formulas in Visual Studio. I can provide more info about it, if needed.

    – Can you add code page option for “binary” type in Automatic Control plugin ?

    If you need to modify a string, do it in the formula of an output channel.

    Can you not grey out the “Copy value or data” in event trigger to make passing event data possible ?

    I’ve wrote this as a suggestion. Thank you. If you need this feature in time, it might be a commercial development.

    #7646
    Avatarzzz
    Participant

    Hi Mikhail,

    Regarding the Auto Control encoding issue. I guess I didn’t make the problem clear. After string is entered into textbox in AutoControl. AC send the encoded byte array to UDF in output channel.

    • This reply was modified 4 months, 1 week ago by Avatarzzz.
    #7648
    Avatarzzz
    Participant

    I am guessing AC is not using Unicode code page to encode the string, this make double-byte characters (e.g. C J K characters) cause error (unable to encode using that code-page -> Command Canceled) or encoded into garbage bytes that can’t be decoded using the correct codepage.

    The solution I can think of is either

    1. Use unicode e.g. UTF8 to encode all string, which can handle most doublebyte characters.
    UDF can re-encode them by GetStr then GetBytes using the code-page of their choice.
    Or provide a option to encode by UTF8, if Unicode as default code page is inconvenient.

    #7649
    Avatarzzz
    Participant

    2. Let user select a codepage for the text they entered in AC.

    The current implementation doesn’t work for me. Since the string either can’t be encoded and cause Cmd Canceled or U DF receives garbage bytes that can’t be re-encoded into the correct bytes.

    #7650
    Avatarzzz
    Participant

    Weird, I can’t post them as one reply.
    It always tell me the you look like spam 🙁

    #7663
    MikhailMikhail
    Moderator

    It always tell me the you look like spam

    The is a protection plugin in the forum. The used rules like a back box. Without the plugin, there would be plenty of spam messages.

    #7664
    MikhailMikhail
    Moderator

    Messages are sent in UTF8. It’s here. If you provide a particular example, we can check it here.

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