String dynamic text change according input channel value

Forum Home Forums Understanding the Software Using Formulas String dynamic text change according input channel value

This topic contains 10 replies, has 3 voices, and was last updated by Avatar ns.fariz 2 months, 1 week ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #5761
    Avatar
    ns.fariz
    Participant

    Hi Mikhail,

    I have one input channel for several state machine condition. So if modbus read 5,i want dynamic text show “manual”, and when modbus read 4 it will show “auto”, if it read 3 it will show stop. How can I achieve that?

    Thanks,

    #5763
    Mikhail
    Mikhail
    Moderator

    Hi,

    1. Create a new record in the Units table with Sign =
    -; Stop; Manual; Auto

    See “No; Yes” for example.

    2. Create a new formula in the Furmulas table. Something like that:

    function double MyFunc()
    {
      switch ((int)Cnl)
      {
        case 3:
          return 1;
        case 4:
          return 2;
        case 5:
          return 3;
        default:
          return 0;
      }
    }

    3. For your input channel set formula to MyFunc() and set unit to the unit you created.

    #5770
    Avatar
    ns.fariz
    Participant

    Hi Mikhail,
    I try to input your given formula, but my server turn error.

    function double MyFunc()
    {
     switch ((int)Cnl)
     {
      case 3:
       return 1;
      case 4:
       return 2;
      case 5:
       return 3;
      default:
       return 0;
     }
    }

    Is there something wrong?

    #5776
    Mikhail
    Mikhail
    Moderator

    Hi,

    Please find the error details in C:\SCADA\ScadaServer\Log\ScadaServerSvc.log and copy the error message here.

    #5777
    Avatar
    ns.fariz
    Participant

    Hi Mikhail,
    Here is error log

    2019-08-01 08:53:56 <LAPTOPKU><SYSTEM><ACT> ScadaServerService 5.1.2.0 is started
    2019-08-01 08:53:57 <LAPTOPKU><SYSTEM><ACT> Check the existence of the data directories is completed successfully
    2019-08-01 08:53:57 <LAPTOPKU><SYSTEM><ACT> Check the existence of the configuration database files is completed successfully
    2019-08-01 08:53:57 <LAPTOPKU><SYSTEM><ACT> Input channels are read from the configuration database. Active channel count: 51
    2019-08-01 08:53:57 <LAPTOPKU><SYSTEM><ACT> Ouput channels are read from the configuration database
    2019-08-01 08:53:57 <LAPTOPKU><SYSTEM><ACT> Users are read from the configuration database
    2019-08-01 08:53:57 <LAPTOPKU><SYSTEM><ACT> Formulas are read from the configuration database
    2019-08-01 08:53:57 <LAPTOPKU><SYSTEM><ERR> Error compiling the source code of the formulas: 
    Line 514, column 10: error CS1519: Invalid token 'double' in class, struct, or interface member declaration
    See the file C:\SCADA\ScadaServer\Log\CalcEngine.cs with the source code
    2019-08-01 08:53:57 <LAPTOPKU><SYSTEM><ERR> Normal program execution is impossible
    #5778
    Avatar
    manjey73
    Participant

    Line 514, column 10:
    See the file C:\SCADA\ScadaServer\Log\CalcEngine.cs with the source code

    See the file for this line and the error symbol

    #5781
    Mikhail
    Mikhail
    Moderator

    Hi,

    function double MyFunc()

    #5786
    Avatar
    ns.fariz
    Participant

    Hi Mikhail,
    Now no error again, but its only change the number. So, if the value is 3,it will show 1-;. I made new Unit named Control. With Sign -;Stop Mode;Auto Mode;Manual Mode;Test On Load
    Enable formula MyFunc() and choose unit Control. I choose dynamic text with unit.
    Am I miss something?

    #5787
    Mikhail
    Mikhail
    Moderator

    Hi,

    Am I miss something?

    May be a little bit. Please provide links to screenshots of the settings you made. And I will check.

    #5788
    Mikhail
    Mikhail
    Moderator

    Make sure that you set format of the input channel to Enum text.

    #5791
    Avatar
    ns.fariz
    Participant

    Hi Mikhail,
    It’s work after change to enum text.

    Thanks

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.