ModDbExport Questions

Forum Home Forums Understanding the Software ModDbExport Questions

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #9843
    rico_suave
    Participant

    Hello,

    I am trying to export a series of values to a MySQL database generated in a formula using ModDbExport filtered on the the channels in question. However the current value exporter doesn’t appear to trigger for channels where the value is
    modified by a formula (i.e. SetVal) despite being Calculated Real and having Write Events and Data Change checked on those channels.

    ModDbExport does work when the value of the channel is changed using the Generator tool so it seems like channel events are only raised when Communicator sends a new value to the Server. Is this correct?

    ModAutoControl doesn’t appear to be able to be used to trigger and pass data to ModDbExport because ModDbExport does not have a command trigger. Is this correct?

    My primary goal is to make retentive values for ~20 channels once per day that then feed into daily, monthly, yearly, lifetime totals. These are what I think to be the options:

    1. Make a device for each channel to be stored (~20) using the KpDbImport driver and @CmdVal via ModAutoControl for each. This might work for my immediate purpose but is not very scalable.
    2. Write a plug-in to pull the data I want out of the current dat file and push it into sql or just store it in is own dat file triggered by a command.
    3. Fork the source and add a “Command Trigger” to ModDbExport that exposes binary command data (@cmdData which would be the byte[] result of a formula on the channel) in addition to standard data (i.e. the @cmdVal double)

    Have I missed something that is easier?

    #9844
    Mikhail
    Moderator

    Hello,

    Please let us know the ModDbExport version, and make screenshots of the formulas in the Input channels table.

    #9845
    rico_suave
    Participant

    Hello

    The ModDbExport version is 5.1.0.1 and the screenshots are here:

    https://drive.google.com/drive/folders/1kZwT6DLo4_KCVqMuYS34Qv_dVvYVCwr2?usp=sharing

    For explanation the output channel is triggered by ModAutoControl once per day which fires the DailyData() formula which sets a value in cnl401.

    ModDbExport is configured to export current data filtered on cnl401. As noted before it works fine if I use Generator to put a value in cnl401 input but does not work when the value is changed using the formula. The value in cnl401 is
    changed by the formula and this is confirmed in the table view.

    #9846
    Mikhail
    Moderator

    Hi,

    The following approach should work:
    1. Don’t use an output channel.
    2. In a formula of input channel of the calculated type check if it’s time to store data, and take Val(202)
    The DayBeg() function, declared in the Fomulas table, can help.

    • This reply was modified 2 years, 3 months ago by Mikhail.
    #9848
    Mikhail
    Moderator

    DayBeg() ? Val(202) : Val()

    #9892
    gabeirinhas
    Participant

    Hello

    I am trying to dump the data to a local sql database on the server itself

    I am new to this and have not been able on my own

    The idea is to dump the date and the value in the tables.

    Attached images

    Thanks

    https://drive.google.com/drive/folders/1vimJlHYrG7V6oZbh6CXuUPO5F28dwFVN?usp=sharing

    #9893
    gabeirinhas
    Participant

    I have tried with the manual settings
    it still doesn’t work for me
    what am I doing wrong?
    Thanks

    https://drive.google.com/drive/folders/1xFSLfS8JqqsIA3oCamwTHYP50gw0kLi8?usp=sharing

    #9903
    Mikhail
    Moderator

    Hi,
    The module writes log files into C:\SCADA\ScadaServer\Log
    Please check if there are errors in logs.

    #9913
    gabeirinhas
    Participant

    First I had a connection problem with the server since I had not declared the corresponding port.

    Now I am getting the following error.

    2022-01-14 12:30:00 Error export snapshot by the trigger “LT1”:
    System.Data.SqlClient.SqlException (0x80131904): You must declare the scalar variable “@dataTime”.

    what am I doing wrong ?

    in the sql table it is declared from the manual example and in the server too

    thanks

    #9914
    Mikhail
    Moderator

    @dateTime should be in the SQL request. Actually, there is @dataTime

    #9915
    gabeirinhas
    Participant

    It works
    Thank you very much for the help

    Greetings

    #10401
    gabeirinhas
    Participant

    Hello

    To get certain bits within a byte
    I use channel type = calculated discrete
    And I use the following formula GetBit (Val (xxxx), 0)

    When I export the data to sql.
    If I export the whole byte I have no problem. (discrete)

    If I export the channel type = caculated discrete
    The export does not work.

    Is there any kind of solution ?

    Thanks in advance, best regards

    #10402
    Mikhail
    Moderator

    Hi,

    By default, the module exports data when it comes from Communicator to Server. Calculated channels not included in this case.
    To export all data, including calculated channels, you can use the archive upload feature of the module.

    #10408
    gabeirinhas
    Participant

    Hello, I have selected the option “add archive data trigger”.

    And the data is not being dumped to the corresponding table.

    The “archive upload options” is also enabled.

    I don’t know if that’s what you meant, but it still doesn’t work.

    #10410
    Mikhail
    Moderator

    Hello,
    What useful info is available in the module log files?

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