Forum Home › Forums › Understanding the Software › ModDbExport Questions
Tagged: @cmdData, @cmdVal, ModAutoControl, ModDBExport, SetVal
- This topic has 18 replies, 4 voices, and was last updated 1 year, 5 months ago by
Mikhail.
-
AuthorPosts
-
January 3, 2022 at 8:50 am #9843
rico_suave
ParticipantHello,
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?
January 3, 2022 at 9:38 am #9844Mikhail
ModeratorHello,
Please let us know the ModDbExport version, and make screenshots of the formulas in the Input channels table.
January 3, 2022 at 2:23 pm #9845rico_suave
ParticipantHello
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.January 4, 2022 at 9:50 am #9846Mikhail
ModeratorHi,
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 3 years, 1 month ago by
Mikhail.
January 4, 2022 at 9:51 am #9848Mikhail
ModeratorDayBeg() ? Val(202) : Val()
January 11, 2022 at 12:47 pm #9892gabeirinhas
ParticipantHello
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
January 11, 2022 at 3:02 pm #9893gabeirinhas
ParticipantI have tried with the manual settings
it still doesn’t work for me
what am I doing wrong?
Thankshttps://drive.google.com/drive/folders/1xFSLfS8JqqsIA3oCamwTHYP50gw0kLi8?usp=sharing
January 12, 2022 at 11:16 am #9903Mikhail
ModeratorHi,
The module writes log files into C:\SCADA\ScadaServer\Log
Please check if there are errors in logs.January 14, 2022 at 11:34 am #9913gabeirinhas
ParticipantFirst 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
January 14, 2022 at 1:50 pm #9914Mikhail
Moderator@dateTime should be in the SQL request. Actually, there is @dataTime
January 14, 2022 at 2:25 pm #9915gabeirinhas
ParticipantIt works
Thank you very much for the helpGreetings
July 5, 2022 at 6:21 pm #10401gabeirinhas
ParticipantHello
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
July 6, 2022 at 11:55 am #10402Mikhail
ModeratorHi,
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.July 12, 2022 at 10:41 am #10408gabeirinhas
ParticipantHello, 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.
July 13, 2022 at 12:01 pm #10410Mikhail
ModeratorHello,
What useful info is available in the module log files? -
This reply was modified 3 years, 1 month ago by
-
AuthorPosts
- You must be logged in to reply to this topic.