January 3, 2022 at 8:50 am #9843rico_suaveParticipant
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 #9844
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_suaveParticipant
The ModDbExport version is 18.104.22.168 and the screenshots are here:
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 #9846
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.
January 4, 2022 at 9:51 am #9848
- This reply was modified 2 weeks, 4 days ago by Mikhail.
DayBeg() ? Val(202) : Val()January 11, 2022 at 12:47 pm #9892
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.
ThanksJanuary 11, 2022 at 3:02 pm #9893
I have tried with the manual settings
it still doesn’t work for me
what am I doing wrong?
ThanksJanuary 12, 2022 at 11:16 am #9903
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 #9913
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
thanksJanuary 14, 2022 at 1:50 pm #9914
@dateTime should be in the SQL request. Actually, there is @dataTimeJanuary 14, 2022 at 2:25 pm #9915
Thank you very much for the help
- You must be logged in to reply to this topic.