Configuration to get data from database

For MySQL Connector/NET, did you use the .NET & Mono build that is architecture independent, or the Windows installer that is 32-bit only?

Only Windows installer 32-bit

You still need the other one, even if you already have the 32-bit one installed.

I’ve donwload Mono from https://www.mono-project.com/download/stable/ and I’ve installed but it still doesn’t work

What could I do?

I’m talking about MySQL Connector/NET. You go to the download page, select .NET & Mono from the dropdown, and then download the zip file from there.

Here, I’ve done it myself and obtained the download link. Just use this link to download the correct version of MySQL Connector/NET that will work with 64-bit applications like the openPDC.
https://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-8.0.18-noinstall.zip

Stephen, I’ve downloaded it, I copied and I pasted all files inside openPDC folder but it still doesn’t work.

By the way, openPDC folder has another folders… Do I have to copy files in any that folders?

PD: inside openPDC folder I have next folders:
Statics
Logs
DatabaseScripts
ConfigurationCacheArchive

OpenPDC console:


OpenPDC Manager:

When I press initialize button from openPDC I’ve got that error in openPDC console.

If you downloaded the link I sent you, the version you should be using is 8.0.18, not 8.0.17. You’ll need to change your connection string accordingly.

Stephen

I’ve copied and pasted files from https://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-8.0.17-noinstall.zip inside openPDC folder and you remember I’ve installed Windows installer too.

So, now I’ve followed all your tips but I still not have success.

OpenPDC console send me same errors that you can watch in screenshot above.

One more thing, have you tried restarting the openPDC service after copying the assemblies for version 8.0.17 into the openPDC directory?

I’ve rebooted computer and now openPDC service has troubles

I’ve setup it again and now openPDC works fine :slight_smile:

I attach a screenshot of my new results

I dont know if it work yet, but I’ve got new results.
When I open database I watch that data doesn’t store there :frowning:

PD: There was a moment when openPDC send [CRITICAL], so I’ve disable connector for any problem.

The error message in your screenshot indicates either that the ADO output adapter is not able to send data to MySQL as fast as it is being received or that the output adapter is only queuing data and is not processing, perhaps due to an error during adapter initialization. Leaving the adapter on should not cause problems because it will be able to dump data from its queue before using up all your system memory, but you will continue to lose data until you can figure out a way to speed up the process.

Stephen

Now I’ve got next errors

Do I have NaN values from data arrives or Adaptor has problems?

Other question, When I make a new ADOAdapter it has a new RuntimeID.
How can I watch if RuntimeID is working??

Can you say me where can I find commands for openPDC console, please?

The only thing I can think is that you must have NaN values. The ADO adapter should be converting your measurements into SQL queries that look something like this…

INSERT INTO TimeSeriesMeasurement(ID, Timestamp, Value)
SELECT @p0, @p1, @p2 UNION ALL
SELECT @p3, @p4, @p5 UNION ALL
...

The @p# things in that query are parameters for a parameterized query. Likely, one of the parameters is a NaN value and the query is interpreting that as selecting the NaN column, which couldn’t possibly exist without a FROM clause, but really shouldn’t exist anyway since we’re only dealing with raw values here. Honestly, I wouldn’t have thought it possible if we were dealing with SQL Server, but I guess MySQL allows you to use parameter values as column names in your queries?

Regardless, since MySQL doesn’t support storing NaN in the database, you’ll have to either ensure that your input data can never be NaN or modify the AdoOutputAdapter code.

As for the runtime ID, use the list /o command to see what your output adapter runtime IDs are.

For a list of console commands, issue the help command. Use the /? modifier to get help using a specific command (for example, list /?).

So, I have some options to solve it.

About:
Regardless, since MySQL doesn’t support storing NaN in the database, you’ll have to either ensure that your input data can never be NaN or modify the AdoOutputAdapter code.
How can I modify it?
Do I have to do it in ConnectionString?

Another question is about add values to my database. You wrote it:

BulkInsertLimit=500; DataProviderString={ AssemblyName={MySql.Data, Version=8.0.17, Culture=neutral, PublicKeyToken=c5687fc88969c44d}; ConnectionType=MySql.Data.MySqlClient.MySqlConnection; AdapterType=MySql.Data.MySqlClient.MySqlDataAdapter }; DbConnectionString={ Server= localhost ; Database= MyDatas ; Uid= root ; Password= sincrofasor#1 }; TableName= TimeSeriesMeasurement ; IDFieldName= SignalID ; TimestampFieldName= Timestamp ;
ValueFieldName= Value; InputSourceIDs= PPA

If I want to add more data, How can I add it and how can I indicate which one (voltage, angle, so on)??
PD: I’ve noticed in connectionString a parameter InputMeasurementKeys and it has measureaments. Maybe there I must to get speficical data. (¿?)

The code is here:
https://github.com/GridProtectionAlliance/gsf/blob/master/Source/Libraries/Adapters/AdoAdapters/AdoOutputAdapter.cs

To modify the code you would have to download the Grid Solutions Framework source code, modify the AdoOutputAdapter.cs file, build the AdoAdapters project, locate the AdoAdapters.dll file in the build output, and then copy/paste that file into the openPDC installation folder, replacing the one that gets installed with the openPDC.


As for your question about adding values, the InputSourceIDs=PPA parameter ensures that your adapter receives all the same measurements as your primary phasor archive. If you’d like to add additional measurements, you can add them to your primary phasor archive by setting the Historian field on the Metadata > Measurements page of the openPDC Manager. You can also use the InputMeasurementKeys property to explicitly add them to your ADO adapter without adding them to your primary phasor archive.

Stephen,
I’m talking about add more values to my database using ConnectionString. I know that PPA has all measurements (voltages, angles and so on) but I don’t know how ConnectionString interprets measurements.

You wrote me one ConnectionString example just has three parameters: IDFieldName , TimestampFieldName and ValueFieldName, but ValueFieldName I don’t know what is (voltage, angle, frecuencie and so on?)

Now I’ve create another Table has more colummns. I’ll write it:

CREATE TABLE MyMeasurement
(
    SignalID NCHAR(36) NOT NULL,
    Timestamp VARCHAR(24) NOT  NULL,
    VPhase DOUBLE NOT NULL,
    APhase DOUBLE NOT NULL,
    Frequencie DOUBLE NOT NULL,
)

Now, I want to tell to connectionString writes into new table my new parameters.

PD: Voltage phase A, Angle phase A and Frecuencie

How can I do it?

Regards

You can’t do it, because that would require concentration which is not supported by the ADO adapter. The expectation is that you’d handle concentration after you have archived your data. Here’s a simple example, based on various assumptions, that uses SQL JOINs to concentrate the TimeSeriesMeasurement table.

WITH tsm AS
(
    SELECT
        SignalType.Acronym AS SignalType,
        TimeSeriesMeasurement.Timestamp,
        TimeSeriesMeasurement.Value
    FROM
        TimeSeriesMeasurement JOIN
        Measurement ON TimeSeriesMeasurement.SignalID = Measurement.SignalID JOIN
        SignalType ON Measurement.SignalTypeID = SignalType.ID
)
SELECT
    FREQ.Timestamp,
    VPHA.Value AS VPhase,
    IPHA.Value AS APhase,
    FREQ.Value AS Frequencie
FROM
    tsm FREQ JOIN
    tsm VPHA ON FREQ.Timestamp = VPHA.Timestamp JOIN
    tsm IPHA ON FREQ.Timestamp = IPHA.Timestamp
WHERE
    FREQ.SignalType = 'FREQ' AND
    VPHA.SignalType = 'VPHA' AND
    IPHA.SignalType = 'IPHA'
ORDER BY FREQ.Timestamp

Hi,

I´m still having troubles configuring this ADO.

I´ve created the table, setted the connection string, downloaded .net mysql_data and put it in openpdc dir, and get the following errors:

[9/29/2023 7:44:48 PM] (Inner Exception)
Date and Time: 9/29/2023 7:44:48 PM
Machine Name: GETPDT01
Machine IP: ::1
Machine OS: Microsoft Windows NT 6.2.9200.0

Application Domain: openPDC.exe
Assembly Codebase: C:/Program Files/openPDC/openPDC.exe
Assembly Full Name: openPDC, Version=2.9.42.0, Culture=neutral, PublicKeyToken=null
Assembly Version: 2.9.42.0
Assembly Build Date: 5/15/2021 12:14:12 AM
.Net Runtime Version: 4.0.30319.42000

Exception Source: AdoAdapters
Exception Type: System.NullReferenceException
Exception Message: Object reference not set to an instance of an object.
Exception Target Site: AttemptDisconnection

---- Stack Trace ----
AdoAdapters.AdoOutputAdapter.AttemptDisconnection()
openPDC.exe: N 00021
GSF.TimeSeries.Adapters.OutputAdapterBase.Stop()
openPDC.exe: N 00108

(Outer Exception)
Date and Time: 9/29/2023 7:44:48 PM
Machine Name: GETPDT01
Machine IP: ::1
Machine OS: Microsoft Windows NT 6.2.9200.0

Application Domain: openPDC.exe
Assembly Codebase: C:/Program Files/openPDC/openPDC.exe
Assembly Full Name: openPDC, Version=2.9.42.0, Culture=neutral, PublicKeyToken=null
Assembly Version: 2.9.42.0
Assembly Build Date: 5/15/2021 12:14:12 AM
.Net Runtime Version: 4.0.30319.42000

Exception Source:
Exception Type: System.InvalidOperationException
Exception Message: Exception occurred during disconnect: Object reference not set to an instance of an object.

Can you guys clarify what and how can I workaround ??