OpenPDC Unique Key Constraint violation when adding Concentrator DME

Greetings,

We are running into an issue on the latest release of OpenPDC when we try to add a new concentrator input device via the input device wizard. When we get to the last step of Selecting Devices to Configure, when we click finish, we get the following error:

Violation of UNIQUE KEY constraint ‘UK_UniqueID’. Cannot insert duplicate key in object ‘dbo.Device’. The duplicate key value is (00000000-0000-0000-0000-000000000001).
The statement has been terminated.

It seems like it is trying to add the devices with the same unique ID for every device. My workaround was to delete the UniqueId constraint, let the wizard add the devices with the same UniqueID, and create new UUIDs for the records. After that, I added the constraint back in.

Is this a known issue? Has anyone else run into this?

Thanks,
Jordan Neuhart

That’s very unusual, can you provide more details. What kind of database are you using? If SQL Server, which version? What phasor protocol? Can you describe the exact steps you are following?

Thanks,
Ritchie

FYI, I’m assuming this is SQL Server based on the dbo.Device identifier in the error message.

Check the default constraint on the Device.UniqueID column. It should be using the newid() function, but it sounds like it may have been changed somehow.

You may also want to try simply running SELECT newid() to see what that function returns on your server. If it’s actually returning the same value every time, then I’m not sure what to tell you. You’d probably be better off contacting Microsoft at that point.

Thanks,
Stephen

Ritchie,

I am using SQL Server 2019 Express. The default constraint looks correct:

The steps I followed were:

  1. Run the PMU Connection Tester and save the Connection File.
  2. Then, in openPDC Manager, Inputs -> Input Device Wizard.
  3. Next, Next, etc. choose to let the wizard Configuration from the device, which is itself a concentrator.
  4. Enter the Acronym and description.
  5. On the last page, it shows 5 devices to import from the concentrator. I don’t make any modifications to the names or phasors, etc.
  6. Click Finish and that’s when the error is thrown about the Unique constraint violation.
  7. Check the database and see the GUID value of 00000000-0000-0000-0000-000000000001 in dbo.Device.

I know that SELECT newid() is working correctly when I execute it independently, so I don’t think that’s the issue. I haven’t looked through the source code yet, but I’m wondering if the value is getting created and set there.

I wonder if this has to do with a “config frame 3” that may have empty Guids defined when using IEEE C37.118.2-2011?

Can I get a copy of your serialized config frame that the PMU Connection Tester generated?

Thanks,
Ritchie

Would you point me to a guide on how to capture that?

It’s the file from step 1 you mentioned:

Okay, I have it. What’s the safest way to get the file to you?

If it has confidential information you can post it here as a private message to me. If there are no confidential details, then attached to a response here is fine.

You can also upload here: https://upload.gridprotectionalliance.org/upload/SampleConnectionFile

I received via e-mail - thanks!

Thanks,
Ritchie

Looks like this is a standard config frame 2. Try changing protocol from “IEEE C37.118.2-2011” to “IEEE C37.118-2005” and try import steps again.

Thanks,
Ritchie

I will give that a try.

Thanks,
Jordan

That worked! Thanks for your help.