I recently made one for SQL Server, but it’s a bit messy, and I’m not sure how much I can share of it. Instead, here’s something like a skeleton for building one.
-- Create output measurements for each device
INSERT INTO Measurement(DeviceID, HistorianID, SignalTypeID, PointTag, SignalReference, Description, Enabled)
SELECT
Device.ID DeviceID,
Historian.ID HistorianID,
SignalType.ID SignalTypeID,
CONCAT(Device.Acronym, '!MY_OUTPUT:CV', ...) PointTag,
CONCAT(Device.Acronym, '!MY_OUTPUT-CV', ...) SignalReference,
'...' Description
FROM
Device JOIN
Historian ON Historian.Acronym = 'PPA' JOIN
SignalType ON SignalType.Acronym = 'CALC' JOIN
...
-- Create the calculator adapter
INSERT INTO CustomActionAdapter (AssemblyName, TypeName, AdapterName, NodeID, Enabled, ConnectionString)
SELECT
'DynamicCalculator.dll' AssemblyName,
'DynamicCalculator.DynamicCalculator' TypeName,
CONCAT('MY_OUTPUT_CALC!', Device.Acronym) AdapterName,
Node.ID NodeID,
1 Enabled,
CONCAT
(
'FramesPerSecond=', Device.FramesPerSecond, '; ',
'LagTime=1; LeadTime=3; ',
'OutputMeasurements=', OutputMeasurement.SignalID, '; ',
'VariableList={input=', InputMeasurement.SignalID, '}; ',
'ExpressionText={input * 1.414}'
) ConnectionString
FROM
Device JOIN
Measurement OutputMeasurement ON
Measurement.DeviceID = Device.ID AND
Measurement.PointTag LIKE '%!MY_OUTPUT:%' JOIN
Measurement InputMeasurement ON ...
The source code for openPDC Manager can be found in the gsf repository.
https://github.com/GridProtectionAlliance/gsf/tree/master/Source/Libraries/GSF.TimeSeries/UI
https://github.com/GridProtectionAlliance/gsf/tree/master/Source/Libraries/GSF.PhasorProtocols/UI
In particular, have a look at the Adapter
class that serves as the data model for custom adapters.
https://github.com/GridProtectionAlliance/gsf/blob/10b5b05277d5c5caf70dcec3ac5340ae9cab71f5/Source/Libraries/GSF.TimeSeries/UI/DataModels/Adapter.cs#L527
Thanks,
Stephen