ASCII File Reader Example
-
I am trying to use the ASCII File reader and I am not having any luck. I can get it to work on ScadaBR, but Mango has a different scheme of extracting the data. I have searched this forum and looked through the documentation, but I cannot find any example that helps better explain the Point indentifier and Value fields of the point configuration.
I am a long time user of the Original Mango and ScadaBR and I am in the process of creating a Demo for a commercial opportunity. If anyone could guide me to a more detailed explanation or example of this data source, I would greatly appreciate it.
-
Hi jvaughters,
Here's an example ASCII file reader data source. All that's really required is that the point identifier and the value be capture groups in the value regex, and that the point identifier match the captured group the point identifier index is configured to. You could have a regex like
().*
with an empty point identifier (with point identifier index 1) and a value regex of 0 to capture entire lines into a point.An example:
{ "dataSources":[ { "xid":"DS_bb9fe2d4-0686-4de4-8a2d-d0443f99772c", "name":"FileReader", "enabled":true, "type":"ASCII FILE", "alarmLevels":{ "POINT_READ_PATTERN_MISMATCH_EVENT":"URGENT", "POLL_ABORTED":"URGENT", "DATA_SOURCE_EXCEPTION":"URGENT", "POINT_READ_EXCEPTION":"URGENT" }, "purgeType":"YEARS", "filePath":"C:\\IA\\Days\\7-2-18\\file.txt", "updatePeriodType":2, "updatePeriods":5, "editPermission":"", "purgeOverride":false, "purgePeriod":1 } ], "dataPoints":[ { "xid":"DP_5f0311c2-4d02-4798-a5ae-e4083f640ca7", "name":"asdf", "enabled":true, "loggingType":"ALL", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"AVERAGE", "purgeType":"YEARS", "pointLocator":{ "dataType":"NUMERIC", "hasTimestamp":false, "pointIdentifier":"asdf", "pointIdentifierIndex":1, "timestampFormat":"", "timestampIndex":0, "valueIndex":2, "valueRegex":"(asdf): (.*)" }, "eventDetectors":[ ], "plotType":"SPLINE", "rollup":"NONE", "unit":"", "templateXid":"Numeric_Default", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"IMAGE", "timePeriodType":"DAYS", "numberOfPeriods":1 }, "dataSourceXid":"DS_bb9fe2d4-0686-4de4-8a2d-d0443f99772c", "defaultCacheSize":1, "deviceName":"FileReader", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":1, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"ANALOG", "useUnitAsSuffix":true, "unit":"", "renderedUnit":"", "format":"0.00" }, "tolerance":0.0 }, { "xid":"DP_7c3f5d37-ba1d-4248-8313-fc5c0f3a6748", "name":"bsdf", "enabled":true, "loggingType":"ALL", "intervalLoggingPeriodType":"MINUTES", "intervalLoggingType":"AVERAGE", "purgeType":"YEARS", "pointLocator":{ "dataType":"NUMERIC", "hasTimestamp":false, "pointIdentifier":"bsdf", "pointIdentifierIndex":1, "timestampFormat":"", "timestampIndex":0, "valueIndex":2, "valueRegex":"(bsdf): (.*)" }, "eventDetectors":[ ], "plotType":"SPLINE", "rollup":"NONE", "unit":"", "templateXid":"Numeric_Default", "simplifyType":"NONE", "chartColour":"", "chartRenderer":{ "type":"IMAGE", "timePeriodType":"DAYS", "numberOfPeriods":1 }, "dataSourceXid":"DS_bb9fe2d4-0686-4de4-8a2d-d0443f99772c", "defaultCacheSize":1, "deviceName":"FileReader", "discardExtremeValues":false, "discardHighLimit":1.7976931348623157E308, "discardLowLimit":-1.7976931348623157E308, "intervalLoggingPeriod":1, "intervalLoggingSampleWindowSize":0, "overrideIntervalLoggingSamples":false, "preventSetExtremeValues":false, "purgeOverride":false, "purgePeriod":1, "readPermission":"", "setExtremeHighLimit":1.7976931348623157E308, "setExtremeLowLimit":-1.7976931348623157E308, "setPermission":"", "tags":{ }, "textRenderer":{ "type":"ANALOG", "useUnitAsSuffix":true, "unit":"", "renderedUnit":"", "format":"0.00" }, "tolerance":0.0 } ] }
imported a file with the contents
asdf: 1.2 bsdf: 2.3
-
Phil,
Awesome, Thanks! I solved the immediate issue by using the database data source, but I did want to understand how the text file data source worked, so thanks for the import code, I will give it a look.