Add config-based database conversion.

This commit is contained in:
Joshua Lucas
2026-10-29 09:09:03 -05:00
parent 36636878bd
commit d5da5c6618
35 changed files with 8450 additions and 209 deletions

View File

@@ -0,0 +1,106 @@
# Leonard WTP Alarm Severity Tag Set Macro
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format:
name: csv
sep: " "
header: false
index: false
extension: mcr
quoting: 3 # No quoting
quotechar: null
escapechar: null
import:
filter:
columns: tagname
operations:
- operation: match
pattern: '\.AESeverity$'
columns:
command:
type: str
const: "&set"
tagname:
type: str
translate:
columns: tagname
operations:
- operation: radd
arg: $plc$.PLC.
value:
translate:
columns: tagname
operations:
- operation: replace
pattern: '.*?almPLCFault\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almBrokenLoop\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almHigh\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almHighHigh\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almLow\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almLowLow\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almOverRange\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almRateOfChange\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almUnderRange\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almFailToStrt\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almFailToStop\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almMotorFailure\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almSpeedDeviation\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almFailToClose\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almFailToOpen\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almPositionFailure\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almValveFailure\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?almPLCFault\.AESeverity$'
repl: "250"
- operation: replace
pattern: '.*?MY\.Alarm\.AESeverity$'
repl: "1000"
- operation: replace
pattern: '.*?YA\.Alarm\.AESeverity$'
repl: "1000"
- operation: replace
pattern: '.*?\.Alarm\.AESeverity$'
repl: "250"
export:
tagname:
translate:
columns: tagname
type:
const: ""
address:
const: ""
comment:
const: ""

View File

@@ -0,0 +1,139 @@
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format:
name: csv
sep: " "
header: false
index: false
extension: mcr
quoting: 3 # No quoting
quotechar: null
escapechar: null
import:
columns:
command:
type: str
const: "&set"
tagname:
type: str
translate:
columns: tagname
operations:
- operation: radd
arg: Captions.$plc$.PLC.
value:
type: str
translate:
columns: tagname
operations:
- operation: replace
pattern: '^WA3252_([A-Z]+)_\d+_(\d+[A-Z]?)_?([A-Z]+\d?)?.*'
repl: '"\1 \2 \3"'
- operation: replace
pattern: (AFD|PMP)
repl: Pump
- operation: replace
pattern: MTR
repl: Motor
- operation: replace
pattern: (FCV|FV)
repl: Valve
- operation: replace
pattern: (\wIT|TT)
repl: ""
- operation: replace
pattern: CP
repl: Control Panel
- operation: replace
pattern: FLT
repl: Filter
- operation: replace
pattern: GEN
repl: Generator
- operation: replace
pattern: NET
repl: Network Panel
- operation: replace
pattern: LSH
repl: Level Switch High
- operation: replace
pattern: (?<!U)PS
repl: Pressure Switch
- operation: replace
pattern: REC
repl: Recloser
- operation: replace
pattern: SD
repl: Smoke Detector
- operation: replace
pattern: SPD
repl: Surge Protector
- operation: replace
pattern: "[TX]FR"
repl: Transformer
- operation: replace
pattern: SI
repl: Speed
- operation: replace
pattern: FI
repl: Flow
- operation: replace
pattern: ZI
repl: Position
- operation: replace
pattern: VI
repl: "Vibration "
- operation: replace
pattern: PI
repl: Pressure
- operation: replace
pattern: MY
repl: E-Stop
- operation: replace
pattern: UA
repl: MPR Alarm
- operation: replace
pattern: UY
repl: MPR Trip
- operation: replace
pattern: MF
repl: Motor Fault
- operation: replace
pattern: LH
repl: Level High
- operation: replace
pattern: XA
repl: Alarm
- operation: replace
pattern: ZF
repl: Valve Fault
- operation: replace
pattern: WH
repl: Overtorque
- operation: replace
pattern: LL
repl: Level Low
- operation: replace
pattern: PL(?!C) # Negative lookahead: PL not followed by C
repl: Pressure Low
- operation: replace
pattern: SH
repl: Overspeed
- operation: replace
pattern: TH
repl: Temp High
- operation: replace
pattern: TL
repl: Temp Low
- operation: replace
pattern: J[AF]
repl: Power Fail
export:
tagname:
translate:
columns: tagname
type:
const: ""
address:
const: ""
comment:
const: ""

View File

@@ -0,0 +1,40 @@
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format:
name: csv
sep: " "
header: false
index: false
extension: mcr
quoting: 3 # No quoting
quotechar: null
escapechar: null
import:
columns:
command:
type: str
const: "&set"
tagname:
type: str
translate:
columns: tagname
operations:
- operation: radd
arg: Descriptions.$plc$.PLC.
value:
type: str
translate:
columns: comment
operations:
- operation: replace
pattern: "^(.*?):.*"
repl: '"\1"'
export:
tagname:
translate:
columns: tagname
type:
const: ""
address:
const: ""
comment:
const: ""

View File

@@ -0,0 +1,49 @@
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format:
name: csv
sep: " "
header: false
index: false
extension: mcr
quoting: 3 # No quoting
quotechar: null
escapechar: null
import:
columns:
command:
type: str
const: "&set"
tagname:
type: str
translate:
columns: tagname
operations:
- operation: radd
arg: Strings.$plc$.PLC.
value:
type: str
translate:
columns: tagname
operations:
- operation: replace
pattern: '.*?([A-Z])\d?\.On_Message'
repl: '"\1"'
- operation: replace
pattern: '^"H"$'
repl: '"High"'
- operation: replace
pattern: '^"L"$'
repl: '"Low"'
- operation: replace
pattern: '^"[A-Z]"$'
repl: '"Alarm"'
export:
tagname:
translate:
columns: tagname
type:
const: ""
address:
const: ""
comment:
const: ""

View File

@@ -0,0 +1,40 @@
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format:
name: csv
sep: " "
header: false
index: false
extension: mcr
quoting: 3 # No quoting
quotechar: null
escapechar: null
import:
columns:
command:
type: str
const: "&set"
tagname:
type: str
translate:
columns: tagname
operations:
- operation: radd
arg: Tagnames.$plc$.PLC.
value:
type: str
translate:
columns: tagname
operations:
- operation: replace
pattern: '(.*?)\.Tagname'
repl: '"\1"'
export:
tagname:
translate:
columns: tagname
type:
const: ""
address:
const: ""
comment:
const: ""

View File

@@ -0,0 +1,66 @@
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format:
name: csv
sep: " "
header: false
index: false
extension: mcr
quoting: 3 # No automatic quoting
quotechar: null
escapechar: null
export:
encoding: cp1252
import:
columns:
command:
type: str
const: "&set"
tagname:
type: str
translate:
columns: tagname
operations:
- operation: radd
arg: Units.$plc$.PLC.
value:
type: str
translate:
columns: tagname
operations:
- operation: replace
pattern: '^WA3252_[A-Z]+_\d+_\d+[A-Z]?_?([A-Z]+)?\d?.*'
repl: '"\1"'
- operation: replace
pattern: '"AI"'
repl: '"PPM"'
- operation: replace
pattern: '"FI"'
repl: '"GPM"'
- operation: replace
pattern: '"LI"'
repl: '"FT"'
- operation: replace
pattern: '"PI"'
repl: '"PSI"'
- operation: replace
pattern: '"SI"'
repl: '"%"'
- operation: replace
pattern: '"TI"'
repl: '"°F"'
- operation: replace
pattern: '"VI"'
repl: '"IN/S"'
- operation: replace
pattern: '("ZI"|"")'
repl: '"%"'
export:
tagname:
translate:
columns: tagname
type:
const: ""
address:
const: ""
comment:
const: ""

View File

@@ -0,0 +1,134 @@
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format: csv
import:
filter:
columns:
- name
- type
- address
columns:
Tag Name:
type: str
translate:
columns: name
operations:
# Replace any character that is not a letter, underscore, number, or
# square bracket with an underscore.
operation: replace
pattern: '[^\w\d\[\]]'
repl: _
Address:
type: float
parse:
# Add a leading zero to one-digit bit addresses, e.g. 400001.1 ->
# 400001.01.
operation: replace
pattern: '\.(\d\"?,?)$'
repl: '.0\1'
translate:
columns: address
operations:
operation: address_iec_to_modbus
Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
translate:
columns: type
operations:
operation: type_iec_to_opcua
Respect Data Type:
type: int
enum:
- 0
- 1
const: 1
Client Access:
type: str
enum:
- R
- W
- R/W
const: R/W
Scan Rate:
type: int
const: 1000
Scaling:
type: str
enum:
- ""
- Linear
- Square Root
const: ""
Raw Low:
type: float
const: nan
Raw High:
type: float
const: nan
Scaled Low:
type: float
const: nan
Scaled High:
type: float
const: nan
Scaled Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
const: ""
Clamp Low:
type: float
const: nan
Clamp High:
type: float
const: nan
Eng Units:
type: str
const: ""
Description:
type: str
translate:
columns: comment
Negate Value:
type: str
const: nan
export:
tagname:
translate:
columns: Tag Name
type:
translate:
columns: Data Type
operations:
operation: type_opcua_to_iec
address:
translate:
columns: Address
operations:
operation: address_modbus_to_iec
comment:
translate:
columns: Description

View File

@@ -0,0 +1,134 @@
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format:
name: csv
export:
index: false
import:
filter:
columns: tagname
operations:
operation: match
pattern: 'almPLCFault\.ALRM$'
columns:
Tag Name:
type: str
translate:
columns: tagname
operations:
# Replace with an underscore any character that is not a letter,
# underscore, number, period, or square bracket.
- operation: replace
pattern: '[^\w\d\.\[\]]'
repl: _
- operation: replace
pattern: 'almPLCFault\.ALRM'
repl: ""
- operation: add
arg: $extension$
Address:
type: str
translate:
columns: name
operations:
- operation: format
arg: 04d
- operation: radd
arg: S
Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
const: String
Respect Data Type:
type: int
enum:
- 0
- 1
const: 1
Client Access:
type: str
enum:
- R
- W
- R/W
const: R/W
Scan Rate:
type: int
const: 100000
Scaling:
type: str
enum:
- ""
- Linear
- Square Root
const: ""
Raw Low:
type: float
const: ""
Raw High:
type: float
const: ""
Scaled Low:
type: float
const: ""
Scaled High:
type: float
const: ""
Scaled Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
const: ""
Clamp Low:
type: float
const: ""
Clamp High:
type: float
const: ""
Eng Units:
type: str
const: ""
Description:
type: str
translate:
columns: comment
Negate Value:
type: str
const: ""
export:
tagname:
translate:
columns: Tag Name
type:
translate:
columns: Data Type
operations:
operation: type_opcua_to_iec
address:
translate:
columns: Address
comment:
translate:
columns: Description

View File

@@ -0,0 +1,134 @@
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format:
name: csv
export:
index: false
import:
filter:
columns: tagname
operations:
operation: match
pattern: 'almPLCFault\.ALRM$'
columns:
Tag Name:
type: str
translate:
columns: tagname
operations:
# Replace with an underscore any character that is not a letter,
# underscore, number, period, or square bracket.
- operation: replace
pattern: '[^\w\d\.\[\]]'
repl: _
- operation: replace
pattern: 'almPLCFault\.ALRM'
repl: ""
- operation: add
arg: $extension$
Address:
type: str
translate:
columns: name
operations:
- operation: format
arg: 04d
- operation: radd
arg: S
Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
const: String
Respect Data Type:
type: int
enum:
- 0
- 1
const: 1
Client Access:
type: str
enum:
- R
- W
- R/W
const: R/W
Scan Rate:
type: int
const: 100000
Scaling:
type: str
enum:
- ""
- Linear
- Square Root
const: ""
Raw Low:
type: float
const: ""
Raw High:
type: float
const: ""
Scaled Low:
type: float
const: ""
Scaled High:
type: float
const: ""
Scaled Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
const: ""
Clamp Low:
type: float
const: ""
Clamp High:
type: float
const: ""
Eng Units:
type: str
const: ""
Description:
type: str
translate:
columns: comment
Negate Value:
type: str
const: ""
export:
tagname:
translate:
columns: Tag Name
type:
translate:
columns: Data Type
operations:
operation: type_opcua_to_iec
address:
translate:
columns: Address
comment:
translate:
columns: Description

View File

@@ -0,0 +1,134 @@
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format:
name: csv
export:
index: false
import:
filter:
columns: tagname
operations:
operation: match
pattern: 'almPLCFault\.ALRM$'
columns:
Tag Name:
type: str
translate:
columns: tagname
operations:
# Replace with an underscore any character that is not a letter,
# underscore, number, period, or square bracket.
- operation: replace
pattern: '[^\w\d\.\[\]]'
repl: _
- operation: replace
pattern: 'almPLCFault\.ALRM'
repl: ""
- operation: add
arg: On_$extension$
Address:
type: str
translate:
columns: name
operations:
- operation: format
arg: 04d
- operation: radd
arg: S
Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
const: String
Respect Data Type:
type: int
enum:
- 0
- 1
const: 1
Client Access:
type: str
enum:
- R
- W
- R/W
const: R/W
Scan Rate:
type: int
const: 100000
Scaling:
type: str
enum:
- ""
- Linear
- Square Root
const: ""
Raw Low:
type: float
const: ""
Raw High:
type: float
const: ""
Scaled Low:
type: float
const: ""
Scaled High:
type: float
const: ""
Scaled Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
const: ""
Clamp Low:
type: float
const: ""
Clamp High:
type: float
const: ""
Eng Units:
type: str
const: ""
Description:
type: str
translate:
columns: comment
Negate Value:
type: str
const: ""
export:
tagname:
translate:
columns: Tag Name
type:
translate:
columns: Data Type
operations:
operation: type_opcua_to_iec
address:
translate:
columns: Address
comment:
translate:
columns: Description

View File

@@ -0,0 +1,134 @@
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format:
name: csv
export:
index: false
import:
filter:
columns: tagname
operations:
operation: match
pattern: 'almPLCFault\.ALRM$'
columns:
Tag Name:
type: str
translate:
columns: tagname
operations:
# Replace with an underscore any character that is not a letter,
# underscore, number, period, or square bracket.
- operation: replace
pattern: '[^\w\d\.\[\]]'
repl: _
- operation: replace
pattern: 'almPLCFault\.ALRM'
repl: ""
- operation: add
arg: $extension$
Address:
type: str
translate:
columns: name
operations:
- operation: format
arg: 04d
- operation: radd
arg: S
Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
const: String
Respect Data Type:
type: int
enum:
- 0
- 1
const: 1
Client Access:
type: str
enum:
- R
- W
- R/W
const: R/W
Scan Rate:
type: int
const: 100000
Scaling:
type: str
enum:
- ""
- Linear
- Square Root
const: ""
Raw Low:
type: float
const: ""
Raw High:
type: float
const: ""
Scaled Low:
type: float
const: ""
Scaled High:
type: float
const: ""
Scaled Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
const: ""
Clamp Low:
type: float
const: ""
Clamp High:
type: float
const: ""
Eng Units:
type: str
const: ""
Description:
type: str
translate:
columns: comment
Negate Value:
type: str
const: ""
export:
tagname:
translate:
columns: Tag Name
type:
translate:
columns: Data Type
operations:
operation: type_opcua_to_iec
address:
translate:
columns: Address
comment:
translate:
columns: Description

View File

@@ -0,0 +1,134 @@
$schema: ../../../src/AuDage/extensions/assets/schema.yaml
format:
name: csv
export:
index: false
import:
filter:
columns: tagname
operations:
operation: match
pattern: '\.(VALU|PO_SP|VFDSP)$'
columns:
Tag Name:
type: str
translate:
columns: tagname
operations:
# Replace with an underscore any character that is not a letter,
# underscore, number, period, or square bracket.
- operation: replace
pattern: '[^\w\d\.\[\]]'
repl: _
- operation: replace
pattern: '\.(VALU|PO_SP|VFDSP)$'
repl: "."
- operation: add
arg: $extension$
Address:
type: str
translate:
columns: name
operations:
- operation: format
arg: 04d
- operation: radd
arg: S
Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
const: String
Respect Data Type:
type: int
enum:
- 0
- 1
const: 1
Client Access:
type: str
enum:
- R
- W
- R/W
const: R/W
Scan Rate:
type: int
const: 100000
Scaling:
type: str
enum:
- ""
- Linear
- Square Root
const: ""
Raw Low:
type: float
const: ""
Raw High:
type: float
const: ""
Scaled Low:
type: float
const: ""
Scaled High:
type: float
const: ""
Scaled Data Type:
type: str
enum:
- Boolean
- Char
- Byte
- Short
- Word
- Long
- DWord
- LongLong
- QWord
- Float
- Double
- String
const: ""
Clamp Low:
type: float
const: ""
Clamp High:
type: float
const: ""
Eng Units:
type: str
const: ""
Description:
type: str
translate:
columns: comment
Negate Value:
type: str
const: ""
export:
tagname:
translate:
columns: Tag Name
type:
translate:
columns: Data Type
operations:
operation: type_opcua_to_iec
address:
translate:
columns: Address
comment:
translate:
columns: Description