<?xml version="1.0" encoding="utf-8"?>
<template desc="Equipment template">

  <param name="type">
    <string name="name">Pump</string>
    <string name="ref">Pump</string>
    <string name="blank"></string>
    <string name="wildcard"></string>
  </param>

  <!-- ===================================================
        Input Section - Equipment
       ===================================================
  -->
  <input name="equipment" file="equip.dbf" desc="Equipment Database">
    <field name="name"></field>
    <field name="cluster"></field>
    <field name="type"></field>
    <field name="iodevice"></field>
    <array name="iodevice_list">{Split('{iodevice}',',')}</array>
    <field name="tagprefix"></field>
    <field name="area"></field>
    <field name="page"></field>
    <array name="page_list">{Split('{page}',',')}</array>
    <field name="help"></field>
    <field name="location"></field>
    <field name="comment"></field>
    <field name="scheduled"></field>
    <field name="defstate"></field>
    <field name="param"></field>
    <field name="custom1"></field>
    <field name="custom2"></field>
    <field name="custom3"></field>
    <field name="custom4"></field>
    <field name="custom5"></field>
    <field name="custom6"></field>
    <field name="custom7"></field>
    <field name="custom8"></field>
  </input>

  <!-- ===================================================
        Output Section - Tags
       ===================================================
  -->

  <output name="Var.Run" file="variable.dbf" filter="'{equipment.type}={type.name}'">
    <field name="linked">1</field>
    <field name="editcode">11</field>
    <field name="taggenlink" load="true">Pump.Run</field>
    <field name="name" key="true">{equipment.tagprefix}_Run</field>
    <field name="type">DIGITAL</field>
    <field name="unit">{equipment.iodevice}</field>
    <field name="addr">{equipment.tagprefix}.run</field>
    <field name="comment">{equipment.comment} run control - On/Off</field>
    <field name="cluster">{equipment.cluster}</field>
    <field name="item">RunCommand</field>
    <field name="equip">{equipment.name}</field>
    <field name="historian">TRUE</field>
  </output>

  <output name="Var.Mode" file="variable.dbf" filter="'{equipment.type}={type.name}'">
    <field name="linked">1</field>
    <field name="editcode">11</field>
    <field name="taggenlink" load="true">Pump.Mode</field>
    <field name="name" key="true">{equipment.tagprefix}_Mode</field>
    <field name="type">DIGITAL</field>
    <field name="unit">{equipment.iodevice}</field>
    <field name="addr">{equipment.tagprefix}.mode</field>
    <field name="comment">{equipment.comment} mode - Auto/Manual</field>
    <field name="cluster">{equipment.cluster}</field>
    <field name="item">Mode</field>
    <field name="equip">{equipment.name}</field>
    <field name="historian">TRUE</field>
  </output>

  <output name="Var.Fault" file="variable.dbf" filter="'{equipment.type}={type.name}'">
    <field name="linked">1</field>
    <field name="editcode">11</field>
    <field name="taggenlink" load="true">Pump.Fault</field>
    <field name="name" key="true">{equipment.tagprefix}_Fault</field>
    <field name="type">DIGITAL</field>
    <field name="unit">{equipment.iodevice}</field>
    <field name="addr">{equipment.tagprefix}.fault</field>
    <field name="comment">{equipment.comment} fault - General Fault</field>
    <field name="cluster">{equipment.cluster}</field>
    <field name="item">Fault</field>
    <field name="equip">{equipment.name}</field>
    <field name="historian">TRUE</field>
  </output>

  <output name="Var.CircuitBreaker" file="variable.dbf" filter="'{equipment.type}={type.name}'">
    <field name="linked">1</field>
    <field name="editcode">11</field>
    <field name="taggenlink" load="true">Pump.CB</field>
    <field name="name" key="true">{equipment.tagprefix}_CB</field>
    <field name="type">DIGITAL</field>
    <field name="unit">{equipment.iodevice}</field>
    <field name="addr">{equipment.tagprefix}.cb</field>
    <field name="comment">{equipment.comment} circuit breaker - open/closed</field>
    <field name="cluster">{equipment.cluster}</field>
    <field name="item">CircuitBreaker</field>
    <field name="equip">{equipment.name}</field>
    <field name="historian">TRUE</field>
  </output>

  <output name="Var.Speed" file="variable.dbf" filter="'{equipment.type}={type.name}'">
    <field name="linked">1</field>
    <field name="editcode">11</field>
    <field name="taggenlink" load="true">Pump.Speed</field>
    <field name="name" key="true">{equipment.tagprefix}_Speed</field>
    <field name="type">REAL</field>
    <field name="raw_zero">0</field>
    <field name="raw_full">32767</field>
    <field name="eng_zero">0</field>
    <field name="eng_full">100</field>
    <field name="eng_units">%</field>
    <field name="format">###.# EU</field>
    <field name="unit">{equipment.iodevice}</field>
    <field name="addr">{equipment.tagprefix}.speed</field>
    <field name="comment">{equipment.comment} speed (0 - 100%)</field>
    <field name="cluster">{equipment.cluster}</field>
    <field name="item">Speed</field>
    <field name="equip">{equipment.name}</field>
    <field name="historian">TRUE</field>
  </output>

  <output name="Var.Temperature" file="variable.dbf" filter="'{equipment.type}={type.name}'">
    <field name="linked">1</field>
    <field name="editcode">11</field>
    <field name="taggenlink" load="true">Pump.Temperature</field>
    <field name="name" key="true">{equipment.tagprefix}_Temperature</field>
    <field name="type">REAL</field>
    <field name="raw_zero">0</field>
    <field name="raw_full">32767</field>
    <field name="eng_zero">0</field>
    <field name="eng_full">320</field>
    <field name="eng_units">deg C</field>
    <field name="format">###.# EU</field>
    <field name="unit">{equipment.iodevice}</field>
    <field name="addr">{equipment.tagprefix}.temperature</field>
    <field name="comment">{equipment.comment} temperature (0 - 320 deg C)</field>
    <field name="cluster">{equipment.cluster}</field>
    <field name="item">Temperature</field>
    <field name="equip">{equipment.name}</field>
    <field name="historian">TRUE</field>
  </output>

  <!-- ===================================================
        Output Section - Alarms
       ===================================================
  -->

  <output name="Alarm.Mode" file="digalm.dbf" filter="'{equipment.type}={type.name}'">
    <field name="linked">1</field>
    <field name="editcode"></field>
    <field name="taggenlink" load="true">Pump.mode</field>

    <field name="cluster">{equipment.cluster}</field>
    <field name="tag" key="true">{equipment.tagprefix}_Mode</field>
    <field name="name">{equipment.name}</field>
    <field name="desc">Changed to manual mode</field>
    <field name="var_a">{equipment.tagprefix}_Mode</field>
    <field name="var_b"></field>
    <field name="category">{equipment.custom6}</field>
    <field name="help">{equipment.help}</field>
    <field name="area">{equipment.area}</field>
    <field name="comment">{equipment.comment} - Manual mode</field>
    <field name="item">Manual</field>
    <field name="equip">{equipment.name}</field>
    <field name="historian">TRUE</field>
  </output>

  <output name="Alarm.Fault" file="digalm.dbf" filter="'{equipment.type}={type.name}'">
    <field name="linked">1</field>
    <field name="editcode"></field>
    <field name="taggenlink" load="true">Pump.fault</field>

    <field name="cluster">{equipment.cluster}</field>
    <field name="tag" key="true">{equipment.tagprefix}_Fault</field>
    <field name="name">{equipment.name}</field>
    <field name="desc">General fault</field>
    <field name="var_a">{equipment.tagprefix}_Fault</field>
    <field name="var_b"></field>
    <field name="category">{equipment.custom6}</field>
    <field name="help">{equipment.help}</field>
    <field name="area">{equipment.area}</field>
    <field name="comment">{equipment.comment} - General fault</field>
    <field name="item">Fault</field>
    <field name="equip">{equipment.name}</field>
    <field name="historian">TRUE</field>
  </output>

  <output name="Alarm.CB" file="digalm.dbf" filter="'{equipment.type}={type.name}'">
    <field name="linked">1</field>
    <field name="editcode"></field>
    <field name="taggenlink" load="true">Pump.CB</field>

    <field name="cluster">{equipment.cluster}</field>
    <field name="tag" key="true">{equipment.tagprefix}_CB</field>
    <field name="name">{equipment.name}</field>
    <field name="desc">Circuit Breaker Open</field>
    <field name="var_a">not {equipment.tagprefix}_CB</field>
    <field name="var_b"></field>
    <field name="category">{equipment.custom6}</field>
    <field name="help">{equipment.help}</field>
    <field name="area">{equipment.area}</field>
    <field name="comment">{equipment.comment} - Circuit Breaker open</field>
    <field name="item">CircuitBreaker</field>
    <field name="equip">{equipment.name}</field>
    <field name="historian">TRUE</field>
  </output>

  <output name="Alarm.Speed" file="anaalm.dbf" filter="'{equipment.type}={type.name}'">
    <field name="linked">1</field>
    <field name="editcode"></field>
    <field name="taggenlink" load="true">Pump.speed</field>

    <field name="cluster">{equipment.cluster}</field>
    <field name="tag" key="true">{equipment.tagprefix}_Speed</field>
    <field name="name">{equipment.comment} Speed</field>
    <field name="var">{equipment.tagprefix}_Speed</field>
    <field name="help">{equipment.help}</field>
    <field name="area">{equipment.area}</field>
    <field name="comment">{equipment.comment} Speed</field>

    <field name="highhigh">{equipment.custom1}</field>
    <field name="high">{equipment.custom2}</field>
    <field name="low">{equipment.custom3}</field>
    <field name="lowlow">{equipment.custom4}</field>
    <field name="deadband">{equipment.custom5}</field>
    <field name="category">{equipment.custom6}</field>
    <field name="item">Speed</field>
    <field name="equip">{equipment.name}</field>
    <field name="historian">TRUE</field>
  </output>

  <output name="Alarm.Temperature" file="anaalm.dbf" filter="'{equipment.type}={type.name}'">
    <field name="linked">1</field>
    <field name="editcode"></field>
    <field name="taggenlink" load="true">Pump.alarmtemperature</field>

    <field name="cluster">{equipment.cluster}</field>
    <field name="tag" key="true">{equipment.tagprefix}_Temperature</field>
    <field name="name">{equipment.comment} Temperature</field>
    <field name="var">{equipment.tagprefix}_Temperature</field>
    <field name="help">{equipment.help}</field>
    <field name="area">{equipment.area}</field>
    <field name="comment">{equipment.comment} Temperature</field>

    <field name="highhigh">200</field>
    <field name="high">175</field>
    <field name="deadband">5</field>
    <field name="category">{equipment.custom6}</field>
    <field name="item">Temperature</field>
    <field name="equip">{equipment.name}</field>
    <field name="historian">TRUE</field>
  </output>

  <!-- ===================================================
        Output Section - Trends
       ===================================================
  -->

  <output name="Trend.Speed" file="trend.dbf" filter="'{equipment.type}={type.name}'">
     <field name="taggenlink" load="true">Pump.speed</field> 
     <field name="linked">1</field> 
     <field name="editcode">9</field> 
     <field name="name" key="true">{equipment.tagprefix}_Speed</field> 
     <field name="expr">{equipment.tagprefix}_Speed</field> 
     <field name="sampleper">0.5</field> 
     <field name="files">7</field> 
     <field name="period">24:00:00</field> 
     <field name="type">TRN_PERIODIC</field> 
     <field name="comment">{equipment.comment} - Speed</field> 
     <field name="cluster">{equipment.cluster}</field>
     <field name="item">Speed</field>
     <field name="equip">{equipment.name}</field>
     <field name="storMethod">Floating Point (8-byte samples)</field>
  </output>

  <output name="Trend.Temperature" file="trend.dbf" filter="'{equipment.type}={type.name}'">
     <field name="taggenlink" load="true">Pump.temperature</field> 
     <field name="linked">1</field> 
     <field name="editcode">9</field> 
     <field name="name" key="true">{equipment.tagprefix}_Temperature</field> 
     <field name="expr">{equipment.tagprefix}_Temperature</field> 
     <field name="sampleper">0.5</field> 
     <field name="files">7</field> 
     <field name="period">24:00:00</field> 
     <field name="type">TRN_PERIODIC</field> 
     <field name="comment">{equipment.comment} - Temperature</field> 
     <field name="cluster">{equipment.cluster}</field>
     <field name="item">Temperature</field>
     <field name="equip">{equipment.name}</field>
     <field name="storMethod">Floating Point (8-byte samples)</field>
  </output>

</template>
