{
  "productInfo" : {
    "company" : "HighByte",
    "product" : "IntelligenceHub",
    "version" : "4.4.1",
    "build" : "2026.4.14.7",
    "stage" : "Release"
  },
  "project" : {
    "version" : 13,
    "connections" : [ {
      "name" : "ip21",
      "uri" : "ip21://{{System.Variables.ip21_host}}:45390",
      "tags" : [ "starter_ip21" ],
      "writes" : {
        "flattenModeledValues" : false
      },
      "writeThrottle" : {
        "enabled" : false,
        "maxBatchSizePerTarget" : 1000,
        "batchDelay" : {
          "duration" : 20,
          "units" : "Milliseconds"
        }
      },
      "subscriptions" : { },
      "storeForward" : {
        "enabled" : false,
        "maxEntries" : 100,
        "waitOnFailureInterval" : {
          "duration" : 1,
          "units" : "Seconds"
        }
      },
      "settings" : {
        "connectionString" : "Driver={AspenTech SQLplus};Host=localhost;Port=10014;READONLY=Yes",
        "connectTimeoutSeconds" : 5,
        "requestTimeoutMS" : 120000,
        "compression" : "GZIP",
        "password" : {
          "type" : "Reference",
          "value" : "pi21_token"
        }
      }
    } ],
    "inputs" : [ {
      "name" : "ip21_input_last_values",
      "connection" : "ip21",
      "type" : "ip21",
      "qualifier" : {
        "type" : "query",
        "command" : "SELECT NAME, IP_VALUE, IP_VALUE_TIME, IP_VALUE_QUALITY FROM IP_AnalogDef WHERE (NAME = 'PP_InFlow1' OR NAME = 'PP_OutFlow')"
      },
      "cacheLifetime" : {
        "enabled" : false
      },
      "template" : {
        "type" : "Off"
      },
      "parameters" : {
        "type" : "EmptyParameters"
      }
    }, {
      "name" : "ip21_input_metadata_tags",
      "connection" : "ip21",
      "type" : "ip21",
      "qualifier" : {
        "type" : "query",
        "command" : "SELECT NAME, IP_DESCRIPTION, IP_TAG_TYPE, IP_ENG_UNITS, IP_HIGH_HIGH_LIMIT, IP_LOW_LOW_LIMIT FROM IP_AnalogDef WHERE (NAME LIKE 'A1%' OR NAME LIKE 'C1%' OR NAME LIKE 'CA%'  OR NAME LIKE 'FC%' OR NAME LIKE 'FI%' OR NAME LIKE 'HC%' OR NAME LIKE 'II%' OR NAME LIKE 'LC%'  OR NAME LIKE 'PC%' OR NAME LIKE 'PI%' OR NAME LIKE 'TI%')\nORDER BY NAME;"
      },
      "cacheLifetime" : {
        "enabled" : false
      },
      "template" : {
        "type" : "Off"
      },
      "parameters" : {
        "type" : "EmptyParameters"
      }
    }, {
      "name" : "ip21_input_tag_list",
      "connection" : "ip21",
      "type" : "ip21",
      "qualifier" : {
        "type" : "query",
        "command" : "SELECT NAME FROM IP_AnalogDef WHERE (IP_VALUE IS NOT NULL AND IP_VALUE_TIME IS NOT NULL AND NAME LIKE 'PP_%Flow%')"
      },
      "cacheLifetime" : {
        "enabled" : true,
        "interval" : {
          "duration" : 1,
          "units" : "Days"
        }
      },
      "template" : {
        "type" : "Off"
      },
      "parameters" : {
        "type" : "EmptyParameters"
      }
    } ],
    "outputs" : [ ],
    "modeling" : {
      "models" : [ {
        "name" : "starter_last_values",
        "description" : "This is an example provided for modeling last values obtained per process variable from a historian.  The process variables pertain to a pump.  The Model is a component of a starter solution.\n",
        "groupAs" : "/start_hist_read_last_values",
        "tags" : [ "starter_canary", "starter_ip21", "starter_pi_af", "starter_pi_da" ],
        "attributes" : [ {
          "attributeType" : "Internal",
          "name" : "assetName",
          "nullable" : true,
          "required" : false,
          "array" : false,
          "internalType" : "String"
        }, {
          "attributeType" : "Internal",
          "name" : "assetPath",
          "nullable" : true,
          "required" : false,
          "array" : false,
          "internalType" : "String"
        }, {
          "attributeType" : "Internal",
          "name" : "flowRate",
          "nullable" : false,
          "required" : true,
          "array" : false,
          "internalType" : "Real64"
        }, {
          "attributeType" : "Internal",
          "name" : "flowRateUOM",
          "nullable" : false,
          "required" : false,
          "array" : false,
          "defaultValue" : "gallons per minute",
          "internalType" : "String"
        }, {
          "attributeType" : "Internal",
          "name" : "state",
          "nullable" : false,
          "required" : false,
          "array" : false,
          "internalType" : "String"
        }, {
          "attributeType" : "Internal",
          "name" : "time",
          "nullable" : false,
          "required" : false,
          "array" : false,
          "internalType" : "DateTime"
        }, {
          "attributeType" : "Internal",
          "name" : "source",
          "nullable" : false,
          "required" : false,
          "array" : false,
          "internalType" : "String"
        } ]
      } ],
      "instances" : [ ]
    },
    "conditions" : [ ],
    "functions" : [ ],
    "tags" : [ {
      "name" : "starter_ip21"
    } ],
    "pipelines" : [ {
      "name" : "starter_output_ip21_last_values_to_mqtt",
      "description" : "This Pipeline obtains last values from IP.21 Historian and models the data before publishing the data to the Intelligence Hub MQTT Broker.",
      "groupAs" : "/start_hist_read_last_values",
      "tags" : [ "starter_ip21" ],
      "inputStages" : [ "read_ip21_values" ],
      "stages" : [ {
        "name" : "breakup_array",
        "display" : {
          "position" : {
            "x" : 690,
            "y" : 0
          }
        },
        "description" : "This Stage breaks up the values array.",
        "config" : {
          "type" : ".BreakupConfig",
          "breakupType" : "array",
          "depth" : 1
        },
        "outputs" : [ "apply_model" ]
      }, {
        "name" : "to_mqtt",
        "display" : {
          "position" : {
            "x" : 2040,
            "y" : 0
          }
        },
        "description" : "This Stage publishes the payload to the Intelligence Hub MQTT broker which is being used to view the output.",
        "config" : {
          "type" : ".DynamicWriteConfig",
          "failureOutputs" : [ ],
          "connectionReference" : "{{Connection.mqtt}}",
          "qualifier" : {
            "topic" : "Last_Values_IP21",
            "qos" : 0,
            "namedRoot" : false,
            "retained" : false,
            "breakupArrays" : false,
            "filterList" : [ "_model", "_name", "_timestamp" ]
          },
          "qualifierExpression" : "",
          "writeReturn" : "ignore"
        },
        "outputs" : [ ]
      }, {
        "name" : "read_ip21_values",
        "display" : {
          "position" : {
            "x" : 240,
            "y" : 0
          }
        },
        "description" : "This Stage reads last values from IP.21.",
        "config" : {
          "type" : ".ReadConfig",
          "failureOutputs" : [ ],
          "reference" : {
            "type" : "Input",
            "name" : "ip21_input_last_values",
            "path" : "",
            "params" : { },
            "connectionName" : "ip21"
          }
        },
        "outputs" : [ "breakup_array" ]
      }, {
        "name" : "apply_model",
        "display" : {
          "position" : {
            "x" : 1140,
            "y" : 0
          }
        },
        "description" : "This Stage applies the desired schema for the current values payload.",
        "config" : {
          "type" : ".ModelConfig",
          "model" : "starter_last_values",
          "objectName" : "",
          "initExpression" : "",
          "attributes" : [ {
            "name" : "assetName",
            "expression" : {
              "type" : "PipelineStageReference",
              "stageReference" : "event.value.NAME"
            }
          }, {
            "name" : "assetPath",
            "expression" : {
              "type" : "PipelineStageReference",
              "stageReference" : ""
            }
          }, {
            "name" : "flowRate",
            "expression" : {
              "type" : "JavaScript",
              "expression" : "var flow = parseFloat(event.value.IP_VALUE.toFixed(2));\r\nif (flow == null) {\r\n        flow = 0;\r\n}\r\nreturn flow;"
            }
          }, {
            "name" : "flowRateUOM",
            "expression" : {
              "type" : "PipelineStageReference",
              "stageReference" : ""
            }
          }, {
            "name" : "state",
            "expression" : {
              "type" : "JavaScript",
              "expression" : "var flow = parseFloat(event.value.IP_VALUE.toFixed(2));\r\nvar state;\r\nif (flow ===0 || flow === null) {\r\n        state = 'Down';\r\n} else {\r\n        state = 'Running';\r\n}\r\nreturn state;"
            }
          }, {
            "name" : "time",
            "expression" : {
              "type" : "JavaScript",
              "expression" : "var dateIn = event.value.IP_VALUE_TIME;\r\nvar months = {\r\n  JAN: '01', FEB: '02', MAR: '03', APR: '04', MAY: '05', JUN: '06',\r\n  JUL: '07', AUG: '08', SEP: '09', OCT: '10', NOV: '11', DEC: '12'\r\n};\r\nfunction convertToISO(dateStr) {\r\n  var [datePart, timePart] = dateStr.split(\" \");\r\n  var [day, monthAbbr, year] = datePart.split(\"-\");\r\n  var fullYear = 2000 + parseInt(year);\r\n  var month = months[monthAbbr.toUpperCase()];\r\n  return `${fullYear}-${month}-${day}T${timePart}`;\r\n}\r\nvar convertedDate = convertToISO(dateIn);\r\nreturn convertedDate;"
            }
          }, {
            "name" : "source",
            "expression" : {
              "type" : "PipelineStageReference",
              "stageReference" : ""
            },
            "defaultValue" : "Aspen InfoPlus.21"
          } ]
        },
        "outputs" : [ "size_buffer" ]
      }, {
        "name" : "size_buffer",
        "display" : {
          "position" : {
            "x" : 1590,
            "y" : 0
          }
        },
        "description" : "A buffer Stage is often used before writing data to a Data Lake or Data Warehouse.\n",
        "config" : {
          "type" : ".SizedBufferConfig",
          "windowExpression" : "stage.setBufferKey(null);",
          "windowSize" : 10,
          "timeout" : {
            "duration" : 0,
            "units" : "Seconds"
          }
        },
        "outputs" : [ "to_mqtt" ]
      } ],
      "trackActivity" : false,
      "triggers" : [ {
        "name" : "polled_trigger",
        "display" : {
          "position" : {
            "x" : -450,
            "y" : 0
          }
        },
        "description" : "The trigger Stage initiates the Pipeline.",
        "config" : {
          "type" : ".TriggerPolled",
          "enabled" : true,
          "interval" : {
            "duration" : 5,
            "units" : "Seconds"
          },
          "mode" : "interval"
        }
      } ],
      "errorHandler" : {
        "type" : "default"
      }
    } ],
    "namespace" : [ ]
  },
  "network" : {
    "groups" : [ ],
    "hubs" : [ ]
  }
}