{
  "__ceresflows_export": "1.0",
  "name": "pH Control",
  "description": "pH control. At low levels, add pH+, and at high pH-",
  "mode": "",
  "timeoutSec": 0,
  "onTimeout": "PAUSE",
  "hardwareDependencies": {
    "19d4a07f-28cb-4221-9a5f-f067a500a46а": {
      "name": "pH Main Tank",
      "model": "pH V2 DFRobot",
      "type": "SENSOR",
      "description": "This is the sensor that measures the current level of \"рН\" in the main tank."
    },
    "1c2faf14-04a2-4774-bbc4-63211db097bа": {
      "name": "Pump pH UP",
      "model": "Generic Pump",
      "type": "ACTUATOR",
      "description": "This is the pump for adding a solution to increase the \"pH+\" in the main tank."
    },
    "152c2b91-f5ed-4f28-a9fe-65f724f669b2": {
      "name": "Pump Mixer",
      "model": "Generic Pump",
      "type": "ACTUATOR",
      "description": "This is the pump for \"mixing\" the solution in the main tank."
    }
  },
  "nodes": [
    {
      "id": "start",
      "type": "START",
      "params": {
        "label": "Start",
        "hasError": false
      },
      "position": {
        "x": 33.44057766032017,
        "y": -1.0669213850385404
      }
    },
    {
      "id": "end",
      "type": "END",
      "params": {
        "label": "End",
        "hasError": false
      },
      "position": {
        "x": -70.68646816114307,
        "y": 802.0850622797639
      }
    },
    {
      "id": "SENSOR_READ_1769796263332",
      "type": "SENSOR_READ",
      "params": {
        "readingType": "ph:multi_point",
        "retryCount": 3,
        "retryDelay": 1000,
        "onFailure": "STOP",
        "errorNotification": false,
        "label": "Sensor рН 01",
        "hasError": false,
        "deviceId": "19d4a07f-28cb-4221-9a5f-f067a500a46а",
        "variable": "var_1",
        "comment": "Това е сензора за рН може да е всякакъв"
      },
      "position": {
        "x": 151,
        "y": 113.25
      },
      "data": {
        "notificationMode": "AUTO"
      }
    },
    {
      "id": "IF_1769796393496",
      "type": "IF",
      "params": {
        "label": "If рН = рНc",
        "operator": "==",
        "onFailure": "STOP",
        "errorNotification": false,
        "hasError": false,
        "variable": "var_1",
        "value": "{{global_5}}"
      },
      "position": {
        "x": 270.5991210935549,
        "y": 272.59710040808613
      }
    },
    {
      "id": "IF_1769796455161",
      "type": "IF",
      "params": {
        "label": "If рН <> рНт",
        "operator": "<",
        "onFailure": "STOP",
        "errorNotification": false,
        "hasError": false,
        "variable": "var_1",
        "value": "{{global_5}}"
      },
      "position": {
        "x": 415.0852373231868,
        "y": 469.86353306863384
      }
    },
    {
      "id": "LOOP_1769796477661",
      "type": "LOOP",
      "params": {
        "label": "Loop  рН+",
        "limitMode": "COUNT",
        "interval": 2,
        "intervalUnit": "sec",
        "count": 150,
        "timeout": 60,
        "timeoutUnit": "sec",
        "operator": "<",
        "onFailure": "STOP",
        "errorNotification": false,
        "hasError": false,
        "variable": "var_1",
        "value": "{{global_5}}",
        "exitMessage": "The pH level is raised to the desired level."
      },
      "position": {
        "x": 287.0929699782161,
        "y": 683.6238146138428
      }
    },
    {
      "id": "generic_1769796591986",
      "type": "SENSOR_READ",
      "params": {
        "label": "Сензор рН+",
        "readingType": "ph:multi_point",
        "retryCount": 3,
        "retryDelay": 1000,
        "onFailure": "STOP",
        "errorNotification": false,
        "hasError": false,
        "deviceId": "19d4a07f-28cb-4221-9a5f-f067a500a46а",
        "variable": "var_1"
      },
      "position": {
        "x": 289.20052342943245,
        "y": 1145.6686382170503
      }
    },
    {
      "id": "FLOW_CONTROL_1769796606286",
      "type": "FLOW_CONTROL",
      "params": {
        "label": "Flow Control (Jump/Label)",
        "controlType": "LOOP_BACK",
        "hasError": false,
        "targetLabel": "LOOP_1769796477661"
      },
      "position": {
        "x": 60.70944426164155,
        "y": 1240.3273116574462
      }
    },
    {
      "id": "loop_1769796622668",
      "type": "LOOP",
      "params": {
        "label": "Loop  рН-",
        "limitMode": "COUNT",
        "interval": 2,
        "intervalUnit": "sec",
        "count": 150,
        "timeout": 60,
        "timeoutUnit": "sec",
        "operator": ">",
        "onFailure": "STOP",
        "errorNotification": false,
        "hasError": false,
        "variable": "var_1",
        "value": "{{global_5}}",
        "exitMessage": "The pH level is lowered to the desired level."
      },
      "position": {
        "x": 583.7286518831836,
        "y": 683.7211810900507
      }
    },
    {
      "id": "generic_1769796641269",
      "type": "ACTUATOR_SET",
      "params": {
        "label": "Pump рН-",
        "strategy": "actuator_manual",
        "durationUnit": "sec",
        "amountMode": "DOSES",
        "amountUnit": "ml",
        "safetyTtlUnit": "sec",
        "retryCount": 3,
        "retryDelay": 1000,
        "onFailure": "STOP",
        "errorNotification": false,
        "revertOnStop": true,
        "hasError": false,
        "deviceId": "1c2faf14-04a2-4774-bbc4-63211db097bа",
        "action": "DOSE",
        "amount": "{{global_2}}"
      },
      "position": {
        "x": 600.5339568824303,
        "y": 951.1569594725745
      }
    },
    {
      "id": "generic_1769796720057",
      "type": "SENSOR_READ",
      "params": {
        "label": "Сензор рН-",
        "readingType": "ph:multi_point",
        "retryCount": 3,
        "retryDelay": 1000,
        "onFailure": "STOP",
        "errorNotification": false,
        "hasError": false,
        "deviceId": "19d4a07f-28cb-4221-9a5f-f067a500a46а",
        "variable": "var_1"
      },
      "position": {
        "x": 588.7086120104249,
        "y": 1147.5628174667543
      }
    },
    {
      "id": "FLOW_CONTROL_1769796729090",
      "type": "FLOW_CONTROL",
      "params": {
        "label": "Flow Control (Jump/Label)",
        "controlType": "LOOP_BACK",
        "hasError": false,
        "targetLabel": "loop_1769796622668"
      },
      "position": {
        "x": 864.4961927859179,
        "y": 1238.6681204502775
      }
    },
    {
      "id": "generic_1769796847252",
      "type": "ACTUATOR_SET",
      "params": {
        "label": "Pump Mix pH-",
        "strategy": "actuator_manual",
        "durationUnit": "sec",
        "amountMode": "VOLUME",
        "amountUnit": "ml",
        "safetyTtlUnit": "sec",
        "retryCount": 3,
        "retryDelay": 1000,
        "onFailure": "STOP",
        "errorNotification": false,
        "revertOnStop": true,
        "hasError": false,
        "deviceId": "152c2b91-f5ed-4f28-a9fe-65f724f669b2",
        "action": "PULSE_ON",
        "duration": "{{global_4}}"
      },
      "position": {
        "x": 857.6932162142339,
        "y": 1048.9510285360157
      }
    },
    {
      "id": "ACTUATOR_SET_1772571763605",
      "type": "ACTUATOR_SET",
      "params": {
        "label": "Set Actuator",
        "strategy": "actuator_manual",
        "durationUnit": "sec",
        "amountMode": "DOSES",
        "amountUnit": "ml",
        "safetyTtlUnit": "sec",
        "retryCount": 3,
        "retryDelay": 1000,
        "onFailure": "STOP",
        "errorNotification": false,
        "revertOnStop": true,
        "hasError": false,
        "deviceId": "1c2faf14-04a2-4774-bbc4-63211db097bа",
        "action": "DOSE",
        "amount": "{{global_2}}"
      },
      "position": {
        "x": 335.38483359042107,
        "y": 956.6752945580076
      }
    },
    {
      "id": "ACTUATOR_SET_1772573035182",
      "type": "ACTUATOR_SET",
      "params": {
        "label": "Set Actuator",
        "strategy": "actuator_manual",
        "durationUnit": "sec",
        "amountMode": "VOLUME",
        "amountUnit": "ml",
        "safetyTtlUnit": "sec",
        "retryCount": 3,
        "retryDelay": 1000,
        "onFailure": "STOP",
        "errorNotification": false,
        "revertOnStop": true,
        "hasError": false,
        "deviceId": "152c2b91-f5ed-4f28-a9fe-65f724f669b2",
        "action": "PULSE_ON",
        "duration": "{{global_4}}"
      },
      "position": {
        "x": 98.00000000000001,
        "y": 1029.7803045186827
      }
    }
  ],
  "edges": [
    {
      "id": "xy-edge__startsource-SENSOR_READ_1769796263332target",
      "source": "start",
      "target": "SENSOR_READ_1769796263332",
      "sourceHandle": "source",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__SENSOR_READ_1769796263332source-IF_1769796393496",
      "source": "SENSOR_READ_1769796263332",
      "target": "IF_1769796393496",
      "sourceHandle": "source",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__IF_1769796393496true-endtarget",
      "source": "IF_1769796393496",
      "target": "end",
      "sourceHandle": "true",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__IF_1769796393496false-IF_1769796455161",
      "source": "IF_1769796393496",
      "target": "IF_1769796455161",
      "sourceHandle": "false",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__IF_1769796455161true-LOOP_1769796477661",
      "source": "IF_1769796455161",
      "target": "LOOP_1769796477661",
      "sourceHandle": "true",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__generic_1769796591986source-FLOW_CONTROL_1769796606286target",
      "source": "generic_1769796591986",
      "target": "FLOW_CONTROL_1769796606286",
      "sourceHandle": "source",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__LOOP_1769796477661exit-endtarget",
      "source": "LOOP_1769796477661",
      "target": "end",
      "sourceHandle": "exit",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__IF_1769796455161false-loop_1769796622668",
      "source": "IF_1769796455161",
      "target": "loop_1769796622668",
      "sourceHandle": "false",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__loop_1769796622668body-generic_1769796641269target",
      "source": "loop_1769796622668",
      "target": "generic_1769796641269",
      "sourceHandle": "body",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__generic_1769796720057source-FLOW_CONTROL_1769796729090target",
      "source": "generic_1769796720057",
      "target": "FLOW_CONTROL_1769796729090",
      "sourceHandle": "source",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__loop_1769796622668exit-endtarget",
      "source": "loop_1769796622668",
      "target": "end",
      "sourceHandle": "exit",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__generic_1769796641269source-generic_1769796847252target",
      "source": "generic_1769796641269",
      "target": "generic_1769796847252",
      "sourceHandle": "source",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__generic_1769796847252source-generic_1769796720057target",
      "source": "generic_1769796847252",
      "target": "generic_1769796720057",
      "sourceHandle": "source",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__LOOP_1769796477661body-ACTUATOR_SET_1772571763605target",
      "source": "LOOP_1769796477661",
      "target": "ACTUATOR_SET_1772571763605",
      "sourceHandle": "body",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__ACTUATOR_SET_1772571763605source-ACTUATOR_SET_1772573035182target",
      "source": "ACTUATOR_SET_1772571763605",
      "target": "ACTUATOR_SET_1772573035182",
      "sourceHandle": "source",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    },
    {
      "id": "xy-edge__ACTUATOR_SET_1772573035182source-generic_1769796591986target",
      "source": "ACTUATOR_SET_1772573035182",
      "target": "generic_1769796591986",
      "sourceHandle": "source",
      "targetHandle": "target",
      "type": "smoothstep",
      "style": {
        "strokeWidth": 2
      }
    }
  ],
  "variables": [
    {
      "id": "var_1",
      "name": "pH Current",
      "type": "number",
      "scope": "local",
      "unit": "pH",
      "hasTolerance": false,
      "description": "",
      "defaultTolMode": "symmetric"
    },
    {
      "id": "global_2",
      "name": "pH Dose",
      "type": "number",
      "scope": "global",
      "unit": "doses",
      "hasTolerance": false,
      "description": "",
      "value": 5,
      "defaultTolMode": "symmetric"
    },
    {
      "id": "global_4",
      "name": "PumpMixTime",
      "type": "number",
      "scope": "global",
      "unit": "sec",
      "hasTolerance": false,
      "description": "",
      "value": 10,
      "defaultTolMode": "symmetric"
    },
    {
      "id": "global_5",
      "name": "pH Need",
      "type": "number",
      "scope": "global",
      "unit": "pH",
      "hasTolerance": true,
      "description": "",
      "value": 6.2,
      "defaultTolerance": 0.2,
      "defaultTolMode": "symmetric"
    }
  ]
}