{
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "Unit-aware calculations with CalcsLive",
  "tags": [],
  "nodes": [
    {
      "name": "Sticky Note - Intro",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -576
      ],
      "parameters": {
        "width": 672,
        "height": 512,
        "content": "## \ud83d\ude80 CalcsLive Demo Workflow\n\nThis workflow demonstrates **unit-aware calculations** with automatic unit conversion.\n\n### What you'll learn:\n1. Basic calculations can be reused.\n2. Input units flexibility: no extra conversion needed\n3. Choose output units per downstream needs \n4. Chained calculations (calculations are composable)\n\n### Setup:\n1. Install `@calcslive/n8n-nodes-calcslive` from Community Nodes\n2. Get API key from [calcslive.com](https://www.calcslive.com)\n3. Configure credentials, then click Execute!\n\n### Next:\nCreate/copy your own unit aware calculations in CalcsLive and use to power your n8n workflow.\n\n### Help:\nSupported units: https://calcslive.com/help/units-reference"
      },
      "typeVersion": 1
    },
    {
      "name": "Sticky Note - Speed",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        -64
      ],
      "parameters": {
        "color": 2,
        "width": 352,
        "height": 208,
        "content": "### \ud83d\udcca Speed Calculation\n\nArticleID: 3M6P9TF5P-3XA\nCalc link: https://calcslive.com/editor/3M6P9TF5P-3XA\n\nInputs & outputs variable symbols are populated in dropdown list for cherry-picking.\n\nOutput: Speed in valid unit."
      },
      "typeVersion": 1
    },
    {
      "name": "Sticky Note - Volume",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        336
      ],
      "parameters": {
        "color": 2,
        "width": 208,
        "height": 176,
        "content": "### \ud83d\udce6 Cylinder Volume\n\nArticleID: 3M6P9TF5P-3XA\nCalc link: https://calcslive.com/editor/3M6P9TF5P-3XA\n\nOutput: Volume in valid unit."
      },
      "typeVersion": 1
    },
    {
      "name": "Sticky Note - Merge",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        840,
        416
      ],
      "parameters": {
        "color": 4,
        "width": 200,
        "height": 190,
        "content": "### \ud83d\udd00 Merge Node\n\nCombines data from:\n- Cylinder Volume (V)\n- Density Input (\u03c1)\n\nBoth are needed for Mass Calc."
      },
      "typeVersion": 1
    },
    {
      "name": "Sticky Note - Mass",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1056,
        416
      ],
      "parameters": {
        "color": 2,
        "width": 304,
        "height": 240,
        "content": "### \u26d3\ufe0f Chained Calculation\n\nArticleID: 3M6PBGU7S-3CA\nCalc link: https://calcslive.com/editor/3M6PBGU7S-3CA\n\nThis node takes the **merged output** from Volume Calc + Density to calculate mass.\n\nThis is the power of composable calculations!"
      },
      "typeVersion": 1
    },
    {
      "name": "When clicking 'Execute workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        80,
        -48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "name": "Set Density Input",
      "type": "n8n-nodes-base.set",
      "position": [
        432,
        368
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "Density",
              "type": "number",
              "value": 1500
            },
            {
              "name": "DensityUnit",
              "type": "string",
              "value": "kg/m\u00b3"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "name": "Speed Calc (d,t) \u2192 v",
      "type": "@calcslive/n8n-nodes-calcslive.calcsLive",
      "position": [
        640,
        -48
      ],
      "parameters": {
        "inputPQs": {
          "pq": [
            {
              "unit": "={{ $json.unit }}",
              "value": "={{ $json.distance }}",
              "symbol": "d"
            },
            {
              "unit": "={{ $json.timeUnit }}",
              "value": "={{ $json.time }}",
              "symbol": "t"
            }
          ]
        },
        "articleId": "3M6P9TF5P-3XA",
        "outputPQs": {
          "pq": [
            {
              "unit": "km/h",
              "symbol": "v"
            }
          ]
        }
      },
      "credentials": {
        "calcsLiveApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "Cylinder Volume (D,h) \u2192 V",
      "type": "@calcslive/n8n-nodes-calcslive.calcsLive",
      "position": [
        640,
        160
      ],
      "parameters": {
        "inputPQs": {
          "pq": [
            {
              "unit": "={{ $json.DiaUnit }}",
              "value": "={{ $json.Diameter }}",
              "symbol": "D"
            },
            {
              "unit": "={{ $json.HeightUnit }}",
              "value": "={{ $json.Height }}",
              "symbol": "h"
            }
          ]
        },
        "articleId": "3M6P9TF5P-3XA",
        "outputPQs": {
          "pq": [
            {
              "unit": "L",
              "symbol": "V"
            }
          ]
        }
      },
      "credentials": {
        "calcsLiveApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "Merge Volume + Density",
      "type": "n8n-nodes-base.merge",
      "position": [
        856,
        264
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3
    },
    {
      "name": "Mass Calc (V,\u03c1) \u2192 m",
      "type": "@calcslive/n8n-nodes-calcslive.calcsLive",
      "position": [
        1072,
        264
      ],
      "parameters": {
        "inputPQs": {
          "pq": [
            {
              "unit": "={{ $json.data.calculation.outputs.V.unit }}",
              "value": "={{ $json.data.calculation.outputs.V.value }}",
              "symbol": "V"
            },
            {
              "unit": "={{ $json.DensityUnit }}",
              "value": "={{ $json.Density }}",
              "symbol": "rho"
            }
          ]
        },
        "articleId": "3M6PBGU7S-3CA",
        "outputPQs": {
          "pq": [
            {
              "unit": "g",
              "symbol": "m"
            }
          ]
        }
      },
      "credentials": {
        "calcsLiveApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "name": "Sticky Note - Video",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -576
      ],
      "parameters": {
        "color": 2,
        "width": 464,
        "height": 288,
        "content": "@[youtube](xC4iFwNkIQs)"
      },
      "typeVersion": 1
    },
    {
      "name": "Set Inputs for Speed",
      "type": "n8n-nodes-base.set",
      "position": [
        432,
        -48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "distance",
              "type": "number",
              "value": 360
            },
            {
              "name": "unit",
              "type": "string",
              "value": "km"
            },
            {
              "name": "time",
              "type": "number",
              "value": 2
            },
            {
              "name": "timeUnit",
              "type": "string",
              "value": "h"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "name": "Set Inputs for Cylinder",
      "type": "n8n-nodes-base.set",
      "position": [
        432,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "Diameter",
              "type": "number",
              "value": 2
            },
            {
              "name": "DiaUnit",
              "type": "string",
              "value": "cm"
            },
            {
              "name": "Height",
              "type": "number",
              "value": 10
            },
            {
              "name": "HeightUnit",
              "type": "string",
              "value": "cm"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Set Density Input": {
      "main": [
        [
          {
            "node": "Merge Volume + Density",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Set Inputs for Speed": {
      "main": [
        [
          {
            "node": "Speed Calc (d,t) \u2192 v",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Volume + Density": {
      "main": [
        [
          {
            "node": "Mass Calc (V,\u03c1) \u2192 m",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Inputs for Cylinder": {
      "main": [
        [
          {
            "node": "Cylinder Volume (D,h) \u2192 V",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cylinder Volume (D,h) \u2192 V": {
      "main": [
        [
          {
            "node": "Merge Volume + Density",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking 'Execute workflow'": {
      "main": [
        [
          {
            "node": "Set Inputs for Speed",
            "type": "main",
            "index": 0
          },
          {
            "node": "Set Inputs for Cylinder",
            "type": "main",
            "index": 0
          },
          {
            "node": "Set Density Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}