Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/CspmIT/centinela-front/llms.txt

Use this file to discover all available pages before exploring further.

Variables are the core data points in the Centinela monitoring system. They represent sensor readings, calculated values, and system metrics stored in InfluxDB.

Overview

The variable configuration module allows you to:
  • Create and manage monitoring variables
  • Define variable properties (name, unit, process)
  • Mark variables as calculated or measured
  • Filter and search variables by attributes
  • Associate variables with charts and diagrams

Variable Properties

name
string
required
Unique identifier for the variable (e.g., “Tank_A_Level”, “Pump_1_Flow_Rate”)
unit
string
Unit of measurement for the variableCommon Units:
  • Volume: L, , gal
  • Pressure: bar, psi, kPa
  • Flow: L/min, m³/h, GPM
  • Temperature: °C, °F, K
  • Percentage: %
calc
boolean
default:false
Indicates if the variable is calculated from other variables or directly measured
  • true = Calculated/derived value
  • false = Direct sensor measurement
process
string
Process area or system component the variable belongs toExamples:
  • “Pre-treatment”
  • “Filtration”
  • “Chlorination”
  • “Distribution”
  • “Storage”

Creating Variables

1

Access Variables Module

Navigate to Configuration > Variables in the main menu.
2

Click Create Variable

Click the “Crear Variable” button in the top-right corner.
3

Enter Variable Details

Fill in the variable properties in the modal form:
  • Name (required)
  • Unit (optional)
  • Process (optional)
  • Calculation flag (optional)
4

Save Variable

Click Save to create the variable. It will immediately appear in the variables table.

Variable Table

The variables table displays all configured variables with the following columns:
ColumnDescription
IDUnique variable identifier
NombreVariable name
UnidadUnit of measurement
Cálculo”Si” if calculated, “No” if measured
ProcesoAssociated process area
AccionesEdit and Delete buttons
Source Reference: /src/modules/ConfigVars/views/Vars.jsx:54-96

Filtering Variables

The system provides powerful filtering capabilities to quickly find variables:
Filter variables by their unit of measurement. The dropdown automatically populates with all units currently in use.
const unitList = Array.from(
  new Set(vars.map(v => v.unit).filter(Boolean))
)
Filter Implementation:
const onSubmit = ({ process, calc, unit }) => {
  let filtered = [...varsOriginal]
  
  // Filter by process
  if (process) {
    filtered = filtered.filter(v => v.process === process)
  }
  
  // Filter by calculation type
  if (calc === "true") {
    filtered = filtered.filter(v => v.calc === true)
  } else if (calc === "false") {
    filtered = filtered.filter(v => v.calc === false)
  }
  
  // Filter by unit
  if (unit) {
    filtered = filtered.filter(v => v.unit === unit)
  }
  
  setVars(filtered)
}
Source Reference: /src/modules/ConfigVars/views/Vars.jsx:120-141

Editing Variables

1

Locate Variable

Use the filter tools or search to find the variable you want to modify.
2

Click Edit Button

Click the blue “Editar” button in the Actions column.
3

Modify Properties

Update any variable properties in the modal form.
4

Save Changes

Click Save. The changes will be reflected immediately in the table.
Editing a variable’s name may affect existing charts and diagrams that reference it. Ensure all dependencies are updated accordingly.

Deleting Variables

1

Click Delete Button

Click the red “Eliminar” button in the Actions column.
2

Confirm Deletion

A confirmation dialog will appear:
Swal.fire({
  icon: 'warning',
  title: 'Atencion!',
  html: 'Esta seguro que desea eliminar esta variable?',
  showConfirmButton: true,
  confirmButtonText: 'Si, eliminar',
  showCancelButton: true,
  cancelButtonText: 'Cancelar'
})
3

Deletion Processed

If confirmed, the variable is deleted and the table refreshes automatically.
Deleting a variable that is used in charts, alarms, or diagrams will cause those components to malfunction. Always check dependencies before deletion.

API Integration

Variables are retrieved and managed through the following API endpoints:

Get All Variables

import { getVarsInflux } from '../../DrawDiagram/components/Fields/actions'

const vars = await getVarsInflux()
// Returns array of variable objects

Delete Variable

const url = `${backend[import.meta.env.VITE_APP_NAME]}/deleteVar/${id}`
const { data } = await request(url, 'POST')
Source Reference: /src/modules/ConfigVars/views/Vars.jsx:22-53

Variable Usage

Variables are used throughout the Centinela system:
Variables are assigned to charts to visualize real-time and historical data. Each chart type requires specific variable configurations.Example:
{
  idVar: 42,              // Variable ID
  name: "Tank A Level",
  unit: "L",
  maxValue: 1000
}
Variables can be overlaid on diagram images to show live values at specific locations. Position and display style are configurable.Data Structure:
dataInflux: {
  id: 42,
  name: "Flow Rate",
  position: "Centro",    // Top, Centro, Bottom
  show: true,
  maxValue: 100,         // For percentage displays
  booleanColors: {...}   // For binary variables
}
Variables are monitored by alarms to trigger notifications when values exceed thresholds.Reference: See Alarm Configuration for details.

Data Structure

Variables retrieved from the API have the following structure:
interface InfluxVar {
  id: number
  name: string
  unit?: string
  calc: boolean
  process?: string
}
Example Variable:
{
  "id": 42,
  "name": "Tank_A_Level",
  "unit": "L",
  "calc": false,
  "process": "Storage"
}

Best Practices

Use clear, descriptive names that include:
  • Equipment/location identifier (e.g., Tank_A, Pump_2)
  • Measured parameter (e.g., Level, Flow, Pressure)
  • Avoid spaces; use underscores or camelCase
Good Examples:
  • Tank_A_Level
  • Pump_2_Flow_Rate
  • Filter_1_Pressure_Drop
Avoid:
  • var1
  • temp
  • a level
Group related variables under consistent process names:
  • Use standardized process names across the facility
  • Create a process hierarchy if needed
  • Document process definitions
When creating calculated variables:
  • Mark them with calc: true
  • Document the calculation formula separately
  • Ensure source variables exist and are accurate
  • Consider using appropriate units for derived values
The variable table supports pagination (10 items per page) and full-text search across all columns. Use these features to navigate large variable sets efficiently.

Troubleshooting

Cause: The variable may not be properly registered in InfluxDB.Solution:
  1. Verify the variable exists in the variables table
  2. Check that data is being written to InfluxDB for this variable
  3. Refresh the chart configuration page
Cause: Filter combination too restrictive or no matching variables.Solution:
  1. Clear filters and apply them one at a time
  2. Verify the filter values exist in the database
  3. Check for typos in manually entered process names
Cause: Variable is referenced in charts, alarms, or diagrams.Solution:
  1. Identify all references using search
  2. Remove or reassign references
  3. Then attempt deletion again

Build docs developers (and LLMs) love