- ✅ EC Target Range Calculator — Crop-specific lookup tables with interpolation for tomatoes, lettuce, cannabis, and more
- ✅ Nutrient Solution Stability Predictor — Predict precipitation risks, pH drift, and microbial contamination before they tank your reservoir
- ✅ Automated Nutrient Dosing Schedule Generator — Week-by-week mixing sequences that prevent calcium-sulfate lockout
- ✅ Hydroponic System Type-Specific Nutrient Profiles — NFT, DWC, Aeroponics, and Ebb-and-Flow specific EC multipliers
- ✅ Growth Regulator Concentration Calculator — Stage-specific auxin and cytokinin dilution with safety protocols
npm install @adametherzlab/fertigation-mix-v2
# or
bun add @adametherzlab/fertigation-mix-v2// REMOVED external import: import { calculateEcTargetRange, HydroponicSystemType, GrowthStage } from '@adametherzlab/fertigation-mix-v2';
const range = calculateEcTargetRange(
HydroponicSystemType.NFT,
GrowthStage.Vegetative,
'butter_lettuce'
);
console.log(`Target EC: ${range.optimalEc} mS/cm`); // 1.47| Member | Description |
|---|---|
Seedling |
Early establishment phase (0-2 weeks) |
Vegetative |
Leaf and structural growth |
Flowering |
Bloom initiation and development |
Fruiting |
Fruit set and maturation |
Flush |
Pre-harvest nutrient clearing |
| Member | Description |
|---|---|
NFT |
Nutrient Film Technique (thin film) |
DWC |
Deep Water Culture (submerged roots) |
Aeroponics |
High-pressure mist systems |
EbbAndFlow |
Flood and drain tables |
DripSystem |
Top-feed drip irrigation |
| Member | Description |
|---|---|
Auxin |
Rooting and cell elongation |
Cytokinin |
Shoot proliferation and branching |
Gibberellin |
Stem elongation and flowering |
Ethylene |
Ripening and senescence |
AbscisicAcid |
Stress response and dormancy |
function calculateEcTargetRange(
systemType: HydroponicSystemType,
growthStage: GrowthStage,
cropType: string
): ECTargetRangeParameters:
systemType— Hydroponic system classificationgrowthStage— Current plant developmental stagecropType— Crop identifier (e.g.,'tomato','butter_lettuce','cannabis_indica')
Returns: ECTargetRange with minEc, maxEc, optimalEc, and environmentalModifiers
Throws: RangeError if system type or growth stage unsupported
Example:
const range = calculateEcTargetRange(HydroponicSystemType.DWC, GrowthStage.Fruiting, 'beefsteak_tomato');
// Returns: { minEc: 2.0, maxEc: 3.5, optimalEc: 2.8, ... }function classifyEcReading(
reading: number,
targetRange: ECTargetRange
): 'deficient' | 'suboptimal' | 'optimal' | 'elevated' | 'toxic'Example:
const status = classifyEcReading(1.9, targetRange); // Returns 'optimal' or 'elevated' depending on rangeRetrieve system-specific nutrient multipliers and maintenance intervals.
function getSystemNutrientAdjustment(
systemType: HydroponicSystemType,
growthStage: GrowthStage
): SystemNutrientAdjustmentReturns: EC multipliers, flushing intervals, and oxygenation requirements specific to system type
Example:
const adjustment = getSystemNutrientAdjustment(HydroponicSystemType.Aeroponics, GrowthStage.Flowering);
// Returns elevated EC multiplier for high-oxygen systemsfunction predictStability(
solution: NutrientSolution,
factors: StabilityFactors
): StabilityPredictionParameters:
solution— Current EC, pH, temperature, and elemental compositionfactors— Light exposure, aeration, reservoir temp, organic ratio, microbial activity
Returns: Shelf life estimate, precipitation risk flags, and pH drift velocity
Example:
const prediction = predictStability(
{ ec: 2.2, ph: 6.0, temperature: 22, nitrogen: 200, calcium: 180 },
{ lightExposureLevel: 'high', aerationIntensity: 'vigorous', reservoirTemperature: 24, organicComponentRatio: 0.05, microbialActivity: 'moderate' }
);
// Returns: { estimatedShelfLifeHours: 72, precipitationRisk: 'low', ... }function generateWeeklyDosingSchedule(
systemProfile: HydroponicSystemProfile,
growthStage: GrowthStage,
targetEc: ElectricalConductivity,
reservoirVolume: Liters
): DosingScheduleExample:
const schedule = generateWeeklyDosingSchedule(
{ systemType: HydroponicSystemType.NFT, totalReservoirVolume: 500, evaporationRateFactor: 0.15, oxygenationMethod: 'air_stone', growingMedia: 'rockwool' },
GrowthStage.Flowering,
2.2,
500
);
// Returns weekly array of DosingEvent with safe mixing orderfunction calculateGrowthRegulatorDilution(
regulatorType: GrowthRegulatorType,
plantStage: GrowthStage,
stockConcentrationPpm: PartsPerMillion,
targetConcentrationPpm: PartsPerMillion,
applicationMethod: 'foliar_spray' | 'root_drench' | 'hydroponic_reservoir'
): GrowthRegulatorDosageThrows: RangeError if target > stock concentration; Error if regulator incompatible with plant stage
Example:
const dosage = calculateGrowthRegulatorDilution(
GrowthRegulatorType.Auxin,
GrowthStage.Vegetative,
1000,
50,
'root_drench'
);
// Returns: { dilutionRatio: '20:1', finalVolumeLiters: 1.0, safetyWarning: 'Use gloves...' }function calculateMixingSequence(
macroNutrients: MacroNutrientProfile,
microNutrients: MicroNutrientProfile
): { sequence: string[]; delays: number[] }Throws: Error if calcium-sulfate or calcium-phosphate precipitation risk detected
Example:
const sequence = calculateMixingSequence(
{ nitrogen: 200, calcium: 180, sulfur: 60 },
{ iron: 2, manganese: 0.5 }
);
// Returns: { sequence: ['calcium_nitrate', 'iron_chelate', 'magnesium_sulfate'], delays: [0, 15, 30] }import {
calculateEcTargetRange,
classifyEcReading,
predictStability,
generateWeeklyDosingSchedule,
calculateGrowthRegulatorDilution,
HydroponicSystemType,
GrowthStage,
GrowthRegulatorType
} from '@adametherzlab/fertigation-mix-v2';
// 1. Determine targets for flowering tomatoes in DWC
const ecRange = calculateEcTargetRange(
HydroponicSystemType.DWC,
GrowthStage.Flowering,
'roma_tomato'
);
// 2. Check current reservoir status
const currentEc = 2.4; // mS/cm measured
const status = classifyEcReading(currentEc, ecRange);
console.log(`Nutrient status: ${status}`); // 'optimal'
// 3. Predict how long this batch lasts in summer heat
const stability = predictStability(
{ ec: currentEc, ph: 6.1, temperature: 23, nitrogen: 180, phosphorus: 45, potassium: 220, calcium: 170, magnesium: 48 },
{ lightExposureLevel: 'high', aerationIntensity: 'vigorous', reservoirTemperature: 26, organicComponentRatio: 0.02, microbialActivity: 'low' }
);
console.log(`Change reservoir in ${stability.estimatedShelfLifeHours} hours`);
// 4. Generate next week's schedule
const schedule = generateWeeklyDosingSchedule(
{ systemType: HydroponicSystemType.DWC, totalReservoirVolume: 1000, evaporationRateFactor: 0.12, oxygenationMethod: 'air_stone', growingMedia: 'clay_pebbles' },
GrowthStage.Flowering,
ecRange.optimalEc,
1000
);
// 5. Calculate auxin for root maintenance during flowering
const auxinDose = calculateGrowthRegulatorDilution(
GrowthRegulatorType.Auxin,
GrowthStage.Flowering,
1000,
25,
'root_drench'
);
console.log(`Mix ${auxinDose.dilutionRatio} dilution for weekly root treatment`);- Breaking: All functions now require explicit
GrowthStageenum instead of string literals - Breaking: EC values now use strict branded types (
ElectricalConductivity) in internal APIs, though plain numbers work in public APIs - New: System-specific profiles replace generic calculations—expect different EC recommendations for NFT vs DWC
- New: Stability prediction requires
organicComponentRatioparameter for solutions using organic additives - Improved: Growth regulator calculations now validate stage compatibility (e.g., prevents ethylene application during vegetative stage)
RangeError: temperature must be 0-100
You're passing temperature in Fahrenheit. Convert to Celsius (0-40°C typical for hydroponics).
Error: calcium-sulfate precipitation risk detected
Error: regulator incompatible with plant stage
EC readings drift rapidly after mixing
Use predictStability to check for high pH drift velocity. Likely causes: high organic ratio with microbial activity, or insufficient aeration in DWC systems.
See CONTRIBUTING.md
MIT (c) [Adam