// Path: src/org/addition/epanet/msx/Structures/ExprVariable.java
// public interface ExprVariable {
//     public double getPipeVariableValue(int id);
//     public double getTankVariableValue(int id);
// }
// 
// Path: src/org/addition/epanet/msx/Structures/Pipe.java
// public class Pipe {
//     double    hstep;        // integration time step
//     double    v;            // segment volume
//     double    [] c;         // species concentrations
// 
//     public double getHstep() {
//         return hstep;
//     }
// 
//     public void setHstep(double hstep) {
//         this.hstep = hstep;
//     }
// 
//     public double getV() {
//         return v;
//     }
// 
//     public void setV(double v) {
//         this.v = v;
//     }
// 
//     public double[] getC() {
//         return c;
//     }
// 
//     public void setC(double[] c) {
//         this.c = c;
//     }
// }


import org.addition.epanet.msx.Solvers.*;
import org.addition.epanet.msx.Structures.ExprVariable;
import org.addition.epanet.msx.Structures.Pipe;
/*
 * Copyright (C) 2012  Addition, Lda. (addition at addition dot pt)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/.
 */

package org.addition.epanet.msx;


public class Chemical implements ExprVariable, JacobianInterface {

    public void loadDependencies(EpanetMSX epa) {
        this.MSX = epa.getNetwork();
    }

    Network MSX;
    rk5     rk5_solver;
    ros2    ros2_solver;
    Newton  newton;

    //  Constants
    private static final int MAXIT = 20;    // Max. number of iterations used in nonlinear equation solver
    private static final int NUMSIG = 3;    // Number of significant digits in nonlinear equation solver error

// Path: src/org/addition/epanet/msx/Structures/ExprVariable.java
// public interface ExprVariable {
//     public double getPipeVariableValue(int id);
//     public double getTankVariableValue(int id);
// }
// 
// Path: src/org/addition/epanet/msx/Structures/Pipe.java
// public class Pipe {
//     double    hstep;        // integration time step
//     double    v;            // segment volume
//     double    [] c;         // species concentrations
// 
//     public double getHstep() {
//         return hstep;
//     }
// 
//     public void setHstep(double hstep) {
//         this.hstep = hstep;
//     }
// 
//     public double getV() {
//         return v;
//     }
// 
//     public void setV(double v) {
//         this.v = v;
//     }
// 
//     public double[] getC() {
//         return c;
//     }
// 
//     public void setC(double[] c) {
//         this.c = c;
//     }
// }


// Path: src/org/addition/epanet/msx/Chemical.java
import org.addition.epanet.msx.Solvers.*;
import org.addition.epanet.msx.Structures.ExprVariable;
import org.addition.epanet.msx.Structures.Pipe;

/*
 * Copyright (C) 2012  Addition, Lda. (addition at addition dot pt)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/.
 */

package org.addition.epanet.msx;


public class Chemical implements ExprVariable, JacobianInterface {

    public void loadDependencies(EpanetMSX epa) {
        this.MSX = epa.getNetwork();
    }

    Network MSX;
    rk5     rk5_solver;
    ros2    ros2_solver;
    Newton  newton;

    //  Constants
    private static final int MAXIT = 20;    // Max. number of iterations used in nonlinear equation solver
    private static final int NUMSIG = 3;    // Number of significant digits in nonlinear equation solver error

    private Pipe    TheSeg;                 // Current water quality segment