BuechReachInOut.java 6.69 KiB
/*
 * J2KProcessReachRouting.java
 * Created on 28. November 2005, 10:01
 * This file is part of JAMS
 * Copyright (C) 2005 FSU Jena, c0krpe
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
package cowattools;
import jams.JAMS;
import jams.data.*;
import jams.model.*;
/**
 * @author c0krpe
@JAMSComponentDescription(
        title = "Buech Reach In Out",
        author = "Julien Veyssier",
        description = "What comes out and get back to reaches because of external model",
        version = "0.1",
        date = "2020-02-28"
@VersionComments(entries = {
    @VersionComments.Entry(version = "0.1", comment = "Initial version"),})
public class BuechReachInOut extends JAMSComponent {
     *  Component variables
    @JAMSVarDescription(
            access = JAMSVarDescription.AccessType.READ,
            description = "The reach collection"
    public Attribute.EntityCollection entities;
    @JAMSVarDescription(
            access = JAMSVarDescription.AccessType.READ,
            description = "reach length",
            unit = "m"
    public Attribute.Double length;
    @JAMSVarDescription(
            access = JAMSVarDescription.AccessType.READ,
            description = "reach slope",
            unit = "%"
    public Attribute.Double slope;
    @JAMSVarDescription(
            access = JAMSVarDescription.AccessType.READWRITE,
            description = "RD1 inflow to reach",
            unit = "L"
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
) public Attribute.Double inRD1; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, description = "RD2 inflow to reach", unit = "L" ) public Attribute.Double inRD2; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, description = "RG1 inflow to reach", unit = "L" ) public Attribute.Double inRG1; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, description = "RG2 inflow to reach", unit = "L" ) public Attribute.Double inRG2; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, description = "additional inflow to reach", unit = "L", defaultValue = "0" ) public Attribute.Double inAddIn; @JAMSVarDescription( access = JAMSVarDescription.AccessType.WRITE, description = "RD1 outflow from reach", unit = "L" ) public Attribute.Double outRD1; @JAMSVarDescription( access = JAMSVarDescription.AccessType.WRITE, description = "RD2 outflow from reach", unit = "L" ) public Attribute.Double outRD2; @JAMSVarDescription( access = JAMSVarDescription.AccessType.WRITE, description = "RG1 outflow from reach", unit = "L" ) public Attribute.Double outRG1; @JAMSVarDescription( access = JAMSVarDescription.AccessType.WRITE, description = "RG2 outflow from reach", unit = "L" ) public Attribute.Double outRG2; @JAMSVarDescription( access = JAMSVarDescription.AccessType.WRITE, description = "additional outflow from reach", unit = "L", defaultValue = "0" ) public Attribute.Double outAddIn; @JAMSVarDescription( access = JAMSVarDescription.AccessType.WRITE,
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
description = "simulated runoff from reach", unit = "L" ) public Attribute.Double simRunoff; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, description = "RD1 storage inside reach", unit = "L" ) public Attribute.Double actRD1; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, description = "RD2 storage inside reach", unit = "L" ) public Attribute.Double actRD2; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, description = "RG1 storage inside reach", unit = "L" ) public Attribute.Double actRG1; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, description = "RG2 storage inside reach", unit = "L" ) public Attribute.Double actRG2; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, description = "additional inflow storage inside reach", unit = "L", defaultValue = "0" ) public Attribute.Double actAddIn; @JAMSVarDescription( access = JAMSVarDescription.AccessType.READWRITE, description = "Channel storage inside reach", unit = "L" ) public Attribute.Double channelStorage; @JAMSVarDescription( access = JAMSVarDescription.AccessType.WRITE, description = "water level in reach" ) public Attribute.Double waterLevel; public void init() { } public void initAll() { } public void run() { Attribute.Entity entity = entities.getCurrent(); Double reachId = entity.getDouble("ID"); int iReachId = reachId.intValue(); String sReachId = String.valueOf(iReachId); Double reachPlus = CouplingCommunication.getTableValue("reachin", sReachId); Double reachMinus = CouplingCommunication.getTableValue("reachout", sReachId); if (reachPlus == null) { reachPlus = 0.0;
211212213214215216217218219220221222223224225226227228229230231
} if (reachMinus == null) { reachMinus = 0.0; } boolean DEBUG = false; if (DEBUG) { System.out.println("Processing reach: " + sReachId); System.out.println("actual RD1 " + actRD1.getValue()); System.out.println("Remove " + reachMinus + " to reach"); System.out.println("Add " + reachPlus + " to reach"); } actRD1.setValue(actRD1.getValue() + reachPlus - reachMinus); } public void cleanup() { } }