github.com/archlabjp/eeslism-go@v0.0.0-20231109122333-4bb7bfcdf292/eeslism/mccnvrg.go (about)

     1  //This file is part of EESLISM.
     2  //
     3  //Foobar is free software : you can redistribute itand /or modify
     4  //it under the terms of the GNU General Public License as published by
     5  //the Free Software Foundation, either version 3 of the License, or
     6  //(at your option) any later version.
     7  //
     8  //Foobar is distributed in the hope that it will be useful,
     9  //but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
    11  //GNU General Public License for more details.
    12  //
    13  //You should have received a copy of the GNU General Public License
    14  //along with Foobar.If not, see < https://www.gnu.org/licenses/>.
    15  
    16  /* cnvrg.c  */
    17  
    18  package eeslism
    19  
    20  // --------------------------------------------------------------
    21  // 合流要素
    22  //
    23  //  [IN] ---> +---+
    24  //            | C +---->[OUT]
    25  //  [IN] ---> +---+
    26  // --------------------------------------------------------------
    27  
    28  // 合流要素 Cnvrg の 出口の係数 Coeffo, Co と入口の係数 Coeffin を計算
    29  func Cnvrgcfv(Cnvrg []*COMPNT) {
    30  	for i := range Cnvrg {
    31  		C := Cnvrg[i]
    32  		E := C.Elouts[0]
    33  
    34  		// 経路が停止している場合
    35  		if E.Control == OFF_SW {
    36  			continue
    37  		}
    38  
    39  		// 出口係数の処理
    40  		E.Coeffo = E.G
    41  		E.Co = 0.0
    42  
    43  		// 入口係数の処理
    44  		if C.Elins[0].Lpath != nil {
    45  			for j := 0; j < C.Nin; j++ {
    46  				E.Coeffin[j] = -C.Elins[j].Lpath.G
    47  			}
    48  		}
    49  	}
    50  }