github.com/archlabjp/eeslism-go@v0.0.0-20231109122333-4bb7bfcdf292/eeslism/mceqpcat.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  /*  eqpcat.c  */
    17  
    18  package eeslism
    19  
    20  // 名称がcatname の設備をEcatから探して、 C に格納する
    21  // Esys には、設備の種類ごとの個数を格納する
    22  func eqpcat(catname string, C *COMPNT, Ecat *EQCAT, Esys *EQSYS) bool {
    23  	C.Airpathcpy = false
    24  	C.Idi = nil
    25  	C.Ido = nil
    26  
    27  	for i, Hccca := range Ecat.Hccca {
    28  		if catname == Hccca.name {
    29  			C.Eqptype = HCCOIL_TYPE
    30  			C.Ncat = i
    31  			C.Neqp = len(Esys.Hcc)
    32  			Esys.Hcc = append(Esys.Hcc, NewHCC())
    33  			C.Nout = 3
    34  			C.Nin = 3
    35  			C.Idi = []ELIOType{ELIO_t, ELIO_x, ELIO_W} // txW
    36  			C.Ido = []ELIOType{ELIO_t, ELIO_x, ELIO_W} // txW
    37  			C.Airpathcpy = true
    38  			return true
    39  		}
    40  	}
    41  
    42  	for i, Boica := range Ecat.Boica {
    43  		if catname == Boica.name {
    44  			C.Eqptype = BOILER_TYPE
    45  			C.Ncat = i
    46  			C.Neqp = len(Esys.Boi)
    47  			Esys.Boi = append(Esys.Boi, NewBOI())
    48  			C.Nout = 1
    49  			C.Nin = 1
    50  			return true
    51  		}
    52  	}
    53  
    54  	for i, Collca := range Ecat.Collca {
    55  		if catname == Collca.name {
    56  			C.Eqptype = COLLECTOR_TYPE
    57  			C.Ncat = i
    58  			C.Neqp = len(Esys.Coll)
    59  			Esys.Coll = append(Esys.Coll, NewCOLL())
    60  			C.Ac = Collca.Ac
    61  
    62  			if Collca.Type == COLLECTOR_PDT {
    63  				C.Nout = 1
    64  				C.Nin = 1
    65  			} else {
    66  				C.Nout = 2
    67  				C.Nin = 2
    68  				C.Airpathcpy = true
    69  			}
    70  			return true
    71  		}
    72  	}
    73  
    74  	for i, PVca := range Ecat.PVca {
    75  		if catname == PVca.Name {
    76  			C.Eqptype = PV_TYPE
    77  			C.Ncat = i
    78  			C.Neqp = len(Esys.PVcmp)
    79  			Esys.PVcmp = append(Esys.PVcmp, NewPV())
    80  			C.PVcap = PVca.PVcap
    81  			C.Nout = 0
    82  			C.Nin = 0
    83  			C.Area = PVca.Area
    84  
    85  			return true
    86  		}
    87  	}
    88  
    89  	for i, Refaca := range Ecat.Refaca {
    90  		if catname == Refaca.name {
    91  			C.Eqptype = REFACOMP_TYPE
    92  			C.Ncat = i
    93  			C.Neqp = len(Esys.Refa)
    94  			Esys.Refa = append(Esys.Refa, NewREFA())
    95  			C.Nout = 1
    96  			C.Nin = 1
    97  			return true
    98  		}
    99  	}
   100  
   101  	for i, Pipeca := range Ecat.Pipeca {
   102  		if catname == Pipeca.name {
   103  			C.Eqptype = PIPEDUCT_TYPE
   104  			C.Ncat = i
   105  			C.Neqp = len(Esys.Pipe)
   106  			Esys.Pipe = append(Esys.Pipe, NewPIPE())
   107  
   108  			if Pipeca.Type == PIPE_PDT {
   109  				C.Nout = 1
   110  				C.Nin = 1
   111  			} else {
   112  				C.Nout = 2
   113  				C.Nin = 2
   114  				C.Airpathcpy = true
   115  			}
   116  
   117  			return true
   118  		}
   119  	}
   120  
   121  	for i, Stankca := range Ecat.Stankca {
   122  		if catname == Stankca.name {
   123  			C.Eqptype = STANK_TYPE
   124  			C.Ncat = i
   125  			C.Neqp = len(Esys.Stank)
   126  			Esys.Stank = append(Esys.Stank, NewSTANK())
   127  
   128  			return true
   129  		}
   130  	}
   131  
   132  	for i, Hexca := range Ecat.Hexca {
   133  		if catname == Hexca.Name {
   134  			C.Eqptype = HEXCHANGR_TYPE
   135  			C.Ncat = i
   136  			C.Neqp = len(Esys.Hex)
   137  			Esys.Hex = append(Esys.Hex, NewHEX())
   138  
   139  			C.Nout = 2
   140  			C.Nin = 2
   141  			C.Idi = []ELIOType{ELIO_C, ELIO_H} // CH
   142  			C.Ido = []ELIOType{ELIO_C, ELIO_H} // CH
   143  
   144  			return true
   145  		}
   146  	}
   147  
   148  	for i, Pumpca := range Ecat.Pumpca {
   149  		if catname == Pumpca.name {
   150  			C.Eqptype = PUMP_TYPE
   151  			C.Ncat = i
   152  			C.Neqp = len(Esys.Pump)
   153  			Esys.Pump = append(Esys.Pump, NewPUMP())
   154  
   155  			if Pumpca.pftype == PUMP_PF {
   156  				C.Nout = 1
   157  				C.Nin = 1
   158  			} else {
   159  				C.Nout = 2
   160  				C.Nin = 2
   161  				C.Airpathcpy = true
   162  			}
   163  
   164  			return true
   165  		}
   166  	}
   167  
   168  	/*---- Satoh Debug VAV  2000/12/5 ----*/
   169  	for i, Vavca := range Ecat.Vavca {
   170  		if catname == Vavca.Name {
   171  			if Vavca.Type == VAV_PDT {
   172  				C.Eqptype = VAV_TYPE
   173  			} else {
   174  				C.Eqptype = VWV_TYPE
   175  			}
   176  
   177  			C.Ncat = i
   178  			C.Neqp = len(Esys.Vav)
   179  			Esys.Vav = append(Esys.Vav, NewVAV())
   180  
   181  			if Vavca.Type == VAV_PDT {
   182  				C.Nout = 2
   183  				C.Nin = 2
   184  				// 温湿度計算のために出入り口数は2
   185  				C.Airpathcpy = true
   186  			} else {
   187  				C.Nout = 1
   188  				C.Nin = 1
   189  			}
   190  
   191  			return true
   192  		}
   193  	}
   194  
   195  	// Satoh OMVAV  2010/12/16
   196  	for i, OMvavca := range Ecat.OMvavca {
   197  		if catname == OMvavca.Name {
   198  			C.Eqptype = OMVAV_TYPE
   199  			C.Ncat = i
   200  			C.Neqp = len(Esys.OMvav)
   201  			Esys.OMvav = append(Esys.OMvav, NewOMVAV())
   202  			C.Nout = 0
   203  			C.Nin = 0
   204  
   205  			return true
   206  		}
   207  	}
   208  
   209  	for i, Stheatca := range Ecat.Stheatca {
   210  		if catname == Stheatca.Name {
   211  			C.Eqptype = STHEAT_TYPE
   212  			C.Ncat = i
   213  			C.Neqp = len(Esys.Stheat)
   214  			Esys.Stheat = append(Esys.Stheat, NewSTHEAT())
   215  
   216  			// NOTE: たぶんここは 2が正しいのでは
   217  			C.Nout = 3
   218  			C.Nin = 3
   219  			// 温湿度計算のために出入り口数は2
   220  			C.Airpathcpy = true
   221  
   222  			return true
   223  		}
   224  	}
   225  
   226  	// Satoh追加 デシカント槽 2013/10/23
   227  	for i, Desica := range Ecat.Desica {
   228  		if catname == Desica.name {
   229  			C.Eqptype = DESI_TYPE
   230  			C.Ncat = i
   231  			C.Neqp = len(Esys.Desi)
   232  			Esys.Desi = append(Esys.Desi, NewDESI())
   233  
   234  			C.Nout = 2
   235  			C.Nin = 2
   236  			// 温湿度計算のために出入り口数は2
   237  			C.Airpathcpy = true
   238  
   239  			return true
   240  		}
   241  	}
   242  
   243  	// Satoh追加 気化冷却器 2013/10/27
   244  	for i, Evcaca := range Ecat.Evacca {
   245  		if catname == Evcaca.Name {
   246  			C.Eqptype = EVAC_TYPE
   247  			C.Ncat = i
   248  			C.Neqp = len(Esys.Evac)
   249  			Esys.Evac = append(Esys.Evac, NewEVAC())
   250  			C.Airpathcpy = true
   251  			C.Nout = 4
   252  			C.Nin = 4
   253  			C.Idi = []ELIOType{ELIO_D, ELIO_d, ELIO_W, ELIO_w} // DdWw
   254  			C.Ido = []ELIOType{ELIO_D, ELIO_d, ELIO_W, ELIO_w} // DdWw
   255  
   256  			return true
   257  		}
   258  	}
   259  
   260  	for i, Thexca := range Ecat.Thexca {
   261  		if catname == Thexca.Name {
   262  			C.Eqptype = THEX_TYPE
   263  			C.Ncat = i
   264  			C.Neqp = len(Esys.Thex)
   265  			Esys.Thex = append(Esys.Thex, NewTHEX())
   266  			C.Airpathcpy = true
   267  			C.Nout = 4
   268  			C.Nin = 4
   269  			C.Idi = []ELIOType{ELIO_E, ELIO_e, ELIO_O, ELIO_o} // EeOo
   270  			C.Ido = []ELIOType{ELIO_E, ELIO_e, ELIO_O, ELIO_o} // EeOo
   271  
   272  			return true
   273  		}
   274  	}
   275  
   276  	return false
   277  }