github.com/archlabjp/eeslism-go@v0.0.0-20231109122333-4bb7bfcdf292/eeslism/bdhpri.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  /****************
    17  
    18   熱損失係数出力ルーチン
    19   1997.11.18
    20  	FILE=bdhpri.c
    21  
    22  ****************/
    23  
    24  package eeslism
    25  
    26  import (
    27  	"fmt"
    28  	"os"
    29  )
    30  
    31  func bdhpri(ofile string, rmvls *RMVLS, exs *EXSFS) {
    32  	Nroom := len(rmvls.Room)
    33  	e := exs.Exs
    34  
    35  	file := ofile + "_bdh.es"
    36  	fp, err := os.Create(file)
    37  	if err != nil {
    38  		fmt.Println("Error opening file:", err)
    39  		return
    40  	}
    41  	defer fp.Close()
    42  
    43  	fmt.Fprintf(fp, "%d\n", Nroom)
    44  
    45  	for i := 0; i < Nroom; i++ {
    46  		room := rmvls.Room[i]
    47  		fmt.Fprintf(fp, "%s\t", room.Name)
    48  		fmt.Fprintf(fp, "%d\t", room.N)
    49  		fmt.Fprintf(fp, "%.3f\t", room.FArea)
    50  		fmt.Fprintf(fp, "%.3f\t#\n", room.VRM)
    51  
    52  		for j := 0; j < room.N; j++ {
    53  			r := room.rsrf[j]
    54  			if r.ble == BLE_ExternalWall || r.ble == BLE_Window || r.ble == BLE_Roof || r.ble == BLE_Floor {
    55  				er := e[r.exs]
    56  				fmt.Fprintf(fp, "\t%s", er.Name)
    57  			} else if r.nextroom != nil && r.nextroom.Name != "" {
    58  				fmt.Fprintf(fp, "\t%s", r.nextroom.Name)
    59  			} else {
    60  				fmt.Fprintf(fp, "\t-")
    61  			}
    62  
    63  			if r.Name != "" && len(r.Name) > 0 {
    64  				fmt.Fprintf(fp, "\t%s\t", r.Name)
    65  			} else {
    66  				fmt.Fprintf(fp, "\t-\t")
    67  			}
    68  
    69  			fmt.Fprintf(fp, "%c\t", r.ble)
    70  			fmt.Fprintf(fp, "%.3f\t", r.A)
    71  
    72  			if r.A < 0.0 {
    73  				E := fmt.Sprintf("RmName=%s Ble=%c A=%.3f\n", room.Name, r.ble, r.A)
    74  				Errprint(1, "<bdhpri>", E)
    75  			}
    76  
    77  			if r.Rwall >= 0.0 {
    78  				fmt.Fprintf(fp, "%.3f\t%.2f\t;\n", r.Rwall, r.CAPwall)
    79  			} else {
    80  				//E := fmt.Sprintf("Rmname=%s Ble=%c  Not Defined", room.Name, r.ble)
    81  				//Errprint(1, "<bdhpri>", E)
    82  				fmt.Fprintf(fp, "\t\t;\n")
    83  			}
    84  		}
    85  		fmt.Fprintf(fp, "*\n")
    86  	}
    87  }