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

     1  package eeslism
     2  
     3  import (
     4  	"fmt"
     5  	"io"
     6  	"strings"
     7  )
     8  
     9  /* 標題、注記の出力(時刻別計算値ファイル) */
    10  
    11  func __replace_dir_sep(path *string) {
    12  	// Replace directory separator to unify them
    13  	*path = strings.Replace(*path, "/", "\\", -1)
    14  }
    15  
    16  func ttlprint(fo io.Writer, fileid string, simc *SIMCONTL) {
    17  	// Replace directory separator to unify them
    18  	__replace_dir_sep(&simc.File)
    19  
    20  	fmt.Fprintf(fo, "%s#\n", fileid)
    21  	fmt.Fprintf(fo, "-ver %s\n", EEVERSION)
    22  	fmt.Fprintf(fo, "-t %s ;\n", simc.Title)
    23  	fmt.Fprintf(fo, "-dtf %s\n", simc.File)
    24  	fmt.Fprintf(fo, "-w %s\n", simc.Wfname)
    25  	fmt.Fprint(fo, "-tid h\n")
    26  
    27  	fmt.Fprint(fo, "-tmid ")
    28  	for i := 0; i < len(simc.Timeid); i++ {
    29  		fmt.Fprint(fo, string(simc.Timeid[i]))
    30  	}
    31  	fmt.Fprint(fo, "\n")
    32  
    33  	fmt.Fprintf(fo, "-u %s ;\n", simc.Unit)
    34  	fmt.Fprintf(fo, "-dtm %d\n", simc.DTm)
    35  	fmt.Fprintf(fo, "-Ntime %d\n", simc.Ntimehrprt)
    36  }
    37  
    38  /* ---------------------------------------------------- */
    39  
    40  /* 標題、注記の出力(日集計値ファイル) */
    41  
    42  func ttldyprint(fo io.Writer, fileid string, simc *SIMCONTL) {
    43  	fmt.Fprintf(fo, "%s#\n", fileid)
    44  	fmt.Fprintf(fo, "-ver %s\n", EEVERSION)
    45  	fmt.Fprintf(fo, "-t %s ;\n", simc.Title)
    46  	fmt.Fprintf(fo, "-dtf %s\n", simc.File)
    47  	fmt.Fprintf(fo, "-w %s\n", simc.Wfname)
    48  	fmt.Fprint(fo, "-tid d\n")
    49  
    50  	fmt.Fprint(fo, "-tmid ")
    51  	for i := 0; i < len(simc.Timeid)-1; i++ {
    52  		fmt.Fprint(fo, string(simc.Timeid[i]))
    53  	}
    54  	fmt.Fprint(fo, "\n")
    55  
    56  	fmt.Fprintf(fo, "-u %s %s ;\n", simc.Unit, simc.Unitdy)
    57  	fmt.Fprintf(fo, "-dtm %d\n", simc.DTm)
    58  	fmt.Fprintf(fo, "-Ntime %d\n", simc.Ntimedyprt)
    59  }
    60  
    61  /* ---------------------------------------------------- */
    62  
    63  /* 標題、注記の出力(日集計値ファイル) */
    64  
    65  func ttlmtprint(fo io.Writer, fileid string, simc *SIMCONTL) {
    66  	fmt.Fprintf(fo, "%s#\n", fileid)
    67  	fmt.Fprintf(fo, "-ver %s\n", EEVERSION)
    68  	fmt.Fprintf(fo, "-t %s ;\n", simc.Title)
    69  	fmt.Fprintf(fo, "-dtf %s\n", simc.File)
    70  
    71  	fmt.Fprintf(fo, "-w %s\n", simc.Wfname)
    72  	fmt.Fprint(fo, "-tid h\n")
    73  
    74  	fmt.Fprint(fo, "-tmid MT\n")
    75  
    76  	fmt.Fprintf(fo, "-u %s %s ;\n", simc.Unit, simc.Unitdy)
    77  	fmt.Fprintf(fo, "-dtm %d\n", simc.DTm)
    78  	fmt.Fprint(fo, "-Ntime 288\n") // 24 * 12
    79  }