github.com/archlabjp/eeslism-go@v0.0.0-20231109122333-4bb7bfcdf292/eeslism/mcthex.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  /* mcthex.c */
    17  
    18  package eeslism
    19  
    20  import (
    21  	"fmt"
    22  	"io"
    23  	"math"
    24  	"strconv"
    25  	"strings"
    26  )
    27  
    28  /*  全熱交換器  */
    29  
    30  /*  仕様入力  */
    31  
    32  func Thexdata(s string, Thexca *THEXCA) int {
    33  	var st int
    34  	var dt float64
    35  	var id int
    36  
    37  	if st = strings.IndexRune(s, '='); st == -1 {
    38  		Thexca.Name = s
    39  	} else {
    40  		stval := strings.Replace(s[st:], "=", "", 1)
    41  		dt, _ = strconv.ParseFloat(stval, 64)
    42  
    43  		if s == "et" {
    44  			Thexca.et = dt
    45  		} else if s == "eh" {
    46  			Thexca.eh = dt
    47  		} else {
    48  			id = 1
    49  		}
    50  	}
    51  
    52  	return id
    53  }
    54  
    55  /* ------------------------------------------------------ */
    56  
    57  func Thexint(Thex []*THEX) {
    58  	for _, thex := range Thex {
    59  		if thex.Cat.eh < 0.0 {
    60  			thex.Type = 't'
    61  			thex.Cat.eh = 0.0
    62  		} else {
    63  			thex.Type = 'h'
    64  		}
    65  
    66  		if thex.Cat.et < 0.0 {
    67  			s := fmt.Sprintf("Name=%s catname=%s et=%f", thex.Name, thex.Cat.Name, thex.Cat.et)
    68  			Eprint("<Thexint>", s)
    69  		}
    70  
    71  		thex.Xeinold = FNXtr(26.0, 50.0)
    72  		thex.Xeoutold = thex.Xeinold
    73  		thex.Xoinold = thex.Xeinold
    74  		thex.Xooutold = thex.Xeinold
    75  	}
    76  }
    77  
    78  /*  全熱交換器出口空気温湿度に関する変数割当  */
    79  func Thexelm(Thex []*THEX) {
    80  	var E, E1, E2, E3 *ELOUT
    81  	var elin, elin2 *ELIN
    82  
    83  	for _, thex := range Thex {
    84  		E = thex.Cmp.Elouts[0]
    85  		E1 = thex.Cmp.Elouts[1]
    86  		E2 = thex.Cmp.Elouts[2]
    87  		E3 = thex.Cmp.Elouts[3]
    88  
    89  		// Tein variable assignment
    90  		// E: Teout calculation, elin2: Tein
    91  		elin2 = E.Elins[0]
    92  
    93  		// E+2: Toout calculation, elin: Tein
    94  		elin = E2.Elins[1]
    95  		elin.Upo = elin2.Upo
    96  		elin.Upv = elin2.Upo
    97  
    98  		if thex.Cat.eh > 0.0 {
    99  			// E+1: xeout calculation, elin:
   100  			elin = E1.Elins[1]
   101  			elin.Upo = elin2.Upo
   102  			elin.Upv = elin2.Upo
   103  
   104  			elin = E3.Elins[3]
   105  			elin.Upo = elin2.Upo
   106  			elin.Upv = elin2.Upo
   107  		}
   108  
   109  		// Toin variable assignment
   110  		elin2 = E.Elins[1]
   111  
   112  		elin = E2.Elins[0]
   113  		elin.Upo = elin2.Upo
   114  		elin.Upv = elin2.Upo
   115  
   116  		if thex.Cat.eh > 0.0 {
   117  			elin = E1.Elins[3]
   118  			elin.Upo = elin2.Upo
   119  			elin.Upv = elin2.Upo
   120  
   121  			elin = E3.Elins[1]
   122  			elin.Upo = elin2.Upo
   123  			elin.Upv = elin2.Upo
   124  
   125  			// Teoutの変数割り当て
   126  			elin = E1.Elins[2]
   127  			elin.Upo = E
   128  			elin.Upv = E2
   129  
   130  			// Tooutの割り当て
   131  			elin = E3.Elins[2]
   132  			elin.Upo = E2
   133  			elin.Upv = E2
   134  
   135  			// xeinの割り当て
   136  			elin = E1.Elins[0]
   137  			elin2 = E3.Elins[4]
   138  			elin2.Upo = elin.Upo
   139  			elin2.Upv = elin.Upo
   140  
   141  			// xoinの割り当て
   142  			elin = E1.Elins[4]
   143  			elin2 = E3.Elins[0]
   144  			elin2.Upo = elin.Upo
   145  			elin2.Upv = elin.Upo
   146  		}
   147  	}
   148  }
   149  
   150  /* ------------------------------------------------------ */
   151  
   152  //
   153  //  [IN 1] --(E)-->  +------+ --(E)--> [OUT 1] 排気系統(温度)
   154  //  [IN 2] --(e)-->  |      | --(e)--> [OUT 2] 排気系統(エンタルピー)
   155  //                   | THEX |
   156  //  [IN 3] --(O)-->  |      | --(O)--> [OUT 3] 給気系統(温度)
   157  //  [IN 4] --(o)-->  +------+ --(o)--> [OUT 4] 給気系統(エンタルピー)
   158  //
   159  func Thexcfv(Thex []*THEX) {
   160  	var Eoet, Eoot, Eoex, Eoox *ELOUT
   161  	var etCGmin, ehGmin, Aeout, Aein, Aoout, Aoin float64
   162  
   163  	for _, thex := range Thex {
   164  		if thex.Cmp.Control != OFF_SW {
   165  			thex.ET = thex.Cat.et
   166  			thex.EH = thex.Cat.eh
   167  
   168  			Eoet = thex.Cmp.Elouts[0] // 排気系統(温度)
   169  			Eoex = thex.Cmp.Elouts[1] // 排気系統(エンタルピー)
   170  			Eoot = thex.Cmp.Elouts[2] // 給気系統(温度)
   171  			Eoox = thex.Cmp.Elouts[3] // 給気系統(エンタルピー)
   172  
   173  			thex.Ge = Eoet.G
   174  			thex.Go = Eoot.G
   175  
   176  			if DEBUG {
   177  				fmt.Printf("<Thexcfv>  %s Ge=%f Go=%f\n", thex.Cmp.Name, thex.Ge, thex.Go)
   178  			}
   179  
   180  			thex.CGe = Spcheat(Eoet.Fluid) * thex.Ge
   181  			thex.CGo = Spcheat(Eoot.Fluid) * thex.Go
   182  			etCGmin = thex.ET * math.Min(thex.CGe, thex.CGo)
   183  			ehGmin = thex.EH * math.Min(thex.Ge, thex.Go)
   184  
   185  			Aein = Ca + Cv*thex.Xeinold
   186  			Aeout = Ca + Cv*thex.Xeoutold
   187  			Aoin = Ca + Cv*thex.Xoinold
   188  			Aoout = Ca + Cv*thex.Xooutold
   189  
   190  			// 排気系統(温度)の熱収支
   191  			Eoet.Coeffo = thex.CGe
   192  			Eoet.Co = 0.0
   193  			cfin := Eoet.Coeffin
   194  			cfin[0] = etCGmin - thex.CGe
   195  			cfin[1] = -etCGmin
   196  
   197  			// 給気系統(温度)の熱収支
   198  			Eoot.Coeffo = thex.CGo
   199  			Eoot.Co = 0.0
   200  			cfin = Eoot.Coeffin
   201  			cfin[0] = etCGmin - thex.CGo
   202  			cfin[1] = -etCGmin
   203  
   204  			if thex.Type == 'h' {
   205  				// 排気系統(エンタルピー)の熱収支
   206  				Eoex.Coeffo = thex.Ge * Ro
   207  				Eoex.Co = 0.0
   208  				cfin = Eoex.Coeffin
   209  				cfin[0] = Ro * (ehGmin - thex.Ge)
   210  				cfin[1] = Aein * (ehGmin - thex.Ge)
   211  				cfin[2] = Aeout * thex.Ge
   212  				cfin[3] = -ehGmin * Aoin
   213  				cfin[4] = -ehGmin * Ro
   214  
   215  				// 給気系統(エンタルピー)の熱収支
   216  				Eoox.Coeffo = thex.Go * Ro
   217  				Eoox.Co = 0.0
   218  				cfin = Eoox.Coeffin
   219  				cfin[0] = Ro * (ehGmin - thex.Go)
   220  				cfin[1] = Aoin * (ehGmin - thex.Go)
   221  				cfin[2] = thex.Go * Aoout
   222  				cfin[3] = -ehGmin * Aein
   223  				cfin[4] = -ehGmin * Ro
   224  			} else {
   225  				Eoex.Coeffo = 1.0
   226  				Eoex.Coeffin[0] = -1.0
   227  
   228  				Eoox.Coeffo = 1.0
   229  				Eoox.Coeffin[0] = -1.0
   230  			}
   231  		}
   232  	}
   233  }
   234  
   235  func Thexene(Thex []*THEX) {
   236  	for _, thex := range Thex {
   237  		Eoet := thex.Cmp.Elouts[0] // 排気系統(温度)
   238  		Eoex := thex.Cmp.Elouts[1] // 排気系統(エンタルピー)
   239  		Eoot := thex.Cmp.Elouts[2] // 給気系統(温度)
   240  		Eoox := thex.Cmp.Elouts[3] // 給気系統(エンタルピー)
   241  
   242  		thex.Tein = Eoet.Elins[0].Upo.Sysv
   243  		thex.Teout = Eoet.Sysv
   244  		thex.Xein = Eoex.Elins[0].Upo.Sysv
   245  		thex.Xeout = Eoex.Sysv
   246  
   247  		thex.Toin = Eoot.Elins[0].Upo.Sysv
   248  		thex.Toout = Eoot.Sysv
   249  		thex.Xoin = Eoox.Elins[0].Upo.Sysv
   250  		thex.Xoout = Eoox.Sysv
   251  
   252  		thex.Hein = FNH(thex.Tein, thex.Xein)
   253  		thex.Heout = FNH(thex.Teout, thex.Xeout)
   254  		thex.Hoin = FNH(thex.Toin, thex.Xoin)
   255  		thex.Hoout = FNH(thex.Toout, thex.Xoout)
   256  
   257  		if thex.Cmp.Control != OFF_SW {
   258  			// 交換熱量の計算
   259  			thex.Qes = Ca * thex.Ge * (thex.Teout - thex.Tein)
   260  			thex.Qel = Ro * thex.Ge * (thex.Xeout - thex.Xein)
   261  			thex.Qet = thex.Qes + thex.Qel
   262  
   263  			thex.Qos = Ca * thex.Go * (thex.Toout - thex.Toin)
   264  			thex.Qol = Ro * thex.Go * (thex.Xoout - thex.Xoin)
   265  			thex.Qot = thex.Qos + thex.Qol
   266  
   267  			// 前時刻の絶対湿度の入れ替え
   268  			thex.Xeinold = thex.Xein
   269  			thex.Xeoutold = thex.Xeout
   270  			thex.Xoinold = thex.Xoin
   271  			thex.Xooutold = thex.Xoout
   272  		} else {
   273  			thex.Qes = 0.0
   274  			thex.Qel = 0.0
   275  			thex.Qet = 0.0
   276  			thex.Qos = 0.0
   277  			thex.Qol = 0.0
   278  			thex.Qot = 0.0
   279  			thex.Ge = 0.0
   280  			thex.Tein = 0.0
   281  			thex.Teout = 0.0
   282  			thex.Xein = 0.0
   283  			thex.Xeout = 0.0
   284  			thex.Hein = 0.0
   285  			thex.Heout = 0.0
   286  			thex.Go = 0.0
   287  			thex.Toin = 0.0
   288  			thex.Toout = 0.0
   289  			thex.Xoin = 0.0
   290  			thex.Xoout = 0.0
   291  			thex.Hoin = 0.0
   292  			thex.Hoout = 0.0
   293  		}
   294  	}
   295  }
   296  
   297  func Thexprint(fo io.Writer, id int, Thex []*THEX) {
   298  	var el *ELOUT
   299  
   300  	switch id {
   301  	case 0:
   302  		if len(Thex) > 0 {
   303  			fmt.Fprintf(fo, "%s %d\n", THEX_TYPE, len(Thex))
   304  		}
   305  		for _, thex := range Thex {
   306  			fmt.Fprintf(fo, " %s 1 22\n", thex.Name)
   307  		}
   308  
   309  	case 1:
   310  		for _, thex := range Thex {
   311  			fmt.Fprintf(fo, "%s_ce c c %s_Ge m f %s_Tei t f %s_Teo t f %s_xei t f %s_xeo t f\n",
   312  				thex.Name, thex.Name, thex.Name, thex.Name, thex.Name, thex.Name)
   313  			fmt.Fprintf(fo, "%s_hei h f %s_heo h f %s_Qes q f %s_Qel q f %s_Qet q f\n",
   314  				thex.Name, thex.Name, thex.Name, thex.Name, thex.Name)
   315  
   316  			fmt.Fprintf(fo, "%s_co c c %s_Go m f %s_Toi t f %s_Too t f %s_xoi t f %s_xoo t f\n",
   317  				thex.Name, thex.Name, thex.Name, thex.Name, thex.Name, thex.Name)
   318  			fmt.Fprintf(fo, "%s_hoi h f %s_hoo h f %s_Qos q f %s_Qol q f %s_Qot q f\n",
   319  				thex.Name, thex.Name, thex.Name, thex.Name, thex.Name)
   320  		}
   321  
   322  	default:
   323  		for _, thex := range Thex {
   324  			el = thex.Cmp.Elouts[0]
   325  			fmt.Fprintf(fo, "%c %6.4g %4.2f %4.2f %.4f %.4f ",
   326  				el.Control, thex.Ge, thex.Tein, thex.Teout, thex.Xein, thex.Xeout)
   327  			fmt.Fprintf(fo, "%.0f %.0f %.2f %.2f %.2f\n",
   328  				thex.Hein, thex.Heout, thex.Qes, thex.Qel, thex.Qet)
   329  
   330  			el = thex.Cmp.Elouts[2]
   331  			fmt.Fprintf(fo, "%c %6.4g %4.2f %4.2f %.4f %.4f ",
   332  				el.Control, thex.Go, thex.Toin, thex.Toout, thex.Xoin, thex.Xoout)
   333  			fmt.Fprintf(fo, "%.0f %.0f %.2f %.2f %.2f\n",
   334  				thex.Hoin, thex.Hoout, thex.Qos, thex.Qol, thex.Qot)
   335  		}
   336  	}
   337  }
   338  
   339  func Thexdyint(Thex []*THEX) {
   340  	for _, thex := range Thex {
   341  		svdyint(&thex.Teidy)
   342  		svdyint(&thex.Teody)
   343  		svdyint(&thex.Xeidy)
   344  		svdyint(&thex.Xeody)
   345  
   346  		svdyint(&thex.Toidy)
   347  		svdyint(&thex.Toody)
   348  		svdyint(&thex.Xoidy)
   349  		svdyint(&thex.Xoody)
   350  
   351  		qdyint(&thex.Qdyes)
   352  		qdyint(&thex.Qdyel)
   353  		qdyint(&thex.Qdyet)
   354  
   355  		qdyint(&thex.Qdyos)
   356  		qdyint(&thex.Qdyol)
   357  		qdyint(&thex.Qdyot)
   358  	}
   359  }
   360  
   361  func Thexmonint(Thex []*THEX) {
   362  	for _, thex := range Thex {
   363  		svdyint(&thex.MTeidy)
   364  		svdyint(&thex.MTeody)
   365  		svdyint(&thex.MXeidy)
   366  		svdyint(&thex.MXeody)
   367  
   368  		svdyint(&thex.MToidy)
   369  		svdyint(&thex.MToody)
   370  		svdyint(&thex.MXoidy)
   371  		svdyint(&thex.MXoody)
   372  
   373  		qdyint(&thex.MQdyes)
   374  		qdyint(&thex.MQdyel)
   375  		qdyint(&thex.MQdyet)
   376  
   377  		qdyint(&thex.MQdyos)
   378  		qdyint(&thex.MQdyol)
   379  		qdyint(&thex.MQdyot)
   380  	}
   381  }
   382  
   383  func Thexday(Mon, Day, ttmm int, Thex []*THEX, Nday, SimDayend int) {
   384  	for _, thex := range Thex {
   385  		// 日集計
   386  		svdaysum(int64(ttmm), thex.Cmp.Control, thex.Tein, &thex.Teidy)
   387  		svdaysum(int64(ttmm), thex.Cmp.Control, thex.Teout, &thex.Teody)
   388  		svdaysum(int64(ttmm), thex.Cmp.Control, thex.Xein, &thex.Xeidy)
   389  		svdaysum(int64(ttmm), thex.Cmp.Control, thex.Xeout, &thex.Xeody)
   390  
   391  		svdaysum(int64(ttmm), thex.Cmp.Control, thex.Toin, &thex.Toidy)
   392  		svdaysum(int64(ttmm), thex.Cmp.Control, thex.Toout, &thex.Toody)
   393  		svdaysum(int64(ttmm), thex.Cmp.Control, thex.Xoin, &thex.Xoidy)
   394  		svdaysum(int64(ttmm), thex.Cmp.Control, thex.Xoout, &thex.Xoody)
   395  
   396  		qdaysum(int64(ttmm), thex.Cmp.Control, thex.Qes, &thex.Qdyes)
   397  		qdaysum(int64(ttmm), thex.Cmp.Control, thex.Qel, &thex.Qdyel)
   398  		qdaysum(int64(ttmm), thex.Cmp.Control, thex.Qet, &thex.Qdyet)
   399  
   400  		qdaysum(int64(ttmm), thex.Cmp.Control, thex.Qos, &thex.Qdyos)
   401  		qdaysum(int64(ttmm), thex.Cmp.Control, thex.Qol, &thex.Qdyol)
   402  		qdaysum(int64(ttmm), thex.Cmp.Control, thex.Qot, &thex.Qdyot)
   403  
   404  		// 月集計
   405  		svmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Tein, &thex.MTeidy, Nday, SimDayend)
   406  		svmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Teout, &thex.MTeody, Nday, SimDayend)
   407  		svmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Xein, &thex.MXeidy, Nday, SimDayend)
   408  		svmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Xeout, &thex.MXeody, Nday, SimDayend)
   409  
   410  		svmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Toin, &thex.MToidy, Nday, SimDayend)
   411  		svmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Toout, &thex.MToody, Nday, SimDayend)
   412  		svmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Xoin, &thex.MXoidy, Nday, SimDayend)
   413  		svmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Xoout, &thex.MXoody, Nday, SimDayend)
   414  
   415  		qmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Qes, &thex.MQdyes, Nday, SimDayend)
   416  		qmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Qel, &thex.MQdyel, Nday, SimDayend)
   417  		qmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Qet, &thex.MQdyet, Nday, SimDayend)
   418  
   419  		qmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Qos, &thex.MQdyos, Nday, SimDayend)
   420  		qmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Qol, &thex.MQdyol, Nday, SimDayend)
   421  		qmonsum(Mon, Day, ttmm, thex.Cmp.Control, thex.Qot, &thex.MQdyot, Nday, SimDayend)
   422  	}
   423  }
   424  
   425  func Thexdyprt(fo io.Writer, id int, Thex []*THEX) {
   426  	switch id {
   427  	case 0:
   428  		if len(Thex) > 0 {
   429  			fmt.Fprintf(fo, "%s %d\n", THEX_TYPE, len(Thex))
   430  		}
   431  		for _, thex := range Thex {
   432  			fmt.Fprintf(fo, " %s 1 48\n", thex.Name)
   433  		}
   434  	case 1:
   435  		for _, thex := range Thex {
   436  			fmt.Fprintf(fo, "%s_Hte H d %s_Te T f ", thex.Name, thex.Name)
   437  			fmt.Fprintf(fo, "%s_ttne h d %s_Ten t f %s_ttme h d %s_Tem t f\n",
   438  				thex.Name, thex.Name, thex.Name, thex.Name)
   439  			fmt.Fprintf(fo, "%s_Hto H d %s_To T f ", thex.Name, thex.Name)
   440  			fmt.Fprintf(fo, "%s_ttno h d %s_Ton t f %s_ttmo h d %s_Tom t f\n",
   441  				thex.Name, thex.Name, thex.Name, thex.Name)
   442  
   443  			fmt.Fprintf(fo, "%s_Hxe H d %s_xe T f ", thex.Name, thex.Name)
   444  			fmt.Fprintf(fo, "%s_txne h d %s_xen t f %s_txme h d %s_xem t f\n",
   445  				thex.Name, thex.Name, thex.Name, thex.Name)
   446  			fmt.Fprintf(fo, "%s_Hxo H d %s_xo T f ", thex.Name, thex.Name)
   447  			fmt.Fprintf(fo, "%s_txno h d %s_xon t f %s_txmo h d %s_xom t f\n",
   448  				thex.Name, thex.Name, thex.Name, thex.Name)
   449  
   450  			fmt.Fprintf(fo, "%s_Hhs H d %s_Qsh Q f %s_Hcs H d %s_Qsc Q f\n",
   451  				thex.Name, thex.Name, thex.Name, thex.Name)
   452  			fmt.Fprintf(fo, "%s_ths h d %s_qsh q f %s_tcs h d %s_qsc q f\n\n",
   453  				thex.Name, thex.Name, thex.Name, thex.Name)
   454  			fmt.Fprintf(fo, "%s_Hhl H d %s_Qlh Q f %s_Hcl H d %s_Qlc Q f\n",
   455  				thex.Name, thex.Name, thex.Name, thex.Name)
   456  			fmt.Fprintf(fo, "%s_thl h d %s_qlh q f %s_tcl h d %s_qlc q f\n\n",
   457  				thex.Name, thex.Name, thex.Name, thex.Name)
   458  			fmt.Fprintf(fo, "%s_Hht H d %s_Qth Q f %s_Hct H d %s_Qtc Q f\n",
   459  				thex.Name, thex.Name, thex.Name, thex.Name)
   460  			fmt.Fprintf(fo, "%s_tht h d %s_qth q f %s_tct h d %s_qtc q f\n\n",
   461  				thex.Name, thex.Name, thex.Name, thex.Name)
   462  		}
   463  	default:
   464  		for _, thex := range Thex {
   465  			fmt.Fprintf(fo, "%1d %3.1f %1d %3.1f %1d %3.1f ",
   466  				thex.Teidy.Hrs, thex.Teidy.M,
   467  				thex.Teidy.Mntime, thex.Teidy.Mn,
   468  				thex.Teidy.Mxtime, thex.Teidy.Mx)
   469  			fmt.Fprintf(fo, "%1d %3.1f %1d %3.1f %1d %3.1f\n",
   470  				thex.Toidy.Hrs, thex.Toidy.M,
   471  				thex.Toidy.Mntime, thex.Toidy.Mn,
   472  				thex.Toidy.Mxtime, thex.Toidy.Mx)
   473  			fmt.Fprintf(fo, "%1d %3.1f %1d %3.1f %1d %3.1f ",
   474  				thex.Xeidy.Hrs, thex.Xeidy.M,
   475  				thex.Xeidy.Mntime, thex.Xeidy.Mn,
   476  				thex.Xeidy.Mxtime, thex.Xeidy.Mx)
   477  			fmt.Fprintf(fo, "%1d %3.1f %1d %3.1f %1d %3.1f\n",
   478  				thex.Xoidy.Hrs, thex.Xoidy.M,
   479  				thex.Xoidy.Mntime, thex.Xoidy.Mn,
   480  				thex.Xoidy.Mxtime, thex.Xoidy.Mx)
   481  			fmt.Fprintf(fo, "%1d %3.1f ", thex.Qdyes.Hhr, thex.Qdyes.H)
   482  			fmt.Fprintf(fo, "%1d %3.1f ", thex.Qdyes.Chr, thex.Qdyes.C)
   483  			fmt.Fprintf(fo, "%1d %2.0f ", thex.Qdyes.Hmxtime, thex.Qdyes.Hmx)
   484  			fmt.Fprintf(fo, "%1d %2.0f\n", thex.Qdyes.Cmxtime, thex.Qdyes.Cmx)
   485  
   486  			fmt.Fprintf(fo, "%1d %3.1f ", thex.Qdyel.Hhr, thex.Qdyel.H)
   487  			fmt.Fprintf(fo, "%1d %3.1f ", thex.Qdyel.Chr, thex.Qdyel.C)
   488  			fmt.Fprintf(fo, "%1d %2.0f ", thex.Qdyel.Hmxtime, thex.Qdyel.Hmx)
   489  			fmt.Fprintf(fo, "%1d %2.0f\n", thex.Qdyel.Cmxtime, thex.Qdyel.Cmx)
   490  
   491  			fmt.Fprintf(fo, "%1d %3.1f ", thex.Qdyet.Hhr, thex.Qdyet.H)
   492  			fmt.Fprintf(fo, "%1d %3.1f ", thex.Qdyet.Chr, thex.Qdyet.C)
   493  			fmt.Fprintf(fo, "%1d %2.0f ", thex.Qdyet.Hmxtime, thex.Qdyet.Hmx)
   494  			fmt.Fprintf(fo, "%1d %2.0f\n", thex.Qdyet.Cmxtime, thex.Qdyet.Cmx)
   495  		}
   496  	}
   497  }
   498  func Thexmonprt(fo io.Writer, id int, Thex []*THEX) {
   499  	switch id {
   500  	case 0:
   501  		if len(Thex) > 0 {
   502  			fmt.Fprintf(fo, "%s %d\n", THEX_TYPE, len(Thex))
   503  		}
   504  		for _, thex := range Thex {
   505  			fmt.Fprintf(fo, " %s 1 48\n", thex.Name)
   506  		}
   507  	case 1:
   508  		for _, thex := range Thex {
   509  			fmt.Fprintf(fo, "%s_Hte H d %s_Te T f ", thex.Name, thex.Name)
   510  			fmt.Fprintf(fo, "%s_ttne h d %s_Ten t f %s_ttme h d %s_Tem t f\n",
   511  				thex.Name, thex.Name, thex.Name, thex.Name)
   512  			fmt.Fprintf(fo, "%s_Hto H d %s_To T f ", thex.Name, thex.Name)
   513  			fmt.Fprintf(fo, "%s_ttno h d %s_Ton t f %s_ttmo h d %s_Tom t f\n",
   514  				thex.Name, thex.Name, thex.Name, thex.Name)
   515  
   516  			fmt.Fprintf(fo, "%s_Hxe H d %s_xe T f ", thex.Name, thex.Name)
   517  			fmt.Fprintf(fo, "%s_txne h d %s_xen t f %s_txme h d %s_xem t f\n",
   518  				thex.Name, thex.Name, thex.Name, thex.Name)
   519  			fmt.Fprintf(fo, "%s_Hxo H d %s_xo T f ", thex.Name, thex.Name)
   520  			fmt.Fprintf(fo, "%s_txno h d %s_xon t f %s_txmo h d %s_xom t f\n",
   521  				thex.Name, thex.Name, thex.Name, thex.Name)
   522  
   523  			fmt.Fprintf(fo, "%s_Hhs H d %s_Qsh Q f %s_Hcs H d %s_Qsc Q f\n",
   524  				thex.Name, thex.Name, thex.Name, thex.Name)
   525  			fmt.Fprintf(fo, "%s_ths h d %s_qsh q f %s_tcs h d %s_qsc q f\n\n",
   526  				thex.Name, thex.Name, thex.Name, thex.Name)
   527  			fmt.Fprintf(fo, "%s_Hhl H d %s_Qlh Q f %s_Hcl H d %s_Qlc Q f\n",
   528  				thex.Name, thex.Name, thex.Name, thex.Name)
   529  			fmt.Fprintf(fo, "%s_thl h d %s_qlh q f %s_tcl h d %s_qlc q f\n\n",
   530  				thex.Name, thex.Name, thex.Name, thex.Name)
   531  			fmt.Fprintf(fo, "%s_Hht H d %s_Qth Q f %s_Hct H d %s_Qtc Q f\n",
   532  				thex.Name, thex.Name, thex.Name, thex.Name)
   533  			fmt.Fprintf(fo, "%s_tht h d %s_qth q f %s_tct h d %s_qtc q f\n\n",
   534  				thex.Name, thex.Name, thex.Name, thex.Name)
   535  		}
   536  	default:
   537  		for _, thex := range Thex {
   538  			fmt.Fprintf(fo, "%1d %3.1f %1d %3.1f %1d %3.1f ",
   539  				thex.MTeidy.Hrs, thex.MTeidy.M,
   540  				thex.MTeidy.Mntime, thex.MTeidy.Mn,
   541  				thex.MTeidy.Mxtime, thex.MTeidy.Mx)
   542  			fmt.Fprintf(fo, "%1d %3.1f %1d %3.1f %1d %3.1f\n",
   543  				thex.MToidy.Hrs, thex.MToidy.M,
   544  				thex.MToidy.Mntime, thex.MToidy.Mn,
   545  				thex.MToidy.Mxtime, thex.MToidy.Mx)
   546  			fmt.Fprintf(fo, "%1d %3.1f %1d %3.1f %1d %3.1f ",
   547  				thex.MXeidy.Hrs, thex.MXeidy.M,
   548  				thex.MXeidy.Mntime, thex.MXeidy.Mn,
   549  				thex.MXeidy.Mxtime, thex.MXeidy.Mx)
   550  			fmt.Fprintf(fo, "%1d %3.1f %1d %3.1f %1d %3.1f\n",
   551  				thex.MXoidy.Hrs, thex.MXoidy.M,
   552  				thex.MXoidy.Mntime, thex.MXoidy.Mn,
   553  				thex.MXoidy.Mxtime, thex.MXoidy.Mx)
   554  			fmt.Fprintf(fo, "%1d %3.1f ", thex.MQdyes.Hhr, thex.MQdyes.H)
   555  			fmt.Fprintf(fo, "%1d %3.1f ", thex.MQdyes.Chr, thex.MQdyes.C)
   556  			fmt.Fprintf(fo, "%1d %2.0f ", thex.MQdyes.Hmxtime, thex.MQdyes.Hmx)
   557  			fmt.Fprintf(fo, "%1d %2.0f\n", thex.MQdyes.Cmxtime, thex.MQdyes.Cmx)
   558  
   559  			fmt.Fprintf(fo, "%1d %3.1f ", thex.MQdyel.Hhr, thex.MQdyel.H)
   560  			fmt.Fprintf(fo, "%1d %3.1f ", thex.MQdyel.Chr, thex.MQdyel.C)
   561  			fmt.Fprintf(fo, "%1d %2.0f ", thex.MQdyel.Hmxtime, thex.MQdyel.Hmx)
   562  			fmt.Fprintf(fo, "%1d %2.0f\n", thex.MQdyel.Cmxtime, thex.MQdyel.Cmx)
   563  
   564  			fmt.Fprintf(fo, "%1d %3.1f ", thex.MQdyet.Hhr, thex.MQdyet.H)
   565  			fmt.Fprintf(fo, "%1d %3.1f ", thex.MQdyet.Chr, thex.MQdyet.C)
   566  			fmt.Fprintf(fo, "%1d %2.0f ", thex.MQdyet.Hmxtime, thex.MQdyet.Hmx)
   567  			fmt.Fprintf(fo, "%1d %2.0f\n", thex.MQdyet.Cmxtime, thex.MQdyet.Cmx)
   568  		}
   569  	}
   570  }