Skip to content

Instantly share code, notes, and snippets.

View shiyuning's full-sized avatar

Yuning Shi shiyuning

View GitHub Profile
@shiyuning
shiyuning / cmake.png
Last active September 5, 2019 17:23
Instruction on installing MM-PIHM on Windows using Visual Studio
cmake.png
@shiyuning
shiyuning / Export Cycles Inputs
Last active November 30, 2015 18:33
Code to export Cycles inputs for C version
Insert the following code in MainClass.vb, Function Initialize(...), before "Return True"
' Convert to C input files (Y. Shi)
Dim utf8WithoutBom As New System.Text.UTF8Encoding(False)
' Convert simulation control
Using sim_file As New System.IO.StreamWriter(myWorkbook.Path + "/" + Microsoft.VisualBasic.Left(myWorkbook.Name, InStrRev(myWorkbook.Name, ".")) + "ctrl", False, utf8WithoutBom)
sim_file.WriteLine("{0,-24}{1,-4}", "SIMULATION_START_YEAR", startYear)
sim_file.WriteLine("{0,-24}{1,-4}", "SIMULATION_END_YEAR", endYear)
sim_file.WriteLine("{0,-24}{1,-4}", "ROTATION_SIZE", rotationSize)
@shiyuning
shiyuning / Export weather
Last active November 30, 2015 18:34
Code to export weather.dat for C version of Cycles
In WeatherClass.c, Function ReadExcelWeatherFile(...), paste the following lines before "weatherBook.Close()"
' Convert to C input files (Y. Shi)
Dim utf8WithoutBom As New System.Text.UTF8Encoding(False)
Using file As New System.IO.StreamWriter(weatherBook.Path + "/" + Microsoft.VisualBasic.Left(weatherBook.Name, InStrRev(weatherBook.Name, ".")) + "weather", False, utf8WithoutBom)
file.WriteLine("{0,-20}{1,-8}", "LATITUDE", Me.locationLatitude)
file.WriteLine("{0,-20}{1,-8}", "ALTITUDE", Me.locationAltitude)
file.WriteLine("{0,-20}{1,-8}", "SCREENING_HEIGHT", Me.screeningHeight)