Improved IDF2JSON

The last version eliminated all comments because they are not needed in the JSON format. But the comments can be used as properties. So, I did some modifications. Since I am not familiar with Fortran. All the work is done with Python by replacing characters to change the structure. The results are shown below:

 

{

“_Version”: “8.8”,

“_Timestep”: “4”,

“_Building”: {

” Name”: “Simple One Zone w Windows”,

” North Axis (deg)”: “0”,

” Terrain”: “Suburbs”,

” Loads Convergence Tolerance Value”: “0.04”,

” Temperature Convergence Tolerance Value (deltaC)”: “0.004”,

” Solar Distribution”: “MinimalShadowing”,

” Maximum Number of Warmup Days”: “30”,

” Minimum Number of Warmup Days”: “6”

},

“_HeatBalanceAlgorithm”: “ConductionTransferFunction”,

“_SurfaceConvectionAlgorithm___Inside”: “TARP”,

“_SurfaceConvectionAlgorithm___Outside”: “DOE-2”,

“_SimulationControl”: {

” Do Zone Sizing Calculation”: “No”,

” Do System Sizing Calculation”: “No”,

” Do Plant Sizing Calculation”: “No”,

” Run Simulation for Sizing Periods”: “Yes”,

” Run Simulation for Weather File Run Periods”: “No”

},

“_RunPeriod”: {

” Name”: “Null”,

” Begin Month”: “1”,

” Begin Day of Month”: “1”,

” End Month”: “12”,

” End Day of Month”: “31”,

” Day of Week for Start Day”: “Tuesday”,

” Use Weather File Holidays and Special Days”: “Yes”,

” Use Weather File Daylight Saving Period”: “Yes”,

” Apply Weekend Holiday Rule”: “No”,

” Use Weather File Rain Indicators”: “Yes”,

” Use Weather File Snow Indicators”: “Yes”

},

“_Site___Location”: {

” Name”: “Denver Stapleton Intl Arpt CO USA WMO=724690”,

” Latitude (deg)”: “39.77”,

” Longitude (deg)”: “-104.87”,

” Time Zone (hr)”: “-7.00”,

” Elevation (m)”: “1611.00”

},

“_SizingPeriod___DesignDay”: {

” Name”: “Denver Stapleton Intl Arpt Ann Clg 1% Condns DB=>MWB”,

” Month”: “7”,

” Day of Month”: “21”,

” Day Type”: “SummerDesignDay”,

” Maximum Dry-Bulb Temperature (C)”: “32.6”,

” Daily Dry-Bulb Temperature Range (deltaC)”: “15.2”,

” Dry-Bulb Temperature Range Modifier Type”: “Null”,

” Dry-Bulb Temperature Range Modifier Day Schedule Name”: “Null”,

” Humidity Condition Type”: “Wetbulb”,

” Wetbulb or DewPoint at Maximum Dry-Bulb (C)”: “15.6”,

” Humidity Condition Day Schedule Name”: “Null”,

” Humidity Ratio at Maximum Dry-Bulb (kgWater/kgDryAir)”: “Null”,

” Enthalpy at Maximum Dry-Bulb (J/kg)”: “Null”,

” Daily Wet-Bulb Temperature Range (deltaC)”: “Null”,

” Barometric Pressure (Pa)”: “83411.”,

” Wind Speed (m/s)”: “4”,

” Wind Direction (deg)”: “120”,

” Rain Indicator”: “No”,

” Snow Indicator”: “No”,

” Daylight Saving Time Indicator”: “No”,

” Solar Model Indicator”: “ASHRAEClearSky”,

” Beam Solar Day Schedule Name”: “Null”,

” Diffuse Solar Day Schedule Name”: “Null”,

” ASHRAE Clear Sky Optical Depth for Beam Irradiance (taub) (dimensionless)”: “Null”,

” ASHRAE Clear Sky Optical Depth for Diffuse Irradiance (taud) (dimensionless)”: “Null”,

” Sky Clearness”: “1.00”

},

“_Material___NoMass”: {

” Name”: “R31LAYER”,

” Roughness”: “Rough”,

” Thermal Resistance (m2-K/W)”: “5.456”,

” Thermal Absorptance”: “0.9000000”,

” Solar Absorptance”: “0.7500000”,

” Visible Absorptance”: “0.7500000”

},

“_Material”: {

” Name”: “C5 – 4 IN HW CONCRETE”,

” Roughness”: “MediumRough”,

” Thickness (m)”: “0.1014984”,

” Conductivity (W/m-K)”: “1.729577”,

” Density (kg/m3)”: “2242.585”,

” Specific Heat (J/kg-K)”: “836.8000”,

” Thermal Absorptance”: “0.9000000”,

” Solar Absorptance”: “0.6500000”,

” Visible Absorptance”: “0.6500000”

},

“_Construction”: {

” Name”: “ROOF31”,

” Outside Layer”: “R31LAYER”

},

“_Construction___WindowDataFile”: {

” Name”: “DoubleClear”,

” File Name”: “..BACKSLASHdatasetsBACKSLASHWindow5DataFile.dat”

},

“_Site___GroundTemperature___BuildingSurface”: “18.89,18.92,19.02,19.12,19.21,19.23,19.07,19.32,19.09,19.21,19.13,18.96”,

“_Zone”: {

” Name”: “ZONE ONE”,

” Direction of Relative North (deg)”: “0”,

” X Origin (m)”: “0”,

” Y Origin (m)”: “0”,

” Z Origin (m)”: “0”,

” Type”: “1”,

” Multiplier”: “1”,

” Ceiling Height (m)”: “autocalculate”,

” Volume (m3)”: “autocalculate”

},

“_ScheduleTypeLimits”: {

” Name”: “Fraction”,

” Lower Limit Value”: “0.0”,

” Upper Limit Value”: “1.0”,

” Numeric Type”: “CONTINUOUS”

},

“_GlobalGeometryRules”: {

” Starting Vertex Position”: “UpperLeftCorner”,

” Vertex Entry Direction”: “CounterClockWise”,

” Coordinate System”: “World”

},

“_BuildingSurface___Detailed”: {

” Name”: “Zn001___Roof001”,

” Surface Type”: “Roof”,

” Construction Name”: “ROOF31”,

” Zone Name”: “ZONE ONE”,

” Outside Boundary Condition”: “Outdoors”,

” Outside Boundary Condition Object”: “Null”,

” Sun Exposure”: “SunExposed”,

” Wind Exposure”: “WindExposed”,

” View Factor to Ground”: “0”,

” Number of Vertices”: “4”,

” X,Y,Z ==> Vertex 1 (m)”: “0.000000,15.24000,4.572”,

” X,Y,Z ==> Vertex 2 (m)”: “0.000000,0.000000,4.572”,

” X,Y,Z ==> Vertex 3 (m)”: “15.24000,0.000000,4.572”,

” X,Y,Z ==> Vertex 4 (m)”: “15.24000,15.24000,4.572”

},

“_FenestrationSurface___Detailed”: {

” Name”: “Zn001_Wall001_Win001”,

” Surface Type”: “Window”,

” Construction Name”: “DoubleClear”,

” Building Surface Name”: “Zn001___Wall001”,

” Outside Boundary Condition Object”: “Null”,

” View Factor to Ground”: “0.5000000”,

” Shading Control Name”: “Null”,

” Frame and Divider Name”: “Null”,

” Multiplier”: “1.0”,

” Number of Vertices”: “4”,

” X,Y,Z ==> Vertex 1 (m)”: “0.548000,0,2.5000”,

” X,Y,Z ==> Vertex 2 (m)”: “0.548000,0,0.5000”,

” X,Y,Z ==> Vertex 3 (m)”: “5.548000,0,0.5000”,

” X,Y,Z ==> Vertex 4 (m)”: “5.548000,0,2.5000”

},

“_Output___Variable”: “ZN001___WALL001___WIN001,Surface Outside Face Temperature,timestep”,

“_Output___VariableDictionary”: “Regular”,

“_Output___Surfaces___Drawing”: “dxf”,

“_Output___Surfaces___List”: “details”,

“_Output___Constructions”: “Constructions”,

“_Output___Meter___MeterFileOnly”: “EnergyTransfer___Facility,hourly”,

“_OutputControl___Table___Style”: {

” Column Separator”: “HTML”

},

“_Output___Table___SummaryReports”: {

” Report 1 Name”: “AllSummary”

}

}

IDFtoJSON

EnergyPlus is developed based on Fortran 950. The file format looks very like JavaScript Object Notation (JSON). By extracting the comments as properties, it can be transformed to JSON format. I did some modifications to EnergyPlus IDF file and transformed it to JSON format with Python. The JSON file was validated by https://www.bejson.com/ . Then, I transformed it back to IDF and ran the simulation again.

{
“Version”: “8.8”,
“Timestep”: “4”,
“Building”: “___Simple One Zone w Windows,___0,___Suburbs,___0.04,___0.004,___MinimalShadowing,___30,___6”,
“HeatBalanceAlgorithm”: “ConductionTransferFunction”,
“SurfaceConvectionAlgorithm___Inside”: “TARP”,
“SurfaceConvectionAlgorithm___Outside”: “DOE-2”,
“SimulationControl”: “___No,___No,___No,___Yes,___No”,
“RunPeriod”: “___Null,___1,___1,___12,___31,___Tuesday,___Yes,___Yes,___No,___Yes,___Yes”,
“Site___Location”: “___Denver Stapleton Intl Arpt CO USA WMO=724690,___39.77,___-104.87,___-7.00,___1611.00”,
“SizingPeriod___DesignDay”: “___Denver Stapleton Intl Arpt Ann Clg 1% Condns DB=>MWB,___7,___21,___SummerDesignDay,___32.6,___15.2,___Null,___Null,___Wetbulb,___15.6,___Null,___Null,___Null,___Null,___83411.,___4,___120,___No,___No,___No,___ASHRAEClearSky,___Null,___Null,___Null,___Null,___1.00”,
“Material___NoMass”: “___R31LAYER,___Rough,___5.456,___0.9000000,___0.7500000,___0.7500000”,
“Material”: “___C5 – 4 IN HW CONCRETE,___MediumRough,___0.1014984,___1.729577,___2242.585,___836.8000,___0.9000000,___0.6500000,___0.6500000”,
“Construction”: “___ROOF31,___R31LAYER”,
“Construction___WindowDataFile”: “___DoubleClear,___..BACKSLASHdatasetsBACKSLASHWindow5DataFile.dat”,
“Site___GroundTemperature___BuildingSurface”: “18.89,18.92,19.02,19.12,19.21,19.23,19.07,19.32,19.09,19.21,19.13,18.96”,
“Zone”: “___ZONE ONE,___0,___0,___0,___0,___1,___1,___autocalculate,___autocalculate”,
“ScheduleTypeLimits”: “___Fraction,___0.0,___1.0,___CONTINUOUS”,
“GlobalGeometryRules”: “___UpperLeftCorner,___CounterClockWise,___World”,
“BuildingSurface___Detailed”: “___Zn001___Roof001,___Roof,___ROOF31,___ZONE ONE,___Outdoors,___Null,___SunExposed,___WindExposed,___0,___4,___0.000000,15.24000,4.572,___0.000000,0.000000,4.572,___15.24000,0.000000,4.572,___15.24000,15.24000,4.572”,
“FenestrationSurface___Detailed”: “___Zn001___Wall001___Win001,___Window,___DoubleClear,___Zn001___Wall001,___Null,___0.5000000,___Null,___Null,___1.0,___4,___0.548000,0,2.5000,___0.548000,0,0.5000,___5.548000,0,0.5000,___5.548000,0,2.5000”,
“Output___Variable”: “ZN001___WALL001___WIN001,Surface Outside Face Temperature,timestep”,
“Output___VariableDictionary”: “Regular”,
“Output___Surfaces___Drawing”: “dxf”,
“Output___Surfaces___List”: “details”,
“Output___Constructions”: “Constructions”,
“Output___Meter___MeterFileOnly”: “EnergyTransfer___Facility,hourly”,
“OutputControl___Table___Style”: “___HTML”,
“Output___Table___SummaryReports”: “___AllSummary”
}

ErrConnectingDatabase

After upgrading to Version 4.9. I got an error of Error establishing a database connection. The possible cause of ‘Error establishing a database connection’ is the problems in MySQL, check the username and password in wp-config.php. But the causes may vary.

Firstly, open ‘wp-config.php’ and set ‘define(‘WP_DEBUG’, ‘true’)’;

Then, go to the website to see the possible problems. In my case, the website indicated two errors, problems with my MySQL account and a warning: mysql_connect(): Headers and client library minor version mismatch.

I used this command ‘php -i|grep Client’ to check the possible cause of the warning. Turned out it was the version of MySQL being too old.

So, I changed the MySQL account settings in the wp-config file. Then, reinstalled MySQL to its newest version and restarted services with following lines:

yum remove php-MySQL

yum install php-mysqlnd

systemctl restart httpd

systemctl restart mysqld

 

Thanks to:

http://blog.csdn.net/ausboyue/article/details/52790222

https://devework.com/debugging-in-wordpress.html

 

Chromedriver on Centos

运行微博爬虫始终提示

‘chromedriver’ executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/ch

试图通过yum –y install chromedriver阿里云匹配的chromedriver的版本低于chrome,需要更新。然后发现不管是更新chrome还是chromium,始终都存在着版本不对。直到找到了这个:

https://blog.csdn.net/herobacking/article/details/80276060

安装 chrome

使用下面的命令,在root用户下就可以安装最新的 Google Chrome:

yum –y install google-chrome-stable

安装 selenium

在 seleniump官网 找到最新的版本,下载selenium-server-standalone-X.XX.X.jar文件

selenium-server-standalone-3.13.0.jar

selenium服务初始化

将上述selenium放入一个文件夹中,输入如下命令初始化

java -jar selenium-server-standalone-3.13.0.jar

注意,需要 java8 环境,可以参考 CentOS7安装java运行环境jdk

安装 chromerriver

在 chromerriver官网下载最新的ChromeDriver压缩包,解压得到chromedriver.exe文件

chromedriver_linux64.zip

将下载的文件解压,放在如下位置

/usr/bin/chromedriver

给予执行权限

chmod +x /usr/bin/chromedriver

安装 XVFB

输入如下命令

yum install Xvfb -y  yum install xorg-x11-fonts* -y

新建在/usr/bin/ 一个名叫 xvfb-chrom 的文件写入以下内容:

vi /usr/bin/xvfb-chrome

#!/bin/bash    _kill_procs() {    kill -TERM $chrome    wait $chrome    kill -TERM $xvfb  }    # Setup a trap to catch SIGTERM and relay it to child processes  trap _kill_procs SIGTERM    XVFB_WHD=${XVFB_WHD:-1280x720x16}    # Start Xvfb  Xvfb :99 -ac -screen 0 $XVFB_WHD -nolisten tcp &  xvfb=$!    export DISPLAY=:99    chrome –no-sandbox –disable-gpu$@ &  chrome=$!    wait $chrome  wait $xvfb

添加执行权限

chmod +x /usr/bin/xvfb-chrome

查看当前映射关系

ll /usr/bin/ | grep chrom

-rwxr-xr-x   1 root root   7874704 Mar 20 14:55 chromedriverlrwxrwxrwx   1 root root        31 Mar 20 00:24 google-chrome -> /etc/alternatives/google-chromelrwxrwxrwx   1 root root        32 Mar 20 14:30 google-chrome-stable -> /opt/google/chrome/google-chrome

更改Chrome启动的软连接

ln -s /etc/alternatives/google-chrome /usr/bin/chrome  rm -rf /usr/bin/google-chrome ln -s /usr/bin/xvfb-chrome /usr/bin/google-chrome

查看修改后的映射关系

ll /usr/bin/ | grep chrom

-rwxr-xr-x   1 root root   7874704 Mar 20 14:55 chromedriverlrwxrwxrwx   1 root root        31 Mar 20 00:24 chrome -> /etc/alternatives/google-chromelrwxrwxrwx   1 root root        22 Mar 20 00:11 google-chrome -> /usr/bin/xvfb-chromiumlrwxrwxrwx   1 root root        32 Mar 20 14:30 google-chrome-stable -> /opt/google/chrome/google-chrome-rwxr-xr-x   1 root root       432 Mar 20 00:09 xvfb-chrome

 

Solve AnacondaFailed toCreateMenus

This time I tried to solve a problem while installing Anaconda. My friend, a charming and talented lady, is interested in computer science. She wanted to learn python. So, I recommended Anaconda to her. It never occurred to me that there could be problems installing it. The failure is that ‘Anaconda failed to create menus.’

Answers from Github indicate there are many reasons, and the problem might be solved in the coming releases. They also presented many possible solutions. But most of them didn’t work. After trying again and again, I had to copy the complete folders to her installation and execute the following lines:

Firstly, go the Anaconda/Script, input ‘conda update conda’,

Then, go to Anacnoda/Lib, input ‘..python _nsis.py mkmenus’,

And problem solved. Thanks to

Update WordPress

The website reminded me about a new version had been launched. So I clicked Update. I expected it to finish updating quickly. And it did, with an error of unable to write folder. Initially, I thought it should be the problem of ‘Group’. I added a new group, changed the permissions and assigned the files to the group. No use. Then, I changed the files to 777, yet it did not work, either.

I decided to update it manually. The following two methods are tested. The first method was to download and upload the latest version through SSH, which was too slow, not to mention the network. All these led to the second method of the following lines:

  1. wget http://wordpress.org/latest.zip
  2. unzip latest.zip
  3. rm –rf wordpress/wp-content /var/www/html/wp-admin /var/www/html/wp-includes
  4. mv wordpress/* /varwww/html/
  5. rm –rf wordpress

Remember, before the commands executed, the important files are backed up.

Later, I found that it was actually very simple.

chown -R apache:apache /*/*/wp-content

Visualize Famous Campus in China

In the end of the 9th month of 2017, many great events happened. One influential thing is the launch of the country’s construction plan of world first-class universities and world first-class disciplines. The plan, also known as the “Double-First Class” initiative, really inspires scholars and researchers. Honestly, I felt sad when HNU got categorized as B in the list. But as the saying goes, be aware of shame then go forward. I decided to visualize the famous campus surroundings. In the near future, the codes will be available on GitHub soon. Now I just show some results within an 800 m circle centered by the Department of Civil Engineering.
First the campus of HNU, the points are quite abstract. But for anyone who has lived there, the basic layout has been clearly drawn. Obviously, the campus area of HNU is quite small.

I posted the images here:

https://yq.aliyun.com/articles/620469

Install WordPress on Centos

Before beginning, a domain, an ESC or a VPS are needed. Once the ECS or the VPS and the domain are prepared, the following procedures can be conducted.

Detailed steps are as followings:

  • Install LAMP services (Linux, Apache, MySQL, PHP).

input these commands:

  1. Install Apache, MySQL, and PHP

yum -y install httpd mysql mysql-server php php-mysql php-gd php-xml

  1. Set up httpd and mysqld to start with system

systemctl enable httpd.service

“””

Updated on 7.26.2018 mysqld.service failed to start.

yum install mariadb-server -y

systemctl start mariadb.service

systemctl enable mariadb.service

“””

  1. Start services

systemctl restart httpd.service
systemctl restart mariadb.service

  1. Set up MySQL

mysql_secure_installation
Set root password? [Y/n] // (Y)
Remove anonymous users? [Y/n] // (Y)
Disallow root login remotely? [Y/n] //(n)
Remove test database and access to it? [Y/n] //(Y)
Reload privilege tables now? [Y/n] //(Y)
login MySQL: mysql -u root -p  (the password is empty, just press enter)

mysql> create database wordpress; //create a database and name it as ‘wordpress’

  • Install WordPress
  1. Download and Install

wget http://wordpress.org/latest.zip  //download wordpress
unzip latest.zip  // uncompress file
cp -r wordpress/* /var/www/html/jmli //move files under floder ‘wordprss’to apache

2、Set up WordPress

cd /var/www/html
cp wp-config-sample.php wp-config.php
vim wp-config.php

Press ‘i’ to write, insert database name, user name and user password. Others remain the same.

Press ‘Esc’ to exit writing mode. Double press ‘Shift’ + ‘z’ to exit the file.

Then, go to your domain to finish WordPress set up.

I used Wanwang to register a domain and Aliyun to set up an ECS. The discounts for students and Double 11th are very attractive. As for the other services in its store, I have not used them yet.