-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvccapp_json.py
41 lines (31 loc) · 1.07 KB
/
vccapp_json.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
General Object-oriented Abstraction of VC Cycle
Yunus A. Cengel, Michael A. Boles, Thermodynamics: An Engineering Approach, 8th Edition,McGraw-Hill, 2015.
The Simulator of VC Cycle
* Input :the json file of the cycle model
* Output: text file
Run:
python vccapp_json.py
Author: Cheng Maohua [email protected]
"""
import os
import glob
import json
from simvcce.vcc.vccobj import VCCycle
from simvcce.vcc.utils import OutFiles
if __name__ == "__main__":
curpath = os.path.abspath(os.path.dirname(__file__))
ResultFilePath = curpath+'/result/'
json_filenames_str = curpath+'/jsonmodel/*.json'
json_filenames = glob.glob(json_filenames_str)
for i in range(len(json_filenames)):
with open(json_filenames[i], 'r') as f:
thedictcycle = json.loads(f.read())
# the simulator
cycle = VCCycle(thedictcycle)
cycle.simulator()
# output to console
OutFiles(cycle)
# output to the file
ResultFileName = ResultFilePath+thedictcycle['name']
OutFiles(cycle, ResultFileName + '.txt')