33
44ysp = 3.0
55
6- #// controller function//
6+ # controller function
77def controller (ym ):
88 if ym [0 ] < ysp :
99 return 1.01 * ym
1010 else :
1111 return 0.9 * ym
1212
13- #// main//
14- concore .default_maxtime (150 ) ##maps to-- for i in range(0,150):
13+ # main
14+ concore .default_maxtime (150 )
1515concore .delay = 0.02
1616
17- #//initial values-- transforms to string including the simtime as the 0th entry in the list//
18- # u = np.array([[0.0]])
19- # ym = np.array([[0.0]])
17+ # initial values -- transforms to string including the simtime as the 0th entry in the list
2018init_simtime_u = "[0.0, 0.0]"
2119init_simtime_ym = "[0.0, 0.0]"
2220
@@ -28,45 +26,7 @@ def controller(ym):
2826 #####
2927 u = controller (ym )
3028 #####
31- print (str (concore .simtime ) + ". u=" + str (u ) + "ym=" + str (ym ));
29+ print (str (concore .simtime ) + ". u=" + str (u ) + "ym=" + str (ym ))
3230 concore .write (1 ,"u" ,list (u .T [0 ]),delta = 0 )
3331
3432print ("retry=" + str (concore .retrycount ))
35-
36-
37- #//main//
38- #for i in range(0,150):
39- # u = controller(ym)
40- # print('u='+repr(u)+' ym='+repr(ym))
41-
42-
43- # ./dhg
44- # python3 mkconcore.py demo/sample.graphml demo/ demo-study macos
45- # files in main_program.dir (main_program.py) are copied. // controller2.py --> controller2.dir
46- # ubuntu, windows, (posix), docker
47- # mkconcore 21-11-23
48- #concore path: .
49- #graphml input: demo/sample.graphml
50- #source directory: demo/
51- #output directory: demo-study
52- #control core type: posix
53- #treat .m as octave:False
54- #MCR path: /opt/matlab/MATLAB_Runtime_R2021a_Update_5/v910
55-
56- # cd demo-study/
57- # ./build
58- #./clear
59- #./maxtime 300
60- # ./debug
61-
62- ### For Docker
63- # Dockerfile.pm2 created in the demo folder by copying and editing concore20/Dockerfile.py.
64- # add the below:::
65- # RUN pip install tensorflow
66- # CMD ["python", "-i", "pm2.py"]
67-
68- # python3 mkconcore.py demo/sample.graphml demo/ demo-study docker
69- # ./build
70- # ./run // for docker
71- # ./stop
72- # ./clear
0 commit comments