-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatwg-cli
executable file
·64 lines (55 loc) · 2.38 KB
/
atwg-cli
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
@author: Andreas Kaeberlein
@copyright: Copyright 2021
@credits: AKAE
@license: GPLv3
@maintainer: Andreas Kaeberlein
@email: [email protected]
@file: atwg-cli
@date: 2021-01-17
@note Arbitrary Temperature Waveform Generator
Start:
Linux 'atwg-cli [Arguments]'
Windows 'python3 ./atwg-cli [Arguments]'
Python Anaconda: 'run ./atwg-cli '
Arguments: '--sine --chamber=SIM --minTemp=10 --maxTemp=60 --startTemp=30 --period=1h'
Example: 'atwg-cli --sine --chamber=SIM --minTemp=10 --maxTemp=60 --startTemp=30 --period=1h'
"""
#------------------------------------------------------------------------------
# Standard
import sys # python path handling
import time # get current time
# Self
from ATWG.ATWG import ATWG # Waveform generator
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
if __name__ == '__main__':
# init chamber
myATWG = ATWG() # init structure
chamberArg, waveArg = myATWG.parse_cli(cliArgs=sys.argv[1:]) # first argument is python file name
myATWG.open(chamberArg=chamberArg, waveArg=waveArg) # init waveformgenertor and open chamber interface
myATWG.start(); # start climate chamber
tsample = myATWG.cfg_tsample_sec - 1e-3; # 1 ms for timer reserved
# chamber control loop
try:
while True:
tstart = time.time() # isochron chamber update
myATWG.chamber_update() # chamber update
print(myATWG.status()) # ui
while True: # wait for target sample time
if ( tstart + tsample < time.time() ):
break
except KeyboardInterrupt:
# leave loop on CTRL + C
print("")
print("Info: Program ended normally")
except:
# abnormal end
print("")
print("Error: Program ended abnormally")
# close generator
myATWG.stop()
myATWG.close()
#------------------------------------------------------------------------------