Commit message
This commit is contained in:
parent
1951662064
commit
f235a588f0
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"get_data_interval": 10,
|
"get_data_interval": 10,
|
||||||
"set_zero_temperature": "n",
|
"set_zero_temperature": "y",
|
||||||
"ref_zero_point": {
|
"ref_zero_point": {
|
||||||
"oilInFlowRate": 4016,
|
"oilInFlowRate": 4016,
|
||||||
"oilOutFlowRate": 3995,
|
"oilOutFlowRate": 3995,
|
||||||
|
|
|
@ -8,5 +8,5 @@ spec:
|
||||||
package: requirements.txt # 설치할 Python 패키지 정보 파일입니다.(기본 값은 requirement.txt 입니다.)
|
package: requirements.txt # 설치할 Python 패키지 정보 파일입니다.(기본 값은 requirement.txt 입니다.)
|
||||||
runtime: python3.9
|
runtime: python3.9
|
||||||
stackbase:
|
stackbase:
|
||||||
tagName: v1.0.3 # Stackbase(gitea)에 릴리즈 태그명 입니다.
|
tagName: v1.0.4 # Stackbase(gitea)에 릴리즈 태그명 입니다.
|
||||||
repoName: aquarack-sensor-collector # Satackbase(gitea)에 저장될 저장소 이릅니다.
|
repoName: aquarack-sensor-collector # Satackbase(gitea)에 저장될 저장소 이릅니다.
|
||||||
|
|
9
main.py
9
main.py
|
@ -21,11 +21,12 @@ def get_point_temperature(serial_obj):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = serial_obj.read_holding_registers(address=32, count=32, slave=2)
|
res = serial_obj.read_holding_registers(address=32, count=32, slave=2)
|
||||||
# print(res)
|
|
||||||
for i, j in zip(t_col, points):
|
for i, j in zip(t_col, points):
|
||||||
res_dict[i] = res.registers[j - 1] * 0.1
|
res_dict[i] = res.registers[j - 1] * 0.1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return res_dict
|
return res_dict
|
||||||
|
|
||||||
def get_keyence_devices(serial_obj):
|
def get_keyence_devices(serial_obj):
|
||||||
|
@ -47,15 +48,15 @@ def get_keyence_devices(serial_obj):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = serial_obj.read_holding_registers(address=50, count=8, slave=5)
|
res = serial_obj.read_holding_registers(address=50, count=8, slave=5)
|
||||||
print(f'k_col: {k_col} g_zero: {g_zero_point}')
|
|
||||||
for i, j in enumerate(k_col):
|
for i, j in enumerate(k_col):
|
||||||
if i % 2 == 0:
|
if i % 2 == 0:
|
||||||
res_dict[j] = ((res.registers[i] - g_zero_point[i // 2]) / 16000) * 300
|
res_dict[j] = ((res.registers[i] - g_zero_point[i // 2]) / 16000) * 300
|
||||||
print(f'[{j}] Flow_rate: {res_dict[j]:.6f}L')
|
|
||||||
else:
|
else:
|
||||||
res_dict[j] = ((res.registers[i] - 4000) / 16000) * 100
|
res_dict[j] = ((res.registers[i] - 4000) / 16000) * 100
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return res_dict
|
return res_dict
|
||||||
|
|
||||||
def init_zero_detection(serial_obj, config_dict):
|
def init_zero_detection(serial_obj, config_dict):
|
||||||
|
@ -120,7 +121,7 @@ def runAction():
|
||||||
sleep_time = int(interval / cnt_limit) - (diff * 0.001)
|
sleep_time = int(interval / cnt_limit) - (diff * 0.001)
|
||||||
cnt += 1
|
cnt += 1
|
||||||
if cnt == cnt_limit:
|
if cnt == cnt_limit:
|
||||||
snd_data = {key: value / cnt_limit for key, value in sum_data.items() if value != 0.0}
|
snd_data = {key: value / cnt_limit for key, value in sum_data.items()}
|
||||||
sdtcloud.pubMessage(snd_data)
|
sdtcloud.pubMessage(snd_data)
|
||||||
cnt = 0
|
cnt = 0
|
||||||
sum_data = init_data_dict()
|
sum_data = init_data_dict()
|
||||||
|
|
Loading…
Reference in New Issue