diff --git a/config.json b/config.json index d6cb1b1..d02427e 100644 --- a/config.json +++ b/config.json @@ -7,5 +7,6 @@ "tcp-server": { "address": "25.7.57.1", "port": 7007 - } + }, + "volume-water": 542 } \ No newline at end of file diff --git a/framework.yaml b/framework.yaml index cf47ac3..2bc9572 100644 --- a/framework.yaml +++ b/framework.yaml @@ -7,5 +7,5 @@ spec: virtualEnv: base # 사용할 가상환경 이름입니다. package: requirements.txt # 설치할 Python 패키지 정보 파일입니다.(기본 값은 requirement.txt 입니다.) stackbase: - tagName: v0.0.9 # Stackbase(gitea)에 릴리즈 태그명 입니다. + tagName: v0.0.10 # Stackbase(gitea)에 릴리즈 태그명 입니다. repoName: sampyo-dio # Stackbase(gitea)에 저장될 저장소 이릅니다. diff --git a/main.py b/main.py index 302ba1b..f6c526a 100644 --- a/main.py +++ b/main.py @@ -61,9 +61,9 @@ def Measure_Weight(client): return val def Calculate_Concentration(weight): - global data + global data, volume_water data['data']['weight'] = weight - result = (float(weight) * 1.883239171 * 128.5) - 126.11 # 1000 / 531 = 1.883239171 + result = (float(weight) * volume_water * 128.5) - 126.11 # 1000 / 531 = 1.883239171 data['data']['concentration'] = result # print(f'{weight}, {result}') @@ -315,7 +315,9 @@ if __name__ == "__main__": with open('./config.json', encoding='UTF-8') as f: jsonData = json.load(f) - + + volume_water = float(jsonData['volume-water']) / 1000.0 + modbus_addr = jsonData['modbus-server']['address'] modbus_port = jsonData['modbus-server']['port']