Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- import time
- import os
- H2 = 100
- CH4 = 40
- C2H6 = 10
- C2H4 = 15
- C2H2 = 20
- GasPPM = [H2, CH4, C2H6, C2H4, C2H2]
- setName = ["H2", "CH4", "C2H6", "C2H4", "C2H2"]
- def setIn(H2,text):
- try:
- H2.append(float(input(text)))
- except:
- print("Ошибка ввода")
- vvod()
- time.sleep(0.1);
- os.system('cls||clear')
- def vvod():
- print("Вводим газы ")
- GasPPM = []
- for item in setName:
- setIn(GasPPM,' Введите '+item+'>> ')
- vvod()
- def PpmToPr(GasPPM):
- arr1 = np.divide(GasPPM, max(GasPPM))
- return list(arr1)
- ox = [*range(1,6)]
- oy = PpmToPr(GasPPM)
- def orderPoint(GasPPM):
- #copyAr=[]
- #copyAr = GasPPM
- aaa = list(zip(GasPPM, [0,1,2,3,4]))
- aaa.sort(reverse=True)
- a,b = zip(*aaa)
- return list(b)
- def chekD(T2,setVal):
- for item in T2:
- if (item == setVal):
- return 1
- return 0
- def TypeID(setGaz,setVal):
- i=0
- for item in setGaz:
- if chekD(item,setVal):
- return i
- i += 1
- return -1
- print(orderPoint(GasPPM))
- def outD(setVal):
- D1 = [[0, 1, 4, 3, 2]]; PDn = [[0, 1, 2, 3, 4]]; Iskr = [[0, 3, 1, 4, 2]]; Duga = [[0, 4, 3, 1, 2], [4, 0, 1, 3, 2]];
- T2 = [[1, 3, 0, 2, 4],[1, 0, 3, 2, 4],[1, 3, 2, 0, 4]]; T2toPD = [[1, 0, 2, 3, 4]];
- T3 = [[3, 1, 4, 0, 2],[3, 2, 1, 4, 0],[3, 2, 1, 0, 4]]; T3toDuga = [[3, 1, 0, 4, 2]];
- setGaz = [D1, PDn, Iskr, Duga, T2, T2toPD, T3, T3toDuga]
- setName2 = ['D1', 'PDn', 'Iskr', 'Duga', 'T2', 'T2toPD', 'T3', 'T3toDuga']
- Name = TypeID(setGaz,setVal)
- if Name == -1:
- return "None"
- else:
- return setName2[TypeID(setGaz,setVal)]
- print( outD( orderPoint(GasPPM) ) )
- plt.plot(ox, oy)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement