首次提交完整的python工程代码
This commit is contained in:
50
test/test_cal.py
Normal file
50
test/test_cal.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from math import log
|
||||
|
||||
|
||||
Rr = 10000.0
|
||||
A = -6.01188
|
||||
B = 4622.53337
|
||||
C = -86421.72414
|
||||
|
||||
R=13226
|
||||
|
||||
t= 2*C/((B**2-4*C*(A-log(R)))**0.5-B)-273.15
|
||||
print(R,t)
|
||||
|
||||
x=9.0878
|
||||
y= -0.112*x**3+4.8477*x**2-85.572*x+489.01
|
||||
print(y)
|
||||
|
||||
|
||||
A=0.4116
|
||||
B=0.931
|
||||
C=-9
|
||||
y= (-B+ (B**2-4*A*C)**0.5)/2/A
|
||||
print(y)
|
||||
|
||||
y=359 #180
|
||||
combined = round(y / 0.00205479)
|
||||
low16 = combined & 0xFFFF
|
||||
high4 = (combined >> 16) & 0xF
|
||||
#d = (high4 << 16) | low16
|
||||
d = (low16 << 16) | (high4 << 0)
|
||||
print(f"特殊公式8反推:y={y} low16={hex(low16)},high4 = {hex(high4)}, d={hex(d)}")
|
||||
|
||||
# y = 30
|
||||
# if y < (0.0973 * 1840 + 180): # 区间1:y < 359.032
|
||||
# m = (y - 180) / 0.0973
|
||||
# elif y > (0.0974 * 1840 - 179.46): # 区间2:y > -0.444
|
||||
# m = (y + 179.46) / 0.0974
|
||||
# else: # m=1840
|
||||
# m = 1840.0
|
||||
|
||||
y = 150 #30,240
|
||||
if y < (180): # 区间1:
|
||||
m = (y + 179.46) / 0.0974
|
||||
elif y > (180): # 区间2:
|
||||
m = (y - 180) / 0.0973
|
||||
else: # m=1840
|
||||
m = 0.0
|
||||
print(f"特殊公式11-1反推:y={y} d={ float(round(m))}")
|
||||
# 组帧需要整数,返回四舍五入
|
||||
#return float(round(m))
|
||||
Reference in New Issue
Block a user