17
« dnia: 15 Września 2016, 13:36:40 »
I'm again playing with my AD/DC scenery and I have made AC diagnostic display for TRAXX. I have only took DC diagnostic and increase numbers on voltage scale six times. Then in python renderer I have added condition, that if voltage is bigger than 5 000 V, the AC display will be used. Changing of display surprisingly works.
When the scale has six time bigger values, I considered, the height of rectangle must be six times less sensitive to voltage, to keep in the scale. So I have multiplied voltage in algorithm by 0,167, so have code like this:
#diag slupki ac
if (state['eimp_c1_uhv']>5000):
#wolto
wolt = state['eimp_c1_uhv']
napiecie = 586-(0.0866*wolt*0.167)
draw.rectangle(((266,586),(358,napiecie)), fill=niebieski_diag)
#if wolt>2500:
#draw.rectangle(((267,608),(358,646)), fill=niebieski_diag)
if state['eimp_c1_ms']:
draw.text((271,613), u'WG wł', font=self.maly_arial, fill=bialy_diag)
elif wolt>2500:
draw.text((265,613), u'WG wył', font=self.maly_arial, fill=bialy_diag)
else:
draw.text((265,613), u'WG wył', font=self.maly_arial, fill=czarny_diag)
#ampery
prad = state['eimp_c1_ihv']
if prad<0:
prad=0
self.print_fixed_with(draw, '2000', (535,607), 4, self.sredni_arial, czarny_diag)
if prad>3700:
prad=3700
ampery = 586-(0.1183*prad)
draw.rectangle(((532,586),(625,ampery)), fill=niebieski_diag)
#hbl
hbl = state['eimp_pn1_sp']
cisn = 586-(34.6666*hbl)
draw.rectangle(((727,647),(820,cisn)), fill=niebieski_diag)
But the rectangle is still going out of scale. I also tried to change the number, but it has no effect, no matter if it's 1000 or 0,001. What I have done wrong? Files are in attachment.