mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
feature: add relay control to hardwareInterface
This commit is contained in:
parent
4c80baf752
commit
8b9f840232
3 changed files with 28 additions and 6 deletions
8
doc/installation_on_windows.md
Normal file
8
doc/installation_on_windows.md
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Installation on Windows10
|
||||||
|
|
||||||
|
## Driver for the USB-to-Serial brigde
|
||||||
|
|
||||||
|
For the USB-to-Serial bridge, which is sold as CP2102, the Windows 10 tries to install the driver when plugged-in. But
|
||||||
|
the device did not work together with the driver which windows found automatically. A root cause may be, that the
|
||||||
|
device is not an original CP2102, but a clone. Finally found a driver on https://www.pololu.com/docs/0J7/all, which works.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Todos
|
# Todos
|
||||||
|
|
||||||
- [ ] Decode CableCheckRes."DC_EVSEStatus.EVSEStatusCode": dinDC_EVSEStatusCodeType as readable text
|
- [x] Decode CableCheckRes."DC_EVSEStatus.EVSEStatusCode": dinDC_EVSEStatusCodeType as readable text
|
||||||
- [ ] Decode CableCheckRes."DC_EVSEStatus.EVSEIsolationStatus": dinisolationLevelType as readable text
|
- [ ] Decode CableCheckRes."DC_EVSEStatus.EVSEIsolationStatus": dinisolationLevelType as readable text
|
||||||
- [ ] Encoder: PreChargeReq: is it possible to enable the units for EVTargetVoltage and EVTargetCurrent?
|
- [ ] Encoder: PreChargeReq: is it possible to enable the units for EVTargetVoltage and EVTargetCurrent?
|
||||||
- [ ] Find out, why Alpi reports CableCheckRes = Finished FAILED in v0.4
|
- [ ] Find out, why Alpi reports CableCheckRes = Finished FAILED in v0.4
|
||||||
|
|
|
@ -49,6 +49,14 @@ class hardwareInterface():
|
||||||
def setPowerRelayOff(self):
|
def setPowerRelayOff(self):
|
||||||
self.addToTrace("Switching PowerRelay OFF.")
|
self.addToTrace("Switching PowerRelay OFF.")
|
||||||
self.outvalue &= ~2
|
self.outvalue &= ~2
|
||||||
|
|
||||||
|
def setRelay2On(self):
|
||||||
|
self.addToTrace("Switching PowerRelay ON.")
|
||||||
|
self.outvalue |= 4
|
||||||
|
|
||||||
|
def setRelay2Off(self):
|
||||||
|
self.addToTrace("Switching PowerRelay OFF.")
|
||||||
|
self.outvalue &= ~4
|
||||||
|
|
||||||
def getInletVoltage(self):
|
def getInletVoltage(self):
|
||||||
#todo: get real measured voltage from the inlet
|
#todo: get real measured voltage from the inlet
|
||||||
|
@ -122,16 +130,22 @@ def myPrintfunction(s):
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("Testing hardwareInterface...")
|
print("Testing hardwareInterface...")
|
||||||
hw = hardwareInterface(myPrintfunction)
|
hw = hardwareInterface(myPrintfunction)
|
||||||
for i in range(0, 300):
|
for i in range(0, 350):
|
||||||
hw.mainfunction()
|
hw.mainfunction()
|
||||||
if (i==100):
|
if (i==50):
|
||||||
hw.setStateC()
|
hw.setStateC()
|
||||||
|
if (i==100):
|
||||||
|
hw.setStateB()
|
||||||
|
if (i==150):
|
||||||
|
hw.setStateC()
|
||||||
|
hw.setPowerRelayOn()
|
||||||
if (i==200):
|
if (i==200):
|
||||||
hw.setStateB()
|
hw.setStateB()
|
||||||
|
hw.setPowerRelayOff()
|
||||||
if (i==250):
|
if (i==250):
|
||||||
hw.setStateC()
|
hw.setRelay2On()
|
||||||
if (i==280):
|
if (i==300):
|
||||||
hw.setStateB()
|
hw.setRelay2Off()
|
||||||
sleep(0.03)
|
sleep(0.03)
|
||||||
hw.close()
|
hw.close()
|
||||||
print("finished.")
|
print("finished.")
|
Loading…
Reference in a new issue