mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
improved formatting
This commit is contained in:
parent
98c569597b
commit
aecff0444e
1 changed files with 12 additions and 5 deletions
17
readme.md
17
readme.md
|
@ -9,8 +9,8 @@ There are three different use cases, where this project can be helpful:
|
||||||
3. Building a charging unit for a car which does not support powerline communication.
|
3. Building a charging unit for a car which does not support powerline communication.
|
||||||
|
|
||||||
## References
|
## References
|
||||||
[i] https://www.goingelectric.de/wiki/CCS-Technische-Details/
|
* [i] https://www.goingelectric.de/wiki/CCS-Technische-Details/
|
||||||
[ii] https://openinverter.org/forum/viewtopic.php?p=37085#p37085
|
* [ii] https://openinverter.org/forum/viewtopic.php?p=37085#p37085
|
||||||
|
|
||||||
## Quick start / overview
|
## Quick start / overview
|
||||||
- Modify a PLC adaptor hardware, that it runs on battery
|
- Modify a PLC adaptor hardware, that it runs on battery
|
||||||
|
@ -37,22 +37,27 @@ It is worth to read its documentation, starting in docbook/index.html, this cont
|
||||||
(Tested on Linux/Raspbian on a raspberryPi 3)
|
(Tested on Linux/Raspbian on a raspberryPi 3)
|
||||||
|
|
||||||
Find the PLC adaptor
|
Find the PLC adaptor
|
||||||
|
```
|
||||||
pi@RPi3D:~ $ int6klist -ieth0 -v
|
pi@RPi3D:~ $ int6klist -ieth0 -v
|
||||||
|
```
|
||||||
This shows the software version and the mac address.
|
This shows the software version and the mac address.
|
||||||
|
|
||||||
Read the configuration from the PLC adaptor and write it to a file
|
Read the configuration from the PLC adaptor and write it to a file
|
||||||
|
```
|
||||||
pi@RPi3D:~ $ plctool -ieth0 -p original.pib 98:48:27:5A:3C:E6
|
pi@RPi3D:~ $ plctool -ieth0 -p original.pib 98:48:27:5A:3C:E6
|
||||||
eth0 98:48:27:5A:3C:E6 Read Module from Memory
|
eth0 98:48:27:5A:3C:E6 Read Module from Memory
|
||||||
|
```
|
||||||
Patch the configuration file (aee /docbook/ch05s15.html). For each side (pev (vehicle) and evse (charger)) there is a special configuration.
|
Patch the configuration file (aee /docbook/ch05s15.html). For each side (pev (vehicle) and evse (charger)) there is a special configuration.
|
||||||
Example pev side:
|
Example pev side:
|
||||||
|
```
|
||||||
pi@RPi3D:~ $ cp original.pib pev.pib
|
pi@RPi3D:~ $ cp original.pib pev.pib
|
||||||
pi@RPi3D:~ $ setpib pev.pib 74 hfid "PEV"
|
pi@RPi3D:~ $ setpib pev.pib 74 hfid "PEV"
|
||||||
pi@RPi3D:~ $ setpib pev.pib F4 byte 1
|
pi@RPi3D:~ $ setpib pev.pib F4 byte 1
|
||||||
pi@RPi3D:~ $ setpib pev.pib 1653 byte 1
|
pi@RPi3D:~ $ setpib pev.pib 1653 byte 1
|
||||||
pi@RPi3D:~ $ setpib pev.pib 1C98 long 10240 long 102400
|
pi@RPi3D:~ $ setpib pev.pib 1C98 long 10240 long 102400
|
||||||
|
```
|
||||||
Write the configuration file to the PLC adaptor
|
Write the configuration file to the PLC adaptor
|
||||||
|
```
|
||||||
pi@RPi3D:~ $ plctool -ieth0 -P pev.pib 98:48:27:5A:3C:E6
|
pi@RPi3D:~ $ plctool -ieth0 -P pev.pib 98:48:27:5A:3C:E6
|
||||||
eth0 98:48:27:5A:3C:E6 Start Module Write Session
|
eth0 98:48:27:5A:3C:E6 Start Module Write Session
|
||||||
eth0 98:48:27:5A:3C:E6 Flash pev.pib
|
eth0 98:48:27:5A:3C:E6 Flash pev.pib
|
||||||
|
@ -60,7 +65,7 @@ Write the configuration file to the PLC adaptor
|
||||||
eth0 98:48:27:5A:3C:E6 Close Session
|
eth0 98:48:27:5A:3C:E6 Close Session
|
||||||
eth0 98:48:27:5A:3C:E6 Reset Device
|
eth0 98:48:27:5A:3C:E6 Reset Device
|
||||||
eth0 98:48:27:5A:3C:E6 Resetting ...
|
eth0 98:48:27:5A:3C:E6 Resetting ...
|
||||||
|
```
|
||||||
The open-plc-utils contain the programs evse and pev, which can be used for try-out of the functionality, using two PLC adaptors.
|
The open-plc-utils contain the programs evse and pev, which can be used for try-out of the functionality, using two PLC adaptors.
|
||||||
|
|
||||||
## Installation / Preconditions on PC side
|
## Installation / Preconditions on PC side
|
||||||
|
@ -83,11 +88,13 @@ Then again install pcap-ct, and finally add in the libpcap\_platform\__init__py
|
||||||
Finally, we need to patch the Pcap-ct, because the python script needs a non-blocking version. This is discussed in https://github.com/karpierz/pcap-ct/issues/9
|
Finally, we need to patch the Pcap-ct, because the python script needs a non-blocking version. This is discussed in https://github.com/karpierz/pcap-ct/issues/9
|
||||||
|
|
||||||
Now, in the IDLE shall 3.10.6, the import works:
|
Now, in the IDLE shall 3.10.6, the import works:
|
||||||
|
```
|
||||||
import pcap
|
import pcap
|
||||||
sniffer = pcap.pcap(name=None, promisc=True, immediate=True, timeout_ms=50)
|
sniffer = pcap.pcap(name=None, promisc=True, immediate=True, timeout_ms=50)
|
||||||
addr = lambda pkt, offset: '.'.join(str(pkt[i]) for i in range(offset, offset + 4))
|
addr = lambda pkt, offset: '.'.join(str(pkt[i]) for i in range(offset, offset + 4))
|
||||||
for ts, pkt in sniffer:
|
for ts, pkt in sniffer:
|
||||||
print('%d\tSRC %-16s\tDST %-16s' % (ts, addr(pkt, sniffer.dloff + 12), addr(pkt, sniffer.dloff + 16)))
|
print('%d\tSRC %-16s\tDST %-16s' % (ts, addr(pkt, sniffer.dloff + 12), addr(pkt, sniffer.dloff + 16)))
|
||||||
|
```
|
||||||
|
|
||||||
### Usage on Raspberry
|
### Usage on Raspberry
|
||||||
Pcap-ct does not work with Python 3.4. After update to Python 3.8, it works.
|
Pcap-ct does not work with Python 3.4. After update to Python 3.8, it works.
|
||||||
|
|
Loading…
Reference in a new issue