Difference between revisions of "VDC HV control"
(→HV Relay Box) |
|||
(37 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | == Overview == | ||
Relay Box with 8 relays (channels) controlled by RPi board is used to limit trip current and prevent trips for VDC high voltage line during HV on/off operation. | Relay Box with 8 relays (channels) controlled by RPi board is used to limit trip current and prevent trips for VDC high voltage line during HV on/off operation. | ||
Line 12: | Line 13: | ||
passwd: same as for rpi7 | passwd: same as for rpi7 | ||
− | Relay box consists of 8 relays and 8 resistors with 68Mohm nominal. Resistor is connected in series between output of hv channel and VDC hv line, or shortened by relay. | + | Relay box consists of 8 relays and 8 resistors with 68Mohm nominal. Resistor is connected in series between output of hv channel and VDC hv line, or shortened by relay ([[Media:VDC-relay.pdf|diagram view]]). |
RPi board is used as TCP/IP server to control relays by commands from clients. RPi board in HV crate (rpi8(left), rpi7(right)) runs 'shim-server' to control modules in crate. | RPi board is used as TCP/IP server to control relays by commands from clients. RPi board in HV crate (rpi8(left), rpi7(right)) runs 'shim-server' to control modules in crate. | ||
Line 18: | Line 19: | ||
Shim-server will send commands to relay box server to switch relay ON (closed, shortened resistor) or OFF (open, resistor in). | Shim-server will send commands to relay box server to switch relay ON (closed, shortened resistor) or OFF (open, resistor in). | ||
− | Shim-server checks commands/responses from GUI to hv channel that connected to VDC. The next logic | + | Shim-server checks commands/responses from GUI to hv channel that connected to VDC. The next logic is used by shim-server to control relays : |
− | * commands: HVON, HVOFF, demand voltage (DV) set, enable/disable channel ( | + | * commands: HVON, HVOFF, demand voltage (DV) set, enable/disable channel (CE), channels status (ST>1) ---> relay is OFF (open, resistor in) for this channel. |
− | * | + | * channel status ST==1 --> relay is ON (closed, resistor out) for this channel. |
+ | * <span style="color:#ff0000"> initial state of relays (after power ON of relay server) is all relays OFF (open, resistor in).</span> | ||
Command format for relay box server is the same as used by LeCroy HV system (examples): | Command format for relay box server is the same as used by LeCroy HV system (examples): | ||
− | |||
* set relay channel #1 to ON (closed) | * set relay channel #1 to ON (closed) | ||
LD S0.1 RLY 1 | LD S0.1 RLY 1 | ||
Line 30: | Line 31: | ||
* get status of all relays channel (1 - is ON, 0 - is OFF) | * get status of all relays channel (1 - is ON, 0 - is OFF) | ||
RC S0 RLY | RC S0 RLY | ||
+ | replay: 1 RC S0 RLY 1 0 1 0 0 0 0 0 | ||
+ | |||
+ | HV module for VDC will have one more property column 'RLY_En' in Java GUI, that shows status of relay box channels (0 - relay is OFF, 1 - relay is ON). | ||
+ | |||
+ | == Configuration file for relay server == | ||
+ | |||
+ | Configuration file is needed to activate relay controls from 'shim-server' on rpi7 or rpi8. | ||
+ | |||
+ | Shim-server reads parameters from this file when it started. | ||
+ | |||
+ | Rename or remove configuration file to disable relay control from 'shim-server'. | ||
+ | |||
+ | Configuration file '''/home/pi/relay.config''' with relay server parameters on rpi7: | ||
+ | # Parameters of relay server. | ||
+ | # Host name of relay server: host=<IP/name_of_relay_server> | ||
+ | # Connection Port of relay server: port=1090 | ||
+ | # Slot with HV module connected to VDC: slot=S<number> | ||
+ | # HV module channel map to relay channels: chmap=<HV_channel>.<relay_channel> | ||
+ | host=rpiright | ||
+ | port=1090 | ||
+ | slot=S12 | ||
+ | chmap=0.0 1.2 2.1 3.3 4.4 5.5 6.6 7.7 | ||
+ | |||
+ | Connections: | ||
+ | cable label hv module channel relay box chanel | ||
+ | vdc top 0 0 (In 1 on box) | ||
+ | vdc bottom 2 1 (In 2 on box) | ||
+ | |||
+ | Configuration file '''/home/pi/relay.config''' with relay server parameters on rpi8: | ||
+ | |||
+ | # Parameters of relay server. | ||
+ | # Host name of relay server: host=<IP/name_of_relay_server> | ||
+ | # Connection Port of relay server: port=1090 | ||
+ | # Slot with HV module connected to VDC: slot=S<number> | ||
+ | # HV module channel map to relay channels: chmap=<HV_channel>.<relay_channel> | ||
+ | host=rpileft | ||
+ | port=1090 | ||
+ | slot=S7 | ||
+ | chmap=0.0 1.3 2.2 3.1 4.4 5.5 6.6 7.7 | ||
+ | |||
+ | Connections: | ||
+ | cable label hv module channel relay box chanel | ||
+ | vdc top 0 0 (In 1 on box) | ||
+ | vdc bottom 3 1 (In 2 on box) | ||
+ | |||
+ | == Software update on rpi7 and rpi8 == | ||
+ | * shim-server for VDC relays control: '''/home/pi/tcp_test/LecroyHV_Shim_tcp_VDC''' | ||
+ | * script to start hv servers: '''/home/pi/scripts/start_hv''' | ||
+ | |||
+ | #!/bin/bash | ||
+ | # Starts HV servers on Rasapberry Pi | ||
+ | # | ||
+ | # start HV1458 server (port=24742) | ||
+ | sudo ~/tcp_test/20140803_i2lchv_rPI-linux & | ||
+ | # wait while HV1458 initialized | ||
+ | sleep 2 | ||
+ | # start Perl shim server (port=2001) | ||
+ | ##~/tcp_test/LecroyHV_Shim_tcp2 | ||
+ | ~/tcp_test/LecroyHV_Shim_tcp_VDC | ||
+ | |||
+ | Copy of these files are stored on adaq1 computer under directory: | ||
+ | ~adev/slowc/rpi_hv/rpi7 | ||
+ | |||
+ | == Relay server software on 'rpileft' and 'rpiright' == | ||
+ | Source file for relay server is '''/home/pi/vdc_hv_server/hvserver.c''' | ||
+ | |||
+ | To compile: | ||
+ | gcc -o hvserver hvserver.c -lwiringPi -lpthread -lrt | ||
+ | |||
+ | Relay server starts from script /home/pi/scripts/start_server by cron. | ||
+ | |||
+ | #!/bin/bash | ||
+ | # Starts VDC server on Rasapberry Pi | ||
+ | # | ||
+ | # start VDC server (port=1090) | ||
+ | sudo ~/vdc_hv_server/hvserver -p 1090 | ||
+ | |||
+ | 'hvserver' accepts as parameter port number (-p 1090). | ||
+ | |||
+ | To control GPIO on rPI board library '''wiringPi''' is used. | ||
+ | RPI3 board has wiringPi library preloaded. Otherwise it has to be installed. | ||
+ | |||
+ | Copy of these files are stored in directory: | ||
+ | ~adev/slowc/rpi_hv/relay_server/ | ||
+ | |||
+ | == HV Relay Box == | ||
+ | * Schematic diagram of relay box (drivers type of NCV8403 between D-25 control connector and relays not shown): [[Media:Hv Relay box.pdf|HV Relay Box.pdf]] | ||
+ | |||
+ | * Inside picture: [[Image:8Chan HV-Relay Chassis.JPG|60px]] | ||
+ | |||
+ | 25-Dsub connector is an input with the following pinout: | ||
+ | -------------------------------------------------------- | ||
+ | \ 1 2 3 4 5 6 7 8 9 10 11 12 13 / | ||
+ | \ 14 15 16 17 18 19 20 21 22 23 24 25 / | ||
+ | ---------------------------------------------------- | ||
+ | (1) Relay 1 - +3.3vdc logic from rPi | ||
+ | (2) Relay 2 - "" | ||
+ | (3) Relay 3 - "" | ||
+ | (4) Relay 4 - "" | ||
+ | (5) Relay 5 - "" | ||
+ | (6) Relay 6 - "" | ||
+ | (7) Relay 7 - "" | ||
+ | (8) Relay 8 - "" | ||
+ | (9) Not used | ||
+ | (10) Not used | ||
+ | (11) Not used | ||
+ | (12) Not used | ||
+ | (13) Not used | ||
+ | (14 -21) rPi common[GND] | ||
+ | (22) Not used | ||
+ | (23) Not used | ||
+ | (24) Not used | ||
+ | (25) Not used | ||
+ | |||
+ | RPi board GPIO 26-pin connector to relay box (logic 1 - relay is ON, logic 0 - relay is OFF): | ||
+ | |||
+ | RPi | ||
+ | Pins# Wire Name | ||
+ | 6 Ground (0V) | ||
+ | 7 relay ch#1 | ||
+ | 11 relay ch#2 | ||
+ | 12 relay ch#3 | ||
+ | 13 relay ch#4 | ||
+ | 15 relay ch#5 | ||
+ | 16 relay ch#6 | ||
+ | 18 relay ch#7 | ||
+ | 22 relay ch#8 | ||
− | + | [[Media:Rpi_relay_pin.pdf|Rpi Relay Pins.pdf]] |
Latest revision as of 18:03, 7 March 2019
Contents
Overview
Relay Box with 8 relays (channels) controlled by RPi board is used to limit trip current and prevent trips for VDC high voltage line during HV on/off operation.
Two of them have been installed in Left and Right HRS at the end of March, 2017.
- Left HRS:
name: rpileft IP: 129.57.164.27 passwd: same as for rpi8
- Right HRS:
name: rpiright IP: 129.57.164.53 passwd: same as for rpi7
Relay box consists of 8 relays and 8 resistors with 68Mohm nominal. Resistor is connected in series between output of hv channel and VDC hv line, or shortened by relay (diagram view).
RPi board is used as TCP/IP server to control relays by commands from clients. RPi board in HV crate (rpi8(left), rpi7(right)) runs 'shim-server' to control modules in crate.
Shim-server will send commands to relay box server to switch relay ON (closed, shortened resistor) or OFF (open, resistor in).
Shim-server checks commands/responses from GUI to hv channel that connected to VDC. The next logic is used by shim-server to control relays :
- commands: HVON, HVOFF, demand voltage (DV) set, enable/disable channel (CE), channels status (ST>1) ---> relay is OFF (open, resistor in) for this channel.
- channel status ST==1 --> relay is ON (closed, resistor out) for this channel.
- initial state of relays (after power ON of relay server) is all relays OFF (open, resistor in).
Command format for relay box server is the same as used by LeCroy HV system (examples):
- set relay channel #1 to ON (closed)
LD S0.1 RLY 1
- set relay channels #0,#2 to ON (closed) and channels #1,#3-#7 to OFF (open)
LD S0 RLY 1 0 1 0 0 0 0 0
- get status of all relays channel (1 - is ON, 0 - is OFF)
RC S0 RLY replay: 1 RC S0 RLY 1 0 1 0 0 0 0 0
HV module for VDC will have one more property column 'RLY_En' in Java GUI, that shows status of relay box channels (0 - relay is OFF, 1 - relay is ON).
Configuration file for relay server
Configuration file is needed to activate relay controls from 'shim-server' on rpi7 or rpi8.
Shim-server reads parameters from this file when it started.
Rename or remove configuration file to disable relay control from 'shim-server'.
Configuration file /home/pi/relay.config with relay server parameters on rpi7:
# Parameters of relay server. # Host name of relay server: host=<IP/name_of_relay_server> # Connection Port of relay server: port=1090 # Slot with HV module connected to VDC: slot=S<number> # HV module channel map to relay channels: chmap=<HV_channel>.<relay_channel> host=rpiright port=1090 slot=S12 chmap=0.0 1.2 2.1 3.3 4.4 5.5 6.6 7.7
Connections: cable label hv module channel relay box chanel vdc top 0 0 (In 1 on box) vdc bottom 2 1 (In 2 on box)
Configuration file /home/pi/relay.config with relay server parameters on rpi8:
# Parameters of relay server. # Host name of relay server: host=<IP/name_of_relay_server> # Connection Port of relay server: port=1090 # Slot with HV module connected to VDC: slot=S<number> # HV module channel map to relay channels: chmap=<HV_channel>.<relay_channel> host=rpileft port=1090 slot=S7 chmap=0.0 1.3 2.2 3.1 4.4 5.5 6.6 7.7
Connections: cable label hv module channel relay box chanel vdc top 0 0 (In 1 on box) vdc bottom 3 1 (In 2 on box)
Software update on rpi7 and rpi8
- shim-server for VDC relays control: /home/pi/tcp_test/LecroyHV_Shim_tcp_VDC
- script to start hv servers: /home/pi/scripts/start_hv
#!/bin/bash # Starts HV servers on Rasapberry Pi # # start HV1458 server (port=24742) sudo ~/tcp_test/20140803_i2lchv_rPI-linux & # wait while HV1458 initialized sleep 2 # start Perl shim server (port=2001) ##~/tcp_test/LecroyHV_Shim_tcp2 ~/tcp_test/LecroyHV_Shim_tcp_VDC
Copy of these files are stored on adaq1 computer under directory:
~adev/slowc/rpi_hv/rpi7
Relay server software on 'rpileft' and 'rpiright'
Source file for relay server is /home/pi/vdc_hv_server/hvserver.c
To compile:
gcc -o hvserver hvserver.c -lwiringPi -lpthread -lrt
Relay server starts from script /home/pi/scripts/start_server by cron.
#!/bin/bash # Starts VDC server on Rasapberry Pi # # start VDC server (port=1090) sudo ~/vdc_hv_server/hvserver -p 1090
'hvserver' accepts as parameter port number (-p 1090).
To control GPIO on rPI board library wiringPi is used. RPI3 board has wiringPi library preloaded. Otherwise it has to be installed.
Copy of these files are stored in directory:
~adev/slowc/rpi_hv/relay_server/
HV Relay Box
- Schematic diagram of relay box (drivers type of NCV8403 between D-25 control connector and relays not shown): HV Relay Box.pdf
25-Dsub connector is an input with the following pinout:
-------------------------------------------------------- \ 1 2 3 4 5 6 7 8 9 10 11 12 13 / \ 14 15 16 17 18 19 20 21 22 23 24 25 / ---------------------------------------------------- (1) Relay 1 - +3.3vdc logic from rPi (2) Relay 2 - "" (3) Relay 3 - "" (4) Relay 4 - "" (5) Relay 5 - "" (6) Relay 6 - "" (7) Relay 7 - "" (8) Relay 8 - "" (9) Not used (10) Not used (11) Not used (12) Not used (13) Not used (14 -21) rPi common[GND] (22) Not used (23) Not used (24) Not used (25) Not used
RPi board GPIO 26-pin connector to relay box (logic 1 - relay is ON, logic 0 - relay is OFF):
RPi Pins# Wire Name 6 Ground (0V) 7 relay ch#1 11 relay ch#2 12 relay ch#3 13 relay ch#4 15 relay ch#5 16 relay ch#6 18 relay ch#7 22 relay ch#8