ALR32XX Python Library- Documentation EN
  • elc Annecy
  • Changelog
  • FAQ
  • ALR32XX sur Python
    • Installing the library
    • ALR3203
    • ALR3220
    • ALR3206D
    • ALR3206T
  • Exemples
    • Changing voltages and parameters
    • Generation of a sine and graphic display
    • F(t) generation and SQL recording
Powered by GitBook
On this page
  1. Exemples

Changing voltages and parameters

1st example: https://github.com/elc-construction-electronique/Librairie-Python-ALR32XX/blob/main/Exemples/Exemple_1.py

PreviousALR3206TNextGeneration of a sine and graphic display

Last updated 3 years ago

The aim of this is to modify the control voltages on the 3 channels of the ALR3206T, to verify by measuring the voltages and to modify and read some parameters (OVP, OCP, IDN, ETAT).

Adding the library and initializing

The ALR32XX library is not in the "example_1.py" script folder, so the sys library changes the location where Python will search for ALR32XX (by default, the library is searched in the same location as the script)

import sys    
sys.path.insert(0, "..")   
from ALR32XX import*

The path now targets the N-1 folder in the Python script and will be able to find the library.

The sys library does not require any additional installation.

To complete the initialization of the procedure, we need to declare a variable for our power supply:

X=ALR32XX('ALR3206T')

Here, the variable X will be linked to the ALR3206T connected via USB or RS232 to the computer. X therefore inherits functions from the library, for example X.Meesure_tension() to measure the voltage on one of the power supply channels.

OVP & OCP modifications

The OVP (over voltage protection) and OCP (over current protection) are the maximum values set by the user to protect a load in case of misuse for example.

Our first action on the power supply will be to modify the OVP values:

  • 32V for CH1

  • 22V for CH2

  • 12V for CH3

X.OVP(32, 1)
X.OVP(22, 2)
X.OVP(12, 3)

Changing the control and measurement voltages

The rest of the script in this example is used to modify the voltages on each of the channels. Three voltages will be written:

  • 30V for CH1

  • 10.5V for CH2

  • 3.4V for CH3

Note that the required voltages remain below the OVP value

The corresponding code :

X.Ecrire_tension(30, 1)
X.Ecrire_tension(10.5, 2)
X.Ecrire_tension(3.4, 3)

Once the voltages are available at the output, a check is made by displaying the measurement:

val1=X.Mesure_tension(1)
print("U1="+str(val1))

val2=X.Mesure_tension(2)
print("U2="+str(val2))

Note that the voltage measurement on channel 3 is not available.

Reading the identity of the power supply and connecting the "parallel" mode

The last step in this example is to display the identity of the power supply on the screen, i.e. its name and version. Once read, the power supply will switch to "parallel" mode (coupling the CH1 & CH2 outputs in parallel) and check that the coupling is correct.

val3=X.IDN()
print(val3)

X.ALR('PARALLELE')
val4=X.Read_state_ALR ('MODE')
if '2' in val4 :
    print("mode parallèle")
else:
    print("autre mode")
X.ALR('NORMAL')

Result

At the end of this example you will get a return similar to this one:

example