Custom waveform tab

This page describes the custom waveform functionality of the hvps-x.

The waveform tab is used to define a custom output waveform.
The waveform tab is used to define a custom output waveform.

The waveform settings are accessed by choosing the waveform tab at the top of the interface, or by using the keyboard shortcut ‘w’ (and press ‘m’ to return to the main tab). The waveform tab is split into 4 areas:

  • Waveform parameters to define the custom waveform
  • A graph that shows the waveform currently active in the HVPS in red and the live waveform based on the values entered in the waveform parameters zone in blue.
  • PID coefficients that define the coefficients of the PID regulator used to control the output waveform.
  • Load properties that provide tools to calculate PID coefficients appropriate for the device under test.

1. Waveform parameters

Waveform parameters
Waveform parameters
  1. Waveform type: The drop-down menu lets you chose between 5 different waveform options:
    • Sinewave
    • Triangular wave
    • Trapezoid wave
    • Square wave: The difference between the waveform square wave option and the the switching mode on the main tab is that the waveform lets you choose a voltage different than 0 for the lowest point.
    • Waveform file: Custom user waveform from a file. This option loads the file waveform.csv. You can include your own waveform in the waveform.csv file. You must enter 1 point per line in the first column. The absolute value of the points doesn’t matter, what counts is their relative value. For example, you can use values between 0 and 1 to define points between 0% and 100% of the maximum voltage. There is an example custom waveform in the waveform.csv file distributed with the interface (root folder, or _internal folder with the compiled executable). The user can overwrite data in this file with their own data. The waveform is periodic and will repeat once finished, so if you want to avoid discontinuity, the last point should be equal (or close) to the first point. You can have as many point as you want in your waveform, but it will be resampled to at most 500 points. The example file provided has 500 points.
  2. Voltage High: This defines the peak voltage of the waveform. If the the hvps-x is in waveform mode when the waveform is uploaded, the voltage entered in this box will be directly applied to the waveform being generated, and this voltage value will be copied to the set point voltage on the main interface tab. If the hvps-x is in another switching mode (High, Low, Switching, Off) the waveform is uploaded to the hvps-x with this value, but when it is time to apply it (when the switching mode is changed to waveform) the waveform will be scaled so that its peak value matches the current set point voltage. This makes it possible to define a waveform shape (e.g. a sine wave, a triangular wave, etc.), and then generate this waveform with different amplitude from the main program tab, without the need to reupload a new waveform with a different amplitude.
  3. Voltage Low: The lowest voltage point of the waveform. For example, with the parameters shown in the figure above, the output voltage would be V_{out}=2500 +1500\sin(\omega\, t), i.e. a sinewave between 1000V and 4000V. This entry is not active when the Waveform type (1) is set to Waveform file. In this case, the highest point of the waveform defined in the file is scale to match the value entered in (2), which defines the scaling factor applied to all the points, including the lowest one. The calculated lowest point will be shown in this box, but it not editable.
  4. Duty Cycle: This number between 1% and 99% lets you define the duty cycle of the waveform, i.e. the fraction of the period that the signal spends in its high state. This option is not available if the waveform type is Sinewave or Waveform file.
  5. Transition: This only applies for the trapezoid waveform and defines the fraction of the period that the transition Low –> High and High –> Low takes. This lets the user define the slope of the trapezoid waveform.
  6. Upload: This button sends the “live” waveform currently defined by the parameters 1-5 and displayed in blue on the live graph to the hvps-x.
  7. Download: This button download the waveform stored in the hvps-x and displays it in red on the graph. However, this button is normally not needed:
    • When the interface is launched the waveform is fetched from the hvps-x and displayed on the graph.
    • After the user presses the Upload (6) button, the UI automatically queries the waveform back from the hvps-x and displays it on the graph as a confirmation that the new waveform has been correctly understood.

1.1 Initial state

When the user first visits this tab after launching the UI, the waveform stored in the hvps-x will be displayed on the graph in red. If this is the first time the user makes use of the waveform function, the graph will not show anything, because the default waveform stored in the hvps-x is a single point at 0V.

If the UI is closed and then re-opened without power-cycling the hvps-x, the last used waveform, which is still in memory, will be shown. If the hvps-x is power-cycled, the waveform will be read from the current settings, and will be 0 unless the user has saved the waveform in the non-volatile memory (see section below).

The hvps-x only stores an array of points and is not aware of the waveform type. When the UI starts, it reads the waveform from the hvps-x, gets its highest and lowest points and displays the relevant values in boxes (2) and (3). However the Waveform type (1), the duty cycle (4) and the transition (5) will show their default values (respectively sine wave, 50, and 5) irrespective of the waveform saved on the hvps-x.

1.2 Saving a waveform in memory

When you press button (10) on the main tab to save the active settings (see Graphic User Interface manual), the active waveform (latest waveform uploaded to the hvps-x) is part of the settings being saved to non-volatile memory. This way the user can save a waveform they regularly use and apply it to the output from the main tab by choosing the waveform switching mode, without having to re-upload the waveform each time the hvps-x is powered cycled.

1.3 Frequency

All waveforms defined through the waveform parameters are periodic. Yet, there is no mention of frequency in this section of the GUI, and the graph shows a relative period on the x axis. This is because the waveform will be produced at the frequency defined on the main tab. This means that once you have defined a waveform general shape through the waveform tab, you can easily generate the same waveform at different amplitudes and frequencies directly from the main tab by using the voltage set point and frequency settings.

The range of frequencies in waveform mode is between 0.016 Hz (0.02 Hz in the GUI due to rounding to two decimal places) and 100 Hz. The page Frequency capabilities describes in more details how the load connected to the hvps-x affects the effective maximal frequency of the waveform: 100 Hz is a technical upper limit, but in practice, the upper limit is usually dominated by how fast the power supply can charge the load. This depends both on the size of the capacitive load connected to the power supply and on the output current.

2 Waveform graph

The waveform graph displays the waveform currently active in the hvps-x in red and the live waveform corresponding to the parameters entered in the waveform parameter box in blue.

The waveform currently active in the hvps-x is shown in red, and the live waveform reflecting the settings of the waveform parameters block is in blue.
The waveform currently active in the hvps-x is shown in red, and the live waveform reflecting the settings of the waveform parameters block is in blue.

When the waveform parameters on the left are changed, the blue waveform is sent to the hvps-x. The waveform data is then read back from the unit and the red curve is updated. If the process was successful, the red curve should overlay the blue waveform at this stage.

After upload, the hvps-x waveform will match the live waveform
After upload, the hvps-x waveform will match the live waveform

3 PID coefficients

3.1 What are these PID coefficients?

The output waveform is controlled by a PID (proportional-integral-derivative) controller. It defines how much current the power supply delivers to the load as a function of the error between the voltage set point and the effective voltage. In other words, it does its best to make sure that the voltage output follows the desired waveform. It requires 3 parameters, kp, ki, and kd, which are coefficients for the proportional, integral, and derivative elements of the controller. To be fair, although implemented, we have never used kd, because it comes with its own noise and instability issues, so the discussion that follows will only apply to kp and ki, with kd being always 0.

The main issue is that there is not a single combination of coefficients that fit all usage cases. The coefficients mainly depend on 3 parameters

  1. The input current of the power supply (for example whether the current selection jumper is on position 3V3 (normal mode) or 5V (high current mode))
  2. The capacitance of the actuator connected to the power supply. Users may have widely different actuators size they want to test. One extreme is running the power supply without any load connected, and another would be a capacitive load of 10 nF. Although the kp and ki parameters’ effect is coupled, generally, a higher capacitive load requires a higher kp parameter.
  3. The leakage (or shunt) resistor. Even if we assume that the electrostatic actuator connected to the power supply is a perfect capacitor without leakage, the voltage monitoring circuit has a resistor of 500 MΩ, so this will be the highest possible leakage resistance value. If you use a high voltage probe to monitor the output (typical input impedance: 100MΩ), this reduces the leakage resistance to 83 MΩ. The lower the shunt resistor, the higher the parameter ki should be.

If you work with loads that have reasonably similar capacitance value, you can optimise the coefficient once and then save them in memory. The waveform PID coefficients are part of the settings which are saved in the non-volatile memory when the user presses the save button on the main panel of the user interface.

We provide a few tools to assist with finding good values of kp and ki for your load. These tools are described in section 4 below.

Here is an illustration of the importance of having correct PID coefficient to generate an accurate waveform. To test the appropriateness of a set of coefficient, we recommend using the square waveform: this is the hardest to generate with its infinite slope at the transition. This works well to highlight possible over/undershoots, or if the transition is too slow.  The low voltage value of the square waveform should be chosen >0 so that undershoots can be identified if present.

The image below illustrates the importance of the PID coefficient with a 5 Hz square signal between 1000V and 3000V. In the top left image, no load is connected to the hvps-x, except the high voltage probe. The coefficients kp and ki were chosen to produce a nice square signal with fast transition, but without overshoots.  In the top right image, the pid coefficients are not changed, but a 680 pF capacitor is connected to the output to act as a load. Ooops, our square waveform is a roller coaster now, with overshoot and undershoots. In the bottom image the pid coefficients have been changed to a set of values that are adequate for a 680 pF load.

Top left: No load on the output and PID coefficients optimised for this case. Top right: PID coefficients unchanged, but 680pF capacitor connected. Bottom: PID coefficients optimised for the 680pF load.
Top left: No load on the output and PID coefficients optimised for this case. Top right: PID coefficients unchanged, but 680pF capacitor connected. Bottom: PID coefficients optimised for the 680pF load.

The image below shows the importance of the gain to have a sharp and rapid signal. The desired waveform is a square wave between 800V and 3200V. The left image shows good pid coefficient values. The slope of the effective waveform is due to the current drive capability of the hvps-x, which limits the slew rate (dV/dt). The right image uses a kp parameter 5 times lower. We still have a rectangular waveform, but with much slower transitions. It is much less sharp than the better solution on the left.

Left: Good PID coefficients for a 680pF capacitor. Right: kp coefficient decreased by a factor of 5: much slower rise time!

ImportantWhen fine-tuning PID coefficients for a load using a high-voltage probe and an oscilloscope, one need to be mindful that the ki parameter is influenced by the leakage resistor of the probe: if the probe is removed after having established the coefficients, you risk having overshoot.

ImportantThe PID coefficients do not depend on the waveform. Once good coefficients are found for for a load using a square waveform, faithful reproduction will be obtained on other types of waveforms.

3.2 How to set the PID coefficients?

  • Enter the values of kp and ki (and possibly kd if desired) in the entry box
  • Press the Upload button to transfer these values to the hvps-x.

The values of kp and ki uploaded to the hvps-x are valid until overwritten by new values or until the hvps-x is power-cycled. The waveform PID coefficients are part of the settings transferred to non-volatile memory when the Save button is pressed on the UI main tab. This makes it possible to define a set of PID coefficients that are applied every time the power supply is powered-up.

4  Load properties

This block provides tools to calculate the kp and ki (kd always kept at 0) that are required in the PID coefficient section based on the load connected to the hvps-x.

ImportantThe PID coefficients depend on the current output of the hvps-x. If you are using a PCB (Hardware version) >= 1.4, it is important that the position of the current selection jumper on the PCB is currently reflected in the UI. This can be done in the Options dialog box from the main UI tab (keyboard shortcut ‘o’). Ideally, the current output of the power supply has also been calibrated, also the default values should work well.

4.1 Known load parameters

If you know the capacitance / resistance of the load connected to the power supply, you can enter these values in the entry boxes (1) and (2). The capacitance should be entered in nF, and the resistance in MΩ. 500 MΩ is the higher possible resistance value, as this is the resistance of the voltage monitoring resistor inside the hvps-x. Any other leakage resistor would appear in parallel with that one and decrease the value of the leakage resistance. If you are working with electrostatic actuators, you should be able to neglect the leakage resistance and leave the value at 500 MΩ; simply enter the capacitance of your actuator (in nF) in entry box (1). If you are using a HV probe  with a 100 MΩ input impedance to monitor the voltage output, then the resistance value in entry field (2) would be 83 MΩ.

A machine-learning algorithm integrated to the UI calculates appropriate values of kp and ki
A machine-learning algorithm integrated to the UI calculates appropriate values of kp and ki

Once the user has entered the load parameters into the C and R field, they can press the Calc PID & upload button (3). Pressing the button has two sequential effects, as illustrated in the image above:

  1. Calculate: A machine learning algorithm has been trained and integrated to the UI. This algorithm takes the capacitance, resistance, and output current as parameters to calculate the values of kp and ki. The UI then populates the entry boxes kp and ki in the PID coefficients section.
  2. Upload: The parameters kp and ki are then transferred to the hvps-x. It is therefore not necessary to press on the upload button of the PID coefficients section.

The machine learning algorithm was trained with parameter values within these ranges:

  • Capacitance: from 10pF to 2.5 nF
  • Output current: from 100 μA to 250 μA
  • Resistance: two values: 500 MΩ and 83 MΩ

Input outside of the range used to train the model may not result in correct values for kp and ki.

The default capacitance and resistance value shown in entry fields (1) and (2) can be changed by editing the confing.ini file in the root folder of the interface (or in the _internal folder for the compiled version of the UI). Restart the interface to take changes made to config.ini into account.

;Default resistor value for calculation of waveform PID coefficients in MOhm
wfm_R = 500
;Default capacitor value for calculation of waveform PID coefficients in nF
wfm_C = 1.0

4.2 Unknown load parameters

If the load’s capacitance and resistance parameters are not known, the GUI integrates a self sensing option, which is accessed by pressing the Meas R & C button (4). This functions applies a low voltage (~200V) to the hvps-x output. For this functionality to work, the high-voltage enable switch (S1) must be in position 1, and the switching mode must not be Off. A dialog box will pop up if this is the case.

A) Self-sensing measures the load parameters and fills the capacitance and resistance fields. B) if auto_apply_meas_rc is set to 1 in config.ini, it also automatically calculates the PID coefficients and send them to the hvps-x.
A) Self-sensing measures the load parameters and fills the capacitance and resistance fields. B) if auto_apply_meas_rc is set to 1 in config.ini, it also automatically calculates the PID coefficients and send them to the hvps-x.

What happens when the user presses on the Meas R & C button (4) depends on the parameter auto_apply_meas_rc in the file config.ini:

  • auto_apply_meas_rc = 0:  Pressing the Meas R & C button (4) measures the capacitance and resistance parameters of the load and populate the Capacitance (1) and Resistance (2) fields with the measured value. The user can review the measured value, and then press on the Calc PID & upload button (3) to calculate the PID coefficients and send them to the hvps-x. This is therefore a 2-steps process. The first step, measuring the capacitance and resistance is shown in part A) of the above figure. The second step is described in section 4.1 above.
  •  auto_apply_meas_rc = 1:  Pressing the Meas R & C button (4) measures the capacitance and resistance parameters of the load and populate the Capacitance (1) and Resistance (2) fields with the measured value and then uses this values to calculate the PID coefficients and send them to the hvps-x. This is a single step process describe in part B) of the above figure.

4.3 Saved parameters

The drop-down list (5) makes it possible to quickly recall pre-defined load parameters. The values of the drop-down list are defined in the config.ini file in the UI root folder. you need to restart the interface after editing the file.

list = no load, probe

Find this line in the config.ini file. This is a comma-separated list that defines the entries present in the drop-down list. There are two entries by default: no load is for the power supply without anything connected to it, and probe is for the power supply with no device connected, but with a 100 MΩ high-voltage probe. You can add your own entries for devices that you regularly connect to the power supply. Keep the name short so it can be displayed in the drop-down list. For example:

list = no load, probe, MyActuator

Each element of the list, needs to have its own section with the exact same name in the config.ini file. For our MyActuator example, we need to add a [MyActuator] section. The easiest is to copy an existing section and edit the parameters. There are two possible ways to define parameters as detailed below

4.3.1 Defining capacitance and resistance

You can define the resistance and capacitance of your load. If the example actuator we want to define under the heading MyActuator has a capacitance of 120pF and is assumed not to cause significant current leakage, we would define the [MyActuator] section this way:

[MyActuator]
c = 0.120
r = 500
kp = -1
ki = -1
kd = -1

c is the capacitance in nF and r is the resistance in MOhm (any value of the external load must be calculated as the parallel combination of the load leakage resistance and the 500 MΩ internal resistor. The pid coefficients, being set to -1 are ignored in this example and what matters are the values of C and R. What happens when the entry MyActuator is selected in the drop-down menu depends on the parameter auto_apply_meas_rc in the same way as described in section 4.2:

  • If auto_apply_meas_rc = 1, the values or C and R defined in config.ini are copied in the C (1) and R (2) fields of the load properties section and  the ML algorithm uses these values to calculate appropriate kp and ki coefficients, and these coefficients are sent to the hvps-x.
  • If auto_apply_meas_rc = 0, the values or C and R defined in config.ini are copied in the C (1) and R (2) fields of the load properties section. It is then necessary to press the Calc PID & Upload button (3) to calculate the PID coefficients and upload them to the hvps-x.
Selecting the new MyActuator entry loads the values of C and R in the Capacitance and Resistance fields. If the auto calculate flag is on, it will also directly calculate kp and ki, and upload the values to the hvps-x.
Selecting the new MyActuator entry loads the values of C and R in the Capacitance and Resistance fields. If the auto calculate flag is on, it will also directly calculate kp and ki, and upload the values to the hvps-x.

4.3.2 Defining PID values

The process described in section 4.3.1 leads to values of kp = 3.59 and ki = 0.019 (these values depend on the current of the hvps-x so will vary between power supplies). If a user experiments with the pid coefficients and find that a proportional gain of kp = 4.05 works better than what the model suggest, they can associate specific PID coefficient values to a saved load entry. The previous example can be modified as follows:

[MyActuator]
c = 0.120
r = 500
kp = 4.05
ki = 0.019
kd = 0

If the coefficients kp, ki, and kd are defined (none of them set to -1), then when the entry is selected in the saved load menu, the machine learning model is not used, instead, the PID coefficients are directly uploaded to the hvps-x.

Saved load entries that have pid coefficients defined are identified with an asterisk at the end of their name to be easily recognisable.
Saved load entries that have pid coefficients defined are identified with an asterisk at the end of their name to be easily recognisable.
Scroll to top