upb-lea / openmodelica-microgrid-gym

OpenModelica Microgrid Gym (OMG): An OpenAI Gym Environment for Microgrids
GNU General Public License v3.0
184 stars 38 forks source link

Measurement #59

Closed Webbah closed 3 years ago

Webbah commented 4 years ago

Test setup: single inverter connected to RL (0.5 ohm, 2m2H). Parameter tuning using safeopt

Webbah commented 4 years ago

toDo: double check reward function J is not in the range it should be

J over kP:

grafik

initial: grafik

different kp: grafik

J should be much (!) smaller! MRE the correct one?

wallscheid commented 4 years ago

Ideas:

JarrenLange commented 4 years ago

Feedback from the hardware has been extended to include the direction reference values.

Working on obtaining required hardware for current sensor verification.

For Sampling modification, changes to the hardware to choose when to sample and/or to change the internal carrier (forward,reverse, symmetric) are underway.

JarrenLange commented 4 years ago

Using the setpoints from the FPGA hardware seems to solve most of the problems. Turns out calculated SPs (derived from the I_D setpoint and the phase angle) differed significantly.

Webbah commented 4 years ago

Second try 1D for ki (kp = 0.01 1/A) current controller layout.

Resulting GP for ki_init = 20 1/(As), lengthscale = 5 /(As):

grafik

Initial currents: grafik

"Best" Result for ki = 11.7 /(As): grafik

toDo:

wallscheid commented 4 years ago

great intermediate result! nice progress

quick question on the current waveforms: it seems that the three phase current is not idea, even in steady state (e.g. blue current is always too large for negative peak and green current is always too low for positive peak values). did you run an offset and gain compensation for all three current sensors before runing the experiment? Or do you have other ideas where the asymmetry / harmonics is coming from?

JarrenLange commented 4 years ago

It seems to stem from an unbalanced filter inductance, especially in a short circuit and with low V_dc values.

DQ0 control struggles with this. We do see the imbalanced currents in the verification probes. So I do not think it is an error with the measurement circuit.

Webbah commented 4 years ago

Intermediate result in 2D (x->kp, y->ki; interrupted by ss connection error)

grafik

initial: grafik

currently best one (green dot, first pic) grafik

wallscheid commented 4 years ago

Very nice result for 2D optimization. Here also the asymmetry is mostly gone -> interesting.

Webbah commented 4 years ago

Second try, higher lentghscale (reaches unsafe point (kP=0 in plot below), but with less results more exploration...)

grafik

Yes, also first thought maybe tuning... but unbalanced L the case, too....

Webbah commented 4 years ago

grafik Comparison for same tuning of the current controller, showing only current through phase a at the moment

Webbah commented 4 years ago

grafik

error(kP,kI) landscape from testbench Due to visibility, the z-values are limited to 390

Webbah commented 4 years ago

Plan: Controller layout in simulation (Pt1 -> RL & Pt1 -> Inverter), Magnitude Optimum -> Kp&Ki_init Estimate maximum lengthscale -> Use for measurement

wallscheid commented 4 years ago

Idea to make the simulation model becomer closer to reality: add white noise to the current (and voltage) 'measurements' within the Python interface to the OM-FMU container. mean = zero Variance = take a snapshot time period from the test bench with actively swichting transistors controling a zero current / zero voltage. the measured signals can be then assumed to be the pure noise component and used to estimate the variance of the noise process.

JarrenLange commented 4 years ago

Issue with sensor overcurrent is likely an underperforming op-amp.

Sensor uses a transimpedance amplifier to convert the current output (25mA nominal) from LEM LAH 25-NP (which has a 1:1000 conversion ratio). The op-amp (TL082) only has a 20mA maximum source/sink.

Options:

  1. Buy pin compatible op-amp with ~60mA source sink limit.
  2. Modify circuit to let the LEM device terminate over the resistor and use the op-amp for general gain/filtering.
  3. Use transistors in a push-pull combination on the output of the op-amp.

Investigating option 1 at the moment.

Webbah commented 4 years ago

Noise measurement for current measurements from testbench: max(standard deviation) of 0.11 A detected

At the moment len(obs)*std(noide_measurement) is taken. For voltage control that has to be adjusted

JarrenLange commented 4 years ago

Adjusted the current sensors using option 2 as mentioned above. Different gains for system (3.6A/V to 6A/V).

But we can now have currents over 30A without non-linear behaviour grafik

Webbah commented 4 years ago

Current controller layout using safeopt - Testbench

lensearch (y-axis: lengthscale for kp, x-axis: lengthscale for ki; green -> safe; blue circle -> chosen point for measurement; can do picture more beautiful later )

Result: agent_plt

Initial controller tune: (Title: Performance value)

grafik

grafik

Best result Kpi = [0.9626728565572376, 24.507337238803796] (green circle in the agent plot above) Performance increase by 11.58 % But more noise on it, run for longer? Weight the initial error less or the "later" error ('noise' around the setpoint) higher? So slower step response but less noise?

grafik

grafik

Webbah commented 4 years ago

First try with voltage controller running on open circuit using analytical current controller layout results.

agent_plt

Initial result (without analytical layout): (Performance in the title)

grafik ylabel = v_abc / V!!! Corrected for the next runs!

Best result after 100 epsiodes: grafik ylabel = v_abc / V!!! Corrected for the next runs!

wallscheid commented 4 years ago

Are the following stuff results from the test bench or simulation? Was not 100 % sure from your text input.

Answer: From Testbench

grafik

grafik

Best result Kpi = [0.9626728565572376, 24.507337238803796] (green circle in the agent plot above) Performance increase by 11.58 % But more noise on it, run for longer? Weight the initial error less or the "later" error ('noise' around the setpoint) higher? So slower step response but less noise?

grafik

grafik

Regarding the noise in steady-state: Did you use the mean root error (MRE) as the cost criterion (as in the preprint paper) or something different? Normaly the MRE is quite a suitable cost function to ensure nice behavior in steady-state since smaller control errors are not squeezed-together compared to the standard MSE. Nevertheless, with respect to the results the noise amount is increased, yes, but with the initial controller parameters there was also some significant harmonics on the current which are suppressed with the optimal tuning design.

Just double checked: For the reward, the same function was used as in the paper - so MRE + Barrier

wallscheid commented 4 years ago

Additional question regarding the current controller results: How close are not the behavior from the simulation and the experimental optimization? Is the performance landscape and the optimal found controller gains both similar in simulation and experiment?

Webbah commented 4 years ago

This is simulation grafik

grafik

Initial episode: J = 1 grafik grafik

Best episode: J = 1.25 grafik grafik

JarrenLange commented 4 years ago

Issue with sensor overcurrent is likely an underperforming op-amp.

Sensor uses a transimpedance amplifier to convert the current output (25mA nominal) from LEM LAH 25-NP (which has a 1:1000 conversion ratio). The op-amp (TL082) only has a 20mA maximum source/sink.

Options:

  1. Buy pin compatible op-amp with ~60mA source sink limit.
  2. Modify circuit to let the LEM device terminate over the resistor and use the op-amp for general gain/filtering.
  3. Use transistors in a push-pull combination on the output of the op-amp.

Investigating option 1 at the moment.

wallscheid commented 4 years ago

Additional question: how the the DC-voltage behaving during the start-up phase? Is it still a perfect constant voltage (as modeled within OMG) or do we see a significant dip during the start up?

JarrenLange commented 4 years ago

I have checked the DC-Link behaviour of the system during the open-circuit and short circuit tests. Here are the waveforms Orange is the VDC bus (AC Coupled), the bottom display is the currents or voltages. Under short circuit (first 100ms of DC bus noise is with no modulation, performing a current nulling test). LeCroy--00004

Under open circuit LeCroy--00002

wallscheid commented 4 years ago

I do not get the voltage measurement. I would expect to see the average DC-link voltage (at around 60 V?) and then some ripple and a possible dip (when starting the current control) on top. Assuming that above the orange signal is the DC-bus, why it is around 0 V?

JarrenLange commented 4 years ago

Orange is the VDC bus (AC Coupled), the bottom display is the currents or voltages.

Note, this measurement was taken using the custom voltage sensors. I will test it soon with an independant differential probe.

JarrenLange commented 4 years ago

LeCroy--00005

Repeated short circuit test, but with 2 sensors for the VDC (Given here in absolute units).

Webbah commented 3 years ago

results in paper, branch mereg to develop