Closed gijswl closed 5 months ago
Hi @gijswl
pip install elmer-circuitbuilder --upgrade
Let me know if this resolves the issue.
/Jon
Hi Jon, thanks for the quick patch. Body force is now generated as it should be. However, I see that the real and imaginary parts are still set to their absolute value.
! I2 = re_I2+ j im_I2, phase_I2 = 119.99999999999999(Deg)
$ re_I2 = 499.9999999999998
$ im_I2 = 866.0254037844387
! I3 = re_I3+ j im_I3, phase_I3 = -119.99999999999999(Deg)
$ re_I3 = 499.9999999999998
$ im_I3 = 866.0254037844387
The parameters re_I2
, re_I3
, and im_I3
should be negative. The issue is probably in lines 1977-1978 where the absolute value of the real and imaginary part is taken.
@gijswl ,
Please, upgrade your circuit builder version once again. Do you mind testing your actual simulation? I did remove the signs, however' I do remember that I did something hacky, with the signs, because on the finite element side one of them - the voltage or the current, have a different sign convention. Now that I pushed it, I'm not completely sure if this will have a negative effect on the FEM side.
BR,
/Jon
Thanks Jon. I ran the simulation again, and it seems to work perfectly fine now.
The phases of the three currents look good relative to each other. Absolute phase of the currents also seems OK, but I am unsure of the effects this could have if specifying, e.g., a voltage and a current source at the same time.
Perhaps this sign convention is something that should be handled while writing the Body Force to the circuit.definitions
, rather than in the real/imag part calculation?
Kind regards, Gijs
@gijswl ,
I have no control on how the Body force is handled on the FEM side. I just know it takes the real and imagination part as is. That's why I created the circuit builder. My guess, is that by eliminating the unnecessary sin/cos the sign convention was fixed by taking the values as hey are.
As of this, I'll consider this ticket resolved. Don't hesitate to reopen it if other issues appear.
/Jon
@gijswl,
After digging further, I remembered that the Voltage values are the ones that are reversed, and I handled it by adding the variable val_sign when I'm writing the Body Force (which Is the method I think you were trying to explain). So indeed, I don't handle the signs at the actual source value, but the parameter that goes into the Body Force. I just did a test with a three-phase voltage source and it seems to work just fine.
Upgrade your circuit builder once again - and thank you for your patience. /Jon
When using complex-valued current or voltage sources, the assigned body force will not have the correct magnitude and phase. It took quite some doubting myself and the simulation results before I traced this mistake to the
circuit.definition
.Recreating the issue
I define three-phase currents
I1
,I2
,I3
, with identical magnitude and phase (0, +120, -120 deg).In the resulting circuit definition, the general parameters look OK (although the absolute value of the real and imaginary part is given, which is an odd choice in my opinion).
The issue occurs in the body force definition, where
sin(phase)
andcos(phase)
are again applied to the real and imaginary parts, instead of to the magnitude.Solutions
The code responsible for this is
write_sif_additions
for the body force, andwrite_parameters
for the parameters. Possible solutions:Until then, the easiest is to manually modify the generated
circuit.definitions
.