﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4638	Power systems library; voltage source does not respect parameter frequency	pat@…	Martin Sjölund	"I tried to use 2 voltage sources of same amplitude but set at different frequencies (50 and 51 Hz) to beat power across a connecting impedance. AC3ph.Sources.Voltage However the voltages were identical across time (therefore no current).  Digging into the code the Voltage source did not use the calculated theta from the frequency (fType = parameter).

The line in Sources.mo for model Voltage is
 phi = term.theta[1] + alpha + system.alpha0;
 term.v = PS.map({V*cos(phi), V*sin(phi), sqrt(3)*neutral.v});

However term.theta[1] is always set to system.thetaRel (set in partial SourceBase).  Whilst theta for the Voltage instance is calculated correctly (in partial VoltageBase), it is never used.

My model worked when I changed the line to:
   phi = (theta - system.thetaRef) + alpha + system.alpha0;

that is calculating the actual angle of the source instance relative to the reference frame.

Fixing it here does not seem right though - term.theta should be changed??  However, line elements connect theta through (term_p.theta = term_n.theta) so you would end up with an over-defined system or one that cannot be solved.

As it stands, term.theta seems a bit useless as it can only be = {system.thetaRel, system.thetaRef}.  It would seem to me more informative if each active element's term.theta referred to its actual relative angle to the reference frame and passive elements did not pass it through - although this might be too much of a re-write.  In any regard, the Voltage source has a fixable bug so it respects the frequency parameter.

I am happy to discuss off-line with the package maintainer."	defect	closed	normal		Third-Party Libraries	v1.13.0-dev-nightly	invalid	PowerSystems AC3ph	
