Opened 4 years ago

Last modified 4 years ago

#6238 closed enhancement

Extend overconstrained connector semantics to handle dynamic branches — at Initial Version

Reported by: Francesco Casella Owned by: Karim Adbdelhak
Priority: high Milestone: 1.17.0
Component: Backend Version: 1.16.0
Keywords: Cc: Andreas Heuermann, Philip Hannebohm, Per Östlund, Adrian Pop, Dietmar Winkler, massimo ceraolo, Andrea Bartolini, adrien.guironnet@…, Rüdiger Franke, dr.christian.kral@…, anton.haumer@…

Description

The overconstrained connector semantics defined in Section 9.4 of Modelica 3.4 considers a fixed connection graph, that can be handled statically at compile time.

One of the cited examples for overconstrained types in connectors is the phase information in AC power systems. The current semantics is able to represent synchronous systems whose topology remains unchanged during simulation. The phase reference is generated by one component of the synchronous system (normally a power generator) and distributed throughout the entire synchronous system via the overconstrained connector variable. In fact, it is possible to have multiple synchronous systems in the same Modelica model, e.g. two national grids connected by a DC link, but in any case their topology is fixed at runtime.

When modelling AC trasmission systems, is is possible that in case of severe perturbations, some key circuit breakers are switched open (i.e., their conductance brough to zero), effectively splitting a single synchronous system into multiple synchronous islands. Note that this requires no structural changes in the grid equations, only to bring some admittance values to zero.

When this happens, the two (or more) ensuing islands can settle into new steady states with different frequencies. Hence, if a single, whole-system-wide reference is still used, the phase angle of currents and voltages of the now disconnected islands will continue to rotate permanently with a frequency that is the difference between the local island frequency and the frequency of the island where the original root node was picked. This is very inconvenient, because it prevents variable step-size solvers to increase the step size once the system settles to the new steady state.

This problem could be avoided if the Connections.branch() operators could be made time-dependent. It would then be possible to disable the Connections.branch() statements of the circuit breakers being opened. As a consequence, two or more disjoint connection graphs would be formed at the time of the breaker openings, each corresponding to a new synchronous island. The new graph topology should be analyzed at this point, picking a new root node for each newly formed island in the grid. Then, instead of having a single phase reference for the entire system, which would no longer be adequate, one would now have two or more independent phase references, one for each island, which would ensure that the variables of each island reach a steady state, thus avoiding the persistent sinusoidal oscillations found in the case of a statically determined connection topology.

From the point of view of the language specification, this extension only requires to lift (or suitably relax) the restriction mentioned in the definition of the Connection.branch() operator in Section 9.4.1:

This function can be used at all places where a connect(..) statement is allowed.

From an implementation point of view, this means that the graph connection analysis no longer can be performed statically at compile time, but needs to be deferred to run time.

In general this can be quite a big deal, because Modelica cannot handle structural dynamics at runtime. However, the special case of scalar overconstrained connector variables with zero-dimensional equalityConstraint() function output turns out to be very easy to handle, and is enough to address the issue with the synchronous AC grids. This is demonstrated by the attached examplary case.

The attached package contains components to build conceptual models of phasor-based AC power grid models. The components are overly simplified and only retain the minimal features that are needed to analyze this language semantics extension.

In this case, the overconstrained variable is actually not the phase angle but rather the angular velocity of the phasor reference frame, which is sufficient to ensure that all state variables are constant when the synchronous islands are all operating in steady state.

System 1 is a basic example with two generators G1 and G2, each connected to a local load, connected by an inductive transmission line T. The system starts in steady state with balanced loads, then at time = 1 the active power consumption of load L2 is reduced by 20%. This starts a transient, that eventually dies out once the primary frequency controls stabilize the system at a new, higher frequency. Note that at that point, all state variables are constant, allowing implicit solvers to take large time steps.

System 2 is similar to System1, except that line T is split in the series connection of lines T1a and T1b, running in parallel, with line T2. This allows to demonstrate the overconstrained connector mechanism, since T1a and T1b form a loop that must be broken to avoid getting an overconstrained system of equations. The overall impedance is the same, so the power and frequency transients are the same as in System1.

In System 3, line T2 also includes a circuit breaker mechanism, that brings its susceptance B to zero when the T2.open signal becomes true. From that point onwards, there is no longer any exchange of power along the lines, so the system is effectively split into two synchronous islands, one containing G1 and L1, the other one containing G2 and L2. The frequencies of the two drift apart, causing the phasors and state variables of G2 and L2, that still use G1.port.omegaRef as a reference angular velocity, to oscillate forever even when the new steady state is reached.

In order to avoid this, the connection graph needs to be split when the breaker embedded in T2 is opened. This could be achieved in System4 by using the modified TransmissionLineVariableBranch component, that contains the following equation

  if closed then
    port_a.omegaRef = port_b.omegaRef;
    Connections.branch(port_a.omegaRef, port_b.omegaRef);
  end if;

Note that:

  • the Connection.branch() operator is called in a branch of an if-equation, so it is only active when closed = true.
  • the if-equation violates the balancing rule of Section 8.3.4, apparently breaking the single-assignment rule. However, it only involves overconstrained connector variables that appear in the Connection.branch() call in the same branch of the if-equation

Handling this case at runtime is relatively straighforward. During initialization, and each time an if-equation is triggered that contains a Connection.branch(A.R, B.R) call and an equation A.R = B.R, the runtime must:

  • build the connection graph according to the rules set forth in Section 9.4
  • identify disjoint sub-graphs and select one root node for each of them, if not already given by Connection.root()
  • set each overconstrained connector variable of each sub-graph to be equal to the value of the corresponding root node variable (this can be done trivially via pointers)
  • in case a branch is re-established, it may be sensible to add a numerical check that the corresponding equation involving the overconstrained connector variables is actually verified within some tolerance, otherwise aborting the simulation; this would correspond to the requirement that two islands can only be reconnected if the are operating exactly at the same frequency. This check could be defined by adding one more function to the overconstrained type definition, which returns a boolean indicating if the reconnection is feasible

I suppose this feature could be implemented rather easily in OpenModelica, as a first prototype implementation of this language extension. It could be tested in an extended version of the attached package, including some more examples with a bit more nodes and edges in the connection graphs, and finally tested on an extended version of the PowerGrids library, that already envisioned such a feature.

If the experiments with the prototype are successful, this could form the basis of an MCP to introduce this feature into the next version of the Modelica Specification.

Change History (1)

by Francesco Casella, 4 years ago

Note: See TracTickets for help on using tickets.