Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Add transmission-line model #190

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

Conversation

schillic
Copy link
Member

@schillic schillic commented Jan 15, 2020

This is based on the paper mentioned in the file and the CORA model and settings.

Problems:

  • discretization requires higher Taylor order than in the paper, but CORA implementation also prints Taylor order not high enough when using order 6 (but works with order 8 already)
ERROR: LoadError: AssertionError: c < 1
Stacktrace:
 [1] #_expm_remainder#6(::Int64, ::typeof(IntervalMatrices._expm_remainder),
     ::IntervalMatrix{Float64,IntervalArithmetic.Interval{Float64},
     Array{IntervalArithmetic.Interval{Float64},2}}, ::Float64, ::Int64) at
     .julia/dev/IntervalMatrices/src/exponential.jl:103
  • clarification needed

    • input factor is ±1 according to paper/CORA implementation; this essentially flips the sign in the plots
    • X0 is either computed from mid(B) (paper) or from B (CORA implementation)
    • X0 is either computed with -A⁻¹ (paper) or with +A⁻¹ (CORA implementation)
  • initial states are not contained in the flowpipe
    we found the reason: the implemented algorithm is only sound if the origin is contained in the inputs. so we need the sound version first

    • (likely a consequence:) projection of first set (discretized X0) to U_out (dimension η) already spans interval [-3, 3]*10^4 (paper: [-0.201, 0.201])
      the set X0 (called R(0) in the paper) is a zonotope centered in the origin with generator matrix
      [C 0; 0 D] where C = diag(0.201) and D = diag(1e-3) both in JuliaReach and in CORA
      so there seems to be a problem in the discretization

    • (likely a consequence:) computed zonotope centers contain NaNs and Infs (most probably just a consequence of the big numbers mentioned above)

  • dimensional errors in projection

further suggestions by @mforets

  • change inv(mid(x)) to mid(inv(x))
  • change interpretation of X0 (back) to a set interpretation (instead of an interval-matrix interpretation as in CORA)

@mforets
Copy link
Member

mforets commented Jan 16, 2020

what does this setting mean?

Seems to me that options.eAt is a cache to hold exp(mid(A) * δ).

computed zonotope centers contain NaNs and Infs

That's bad, that reminds me this issue but i thought it was solved. Do you have an indication where such values arise?

@schillic
Copy link
Member Author

Here is what we want to end up with (CORA results) in the η = 2 (4D) case (corresponding to Figure 9 and 10 of the paper):

Fig9
Fig10a
Fig10b

For better visibility, here is what happens for time horizon = 0.002 (one time step only):

Fig9_1
Fig10a_1
Fig10b_1

@schillic
Copy link
Member Author

schillic commented Jan 21, 2020

Here are results with BFFPSV18 and the center matrices:

transmission_line_t-U_n
transmission_line_U_1-I_1
transmission_line_U_n-I_n

First time step including the (continuous-time) initial states:

transmission_line_t-U_n
transmission_line_U_1-I_1
transmission_line_U_n-I_n

Observations:

  • The first plot does not converge to 1 but to -1. This is a consequence of whether we use +1 or -1 as input factor (I checked that) (see the OP).
  • Our discretization is much less precise.

@schillic
Copy link
Member Author

Because that precision looked horrible, here is BFFPSV18 with δ' = δ/100.0:
transmission_line_t-U_n
transmission_line_U_1-I_1
transmission_line_U_n-I_n

@schillic
Copy link
Member Author

Updated projections of X(0) with improved computation of the exponential remainder (JuliaReach/IntervalMatrices.jl#71):

transmission_line_t-U_n
transmission_line_U_1-I_1
transmission_line_U_n-I_n

This is definitely a major improvement but still an order of magnitude away from the true solution.

@schillic
Copy link
Member Author

With the latest fixes, and ignoring a current bug in the discretization for now, the results of ASB07 and ASB07_decomposed (with one-block partition) are equivalent in the first two steps.
However, after two steps they diverge, and surprisingly the decomposed version is not a superset of the other.

ASB07

transmission_line_X0_t-U_n_x

ASB07_decomposed

transmission_line_X0_t-U_n

@schillic
Copy link
Member Author

schillic commented Jan 24, 2020

Another bugfix later, we are getting closer...
(blue: ASB07_decomposed, red: ASB07, light green: BFFPSV18 for fixed parameters, yellow: X0)

transmission_line_X0_t-U_n

As can be seen, ASB07_decomposed and ASB07 are very similar until after a while ASB07_decomposed grows (rather quickly). And indeed if we continued the plot, the growth would get arbitrarily big.

Here is the same plot for a 10x smaller time step:

transmission_line_X0_t-U_n

@schillic
Copy link
Member Author

Some updates:

For η = 2 we can make the sets at least not diverge too much by computing the matrix exponential anew in each iteration:

transmission_line_t-U_n_2

However, η = 4 still diverges:

transmission_line_t-U_n_4

@schillic
Copy link
Member Author

schillic commented Feb 13, 2020

On the positive side, ASB07_decomposed is much more robust for bigger time steps than BFFPSV18:

δ = 0.0001 (observe that BFFPSV18 and ASB07 produce the same output):
transmission_line_t-U_n01

δ = 0.001:
transmission_line_t-U_n1

δ = 0.002:
transmission_line_t-U_n2

δ = 0.005 (observe the unsoundness between steps 3 and 4 that we still need to fix):
transmission_line_t-U_n5

δ = 0.01:
transmission_line_t-U_n10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants