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

equations = :[ ] ... observation #124

Open
johhell opened this issue Oct 14, 2021 · 0 comments
Open

equations = :[ ] ... observation #124

johhell opened this issue Oct 14, 2021 · 0 comments

Comments

@johhell
Copy link
Contributor

johhell commented Oct 14, 2021

I tried to run my MODELICA model for synchronous machine with a quadratic saturation in Modia

my 1st attempt ==> unstable

SynchronousMachine  = SynchrPart | Model(
    Omegarated=Var(_outer=true),
    rfd	= 0.00037,
    xfd	= 0.2181,
    xf1d = 0.0011,
    S10 = 0.18858668,
    S12 = 0.43618116,
    KIS =  0.15,
    a = parameter | Map(value=:(sqrt(S10/(S12*1.2)))),
    A = parameter | Map(value=:(1.2 + 0.2/(a - 1.0))),
    B = parameter | Map(value=:(S12*1.2* (a - 1.0)^2/(1.0 - 1.2)^2)),

    Plus = Pin,
    Minus = Pin,
    equations = :[
        ifd = Plus.i
        Plus.i + Minus.i = 0.0
        uF = Plus.v - Minus.v
        imRe = iRe + i1Re + ifd
        imIm = iIm + i1Im
        PsimRe = xadSat * imRe
        PsimIm = xaqSat * imIm
        Psifd = Psif1d + ifd * xfd + xadSat * imRe
#                                    ^^^^^^^^^^^^^ this is identical with PsimRe (def. above)
        Psif1d = xf1d * (i1Re + ifd) 
        uF*rfd/xad = rfd*ifd + (der(Psifd))/Omegarated
        PsimAbs = sqrt(PsimRe*PsimRe+PsimIm*PsimIm)
        psiM1 = max(0.1, PsimAbs + KIS*current)
        saturation = if (psiM1 > A); B*((psiM1-A)^2.0)/psiM1; else 0.0; end
        satD = 1.0 + saturation
        satQ = 1.0 + xq/xd * saturation
        xadSat = xad/satD
        xaqSat = xaq/satQ
    ]
)

after modification ==> OK

        imRe = iRe + i1Re + ifd
        imIm = iIm + i1Im
        PsimRe = xadSat * imRe
        PsimIm = xaqSat * imIm
        Psifd = Psif1d + ifd * xfd + PsimRe
#                                    ^^^^^^  replaced
        Psif1d = xf1d * (i1Re + ifd) 
        uF*rfd/xad = rfd*ifd + (der(Psifd))/Omegarated
        PsimAbs = sqrt(PsimRe*PsimRe+PsimIm*PsimIm)
        psiM1 = max(0.1, PsimAbs + KIS*current)
        saturation = if (psiM1 > A); B*((psiM1-A)^2.0)/psiM1; else 0.0; end

Basically the system of equations are the identical. But in implementation the expression PsimRe = xadSat * imRe is handled in a different way.

remark

in the MODELICA model I used Complex() values. In Modia it was necessary to spit explicit in Re and Im part.

versions

name = "ModiaLang" version = "0.9.0-dev"
name = "ModiaBase" version = "0.8.0-dev"

@johhell johhell changed the title equations = :[ ] ... oberservation equations = :[ ] ... observation Oct 14, 2021
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

No branches or pull requests

1 participant