Menu

Possible QSS1 bug

-
2016-02-15
2016-02-15
  • -

    - - 2016-02-15

    Hello!

    I was hoping to contact you regarding a possible bug in the QSS1 simulator engine.
    For the following Lotka-Volterra model:

    x(0) = 10
    y(0) = 5
    der(x) =  x * 1.5 - x * y
    der(y) = -y * 3   + x * y
    

    with quantum Q = 1, the output from PowerDEVS is
    this
    while I believe the correct output should be

    Time1       x1      Time2       x2
    0           10      0           5
    0.057142857 8       0.057142857 7
    0.102597403 6       0.122077922 9
    0.152236652 4       0.434247234 7
    0.218903319 2       0.529485329 5
    0.352236652 0       0.662818663 3
    #                   0.885040885 1
    #                   1.551707552 -1
    

    this

    I was wondering if you might be able to look into this and confirm whether this is correct?

    The PDM file for the model is below.

    Thank you!

    Coupled
        {
        Type = Root
        Name = LotkaVolterra
        Ports = 0; 0
        Description = 
        Graphic
            {
            Position = 0; 0
            Dimension = 600; 600
            Direction = Right
            Color = 15
            Icon = 
            Window = 5000; 5000; 5000; 5000
            }
        Parameters
            {
            }
        System
            {
            Atomic
                {
                Name = x1
                Ports = 1 ; 1
                Path = qss/qss_integrator.h
                Description = Quantized Integrator (QSS methods) with logartithmic quantization
                Graphic
                    {
                    Position = -2130 ; -2280
                    Dimension = 675 ; 675
                    Direction = Right
                    Color = 15
                    Icon = %continuous%integrator.svg
                    }
                Parameters
                    {
                    Method = Lst; 1%QSS%QSS2%QSS3%QSS4%BQSS%CQSS%LIQSS%LIQSS2%LIQSS3% ; 
                    dqmin = Str; 2 ; minimum quantum (Scilab)
                    dqrel = Str; 0 ; relative quantum (0 : uniform) (Scilab)
                    x0 = Str; 10 ; Initial state (Scilab)
                    }
                }
            Atomic
                {
                Name = x2
                Ports = 1 ; 1
                Path = qss/qss_integrator.h
                Description = Quantized Integrator (QSS methods) with logartithmic quantization
                Graphic
                    {
                    Position = -2130 ; 795
                    Dimension = 675 ; 675
                    Direction = Right
                    Color = 15
                    Icon = %continuous%integrator.svg
                    }
                Parameters
                    {
                    Method = Lst; 3%QSS%QSS2%QSS3%QSS4%BQSS%CQSS%LIQSS%LIQSS2%LIQSS3% ; 
                    dqmin = Str; 2 ; minimum quantum (Scilab)
                    dqrel = Str; 0 ; relative quantum (0 : uniform) (Scilab)
                    x0 = Str; 5 ; Initial state (Scilab)
                    }
                }
            Atomic
                {
                Name = GnuPlot0
                Ports = 2 ; 0
                Path = sinks/gnuplot.h
                Description = Plot input signal using GnuPlot
                Graphic
                    {
                    Position = 2220 ; -735
                    Dimension = 675 ; 720
                    Direction = Right
                    Color = 15
                    Icon = %sinks%gnuplot.svg
                    }
                Parameters
                    {
                    Inputs = Str; %Inputs ; Number of inputs
                    Format = Str; set xrange [0:%tf] @ set grid @ set title 'Plot' ; General Formatting (use @ as line break)
                    Format1 = Str; with lines title 'First output' ; Formatting options for input 1
                    Format2 = Str; with lines title 'Second output' ; Formatting options for input 2
                    Format3 = Str;  ; Formatting options for input 3
                    Format4 = Str;  ; Formatting options for input 4
                    Format5 = Str;  ; Formatting options for input 5
                    }
                }
            Atomic
                {
                Name = Multiplier0
                Ports = 2 ; 1
                Path = qss/qss_multiplier.h
                Description = Multiplier. (QSS1 to 4)
                Graphic
                    {
                    Position = -255 ; -630
                    Dimension = 675 ; 675
                    Direction = Right
                    Color = 15
                    Icon = %continuous%multiplier.svg
                    }
                Parameters
                    {
                    Advance method = Lst; 1%Purely static%Estimate step% ; 
                    dQmin = Str; 1e-6 ; 
                    dQrel = Str; 0 ; 
                    }
                }
            Atomic
                {
                Name = WSum0
                Ports = 2 ; 1
                Path = qss/qss_wsum.h
                Description = y = K[0] * u0 + K[1] * u1 + ... + K[7] * u7 (QSS1 to 4)
                Graphic
                    {
                    Position = 645 ; -3660
                    Dimension = 675 ; 720
                    Direction = Up
                    Color = 15
                    Icon = %continuous%sum.svg
                    }
                Parameters
                    {
                    K[0] = Str; 1.5 ; 
                    K[1] = Str; -1 ; 
                    K[2] = Str; 0 ; 
                    K[3] = Str; 0 ; 
                    K[4] = Str; 0 ; 
                    K[5] = Str; 0 ; 
                    K[6] = Str; 0 ; 
                    K[7] = Str; 0 ; 
                    Inputs = Str; %Inputs ; 
                    }
                }
            Atomic
                {
                Name = WSum1
                Ports = 2 ; 1
                Path = qss/qss_wsum.h
                Description = y = K[0] * u0 + K[1] * u1 + ... + K[7] * u7 (QSS1 to 4)
                Graphic
                    {
                    Position = 645 ; 2040
                    Dimension = 675 ; 720
                    Direction = Down
                    Color = 15
                    Icon = %continuous%sum.svg
                    }
                Parameters
                    {
                    K[0] = Str; -3 ; 
                    K[1] = Str; 1 ; 
                    K[2] = Str; 0 ; 
                    K[3] = Str; 0 ; 
                    K[4] = Str; 0 ; 
                    K[5] = Str; 0 ; 
                    K[6] = Str; 0 ; 
                    K[7] = Str; 0 ; 
                    Inputs = Str; %Inputs ; 
                    }
                }
            Point
                {
                ConectedLines = 2 ; 5 ; 6
                ConectedExtrems = Org ; Org ; Org
                Position = -675 ; -1950
                }
            Point
                {
                ConectedLines = 3 ; 9 ; 12
                ConectedExtrems = Org ; Org ; Org
                Position = -675 ; 1125
                }
            Line
                {
                Source = Cmp ;  1 ;  1 ; 0
                Sink = Cmp ;  3 ;  1 ; -1
                PointX = -1350 ; 2085 ; 2085
                PointY = -1950 ; -1950 ; -525
                }
            Line
                {
                Source = Cmp ;  4 ;  1 ; -1
                Sink = Pnt ;  1 ; -1 ; 0
                PointX = -390 ; -675 ; -675
                PointY = -450 ; -450 ; -1950
                }
            Line
                {
                Source = Cmp ;  2 ;  1 ; 0
                Sink = Pnt ;  2 ; -1 ; 0
                PointX = -1350 ; -1350 ; -675
                PointY = 1125 ; 1125 ; 1125
                }
            Line
                {
                Source = Cmp ;  4 ;  2 ; -1
                Sink = Cmp ;  2 ;  1 ; 0
                PointX = -390 ; -675 ; -675 ; -1350
                PointY = -150 ; -150 ; 1125 ; 1125
                }
            Line
                {
                Source = Cmp ;  5 ;  1 ; -1
                Sink = Pnt ;  1 ; -1 ; 0
                PointX = 825 ; 825 ; -675 ; -675
                PointY = -2835 ; -2400 ; -2400 ; -1950
                }
            Line
                {
                Source = Pnt ;  1 ; -1 ; 0
                Sink = Cmp ;  1 ;  1 ; 0
                PointX = -675 ; -675 ; -1350
                PointY = -1950 ; -1950 ; -1950
                }
            Line
                {
                Source = Cmp ;  5 ;  1 ; 0
                Sink = Cmp ;  1 ;  1 ; -1
                PointX = 975 ; -2265 ; -2265
                PointY = -3750 ; -3750 ; -1950
                }
            Line
                {
                Source = Cmp ;  4 ;  1 ; 0
                Sink = Cmp ;  5 ;  2 ; -1
                PointX = 525 ; 1125 ; 1125
                PointY = -300 ; -300 ; -2835
                }
            Line
                {
                Source = Pnt ;  2 ; -1 ; 0
                Sink = Cmp ;  3 ;  2 ; -1
                PointX = -675 ; 2085 ; 2085
                PointY = 1125 ; 1125 ; -225
                }
            Line
                {
                Source = Cmp ;  6 ;  1 ; 0
                Sink = Cmp ;  2 ;  1 ; -1
                PointX = 975 ; -2265 ; -2265
                PointY = 2850 ; 2850 ; 1125
                }
            Line
                {
                Source = Cmp ;  6 ;  2 ; -1
                Sink = Cmp ;  4 ;  1 ; 0
                PointX = 1125 ; 1125 ; 525
                PointY = 1935 ; -300 ; -300
                }
            Line
                {
                Source = Cmp ;  6 ;  1 ; -1
                Sink = Pnt ;  2 ; -1 ; 0
                PointX = 825 ; 825 ; -675 ; -675
                PointY = 1935 ; 1575 ; 1575 ; 1125
                }
            }
        }
    
     

    Last edit: - 2016-02-15
  • Federico Bergero

    Hi Mehrdad, you are using QSS3 in the second integrator. Try using QSS1 on both integrator.

    Best
    Fede

     
  • -

    - - 2016-02-15

    Oh my god, I thought I checked that they were both QSS1. Thanks you for catching it and apologies for the false alarm!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.