gama-platform / gama.old

Main repository for developing the 1.x versions of GAMA
GNU General Public License v3.0
304 stars 99 forks source link

Error in reloading experiments containing a permanent display #3261

Closed Aya-Badawy89 closed 2 years ago

Aya-Badawy89 commented 2 years ago

Describe the bug Changing the parameter value and reloading the experiment throws an error. Also, the charts view disappears when you switch between tabs after reloading the experiment.

To Reproduce 1) Please, copy the attached code on GAMA. 2) Open the simulation view and change the parameter (para) to any value 3) Reload the experiment 4) Run the simulation 5) Notice the error

Attached code:

model dummyModel

global {
    init {
        create person;
    }
    int para <- 2;
    bool end <- false;
}
species person {
    reflex behave {
        write 'time= ' + time color:#red;
        para <- para + 3;
        if (para > 14) {end <- true;}
    }   
}
experiment multi type: gui  {
    parameter 'para' var:para;
    list values;

    reflex when:  (end = true) {
        ask simulation {myself.values << para;}     
    }
    permanent {
        display first_display {
            chart 'Chart1' type:histogram 
            x_label: 'x'
            y_label: 'y'  {
                datalist legend:['para'] value:[para];          
            }   
        }
        display second_display {
            chart 'Chart2' type:histogram 
            x_label: 'x'
            y_label: 'y' {
                datalist legend:['para'] value:[para];          
            }   
        }
    }
}

Expected behavior The simulation should run without errors. I tried it on GAMA 1.8.1, and it worked fine.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

hqnghi88 commented 2 years ago

Hi, I think it is a problem of permanent display, just try with other model in library where it has permanent block, then the experiment will throw error when reloaded (no need to change param or reflex...)

Aya-Badawy89 commented 2 years ago

Where to test the fix? It does not work on the latest release 29/11

hqnghi88 commented 2 years ago

Did you find it, the 1.8.2 alpha here https://github.com/gama-platform/gama/releases/tag/1.8.2 It seems ok for me.

Aya-Badawy89 commented 2 years ago

I tested the fix and it works now. Thank you very much. I will close this issue.