RESTART

<< Click to Display Table of Contents >>

Navigation:  Gekko User Manual > Gekko statements >

RESTART

Previous pageReturn to chapter overviewNext page

The RESTART statement is used to restart the workspace, similar to closing and reopening the Gekko application, and running any gekko.ini files present in the program folder (where gekko.exe is located) or working folder.  

 

Among other things, RESTART closes all opened databanks, clears the Work, Ref, Local and Global databanks, and in addition options, models, libraries etc. are cleared. The gekko.ini files may reload options, models, databanks, libraries, etc. (use RESET to avoid such reloading). Beware that when restarting, the frequency is always set to annual, and the timeperiod is set from t-10 to t, where t is the current year. If you need frequency or time settings to persist after a restart, you may put these into a gekko.ini file.

 

If you need persistent variables (settings) that survive CLEAR, READ, etc., you may put these in the Global databank. Beware the RESTART and RESET also clear the Global and Local databanks (you may use CLOSEALL to avoid that).

.

NOTE: RESTART is equivalent to RESET; INI;, and can be convenient in interactive sessions, where a RESTART statement may reload a given model/bank, etc. Note however, that RESTART will not fail, if a gekko.ini file is not found. This can have unintended consequences if the gekko.ini file is inadvertently deleted, so as a safer alternative to RESTART in program files, the user may put RESET; RUN gekko.ini; as the first line in the user's main Gekko program file. In that case, Gekko will abort with an error, if the gekko.ini file is not found.

 


 

Syntax

 

restart;

 

 


 

Examples

 

Use this syntax to restart the workspace:

 

restart;

 

Clears the workspace (i.e. all Gekko RAM objects, including user functions and procedures), and runs gekko.ini from the program and/or working folder if these files exist.

 

You might put the following statements into gekko.ini (this file would typically be located in your working folder):

 

//gekko.ini file for sim-mode
//---------------------------------
cls;
mode sim;
option folder model \models;
option folder bank \databanks;
option solve method = newton;
option freq = q;  //a (annual) is default
time 2012q1 2020q4;
model mymodel;
read mydatabank;
//---------------------------------

 

So in the gekko.ini file, put an (optional) a CLS statement first, set the mode, and then OPTION statements including time settings. Finally MODEL and READ statements (best in that order).

 

If you need to start up in data-mode, you could use the following file, also typically put inside the working folder:

 

//gekko.ini file for data-mode
//---------------------------------
cls;
mode data;
global:%path = 'm:\common\databanks';
option folder bank {global:%path};
option freq = q;  //a (annual) is default
time 1990q1 2015q4;
RUN lib.gcm;  //library of procedures/functions
//---------------------------------

 

 

//lib.gcm
//---------------------------------
procedure openbank name %bank;
  open {global:%path}\{%bank};
end;
//---------------------------------

 

In this example, a string %path is put into the Global databank, so that it can be accessed during the entire session. With option folder bank pointing to some central databank repository, existing databanks can be easily opened with OPEN, without indicating the full file path.

 

You may, alongside gekko.ini in the working folder, also put a lib.gcm program file with user-defined functions and procedures. If you RUN that file from the gekko.ini file, you will always have your user-defined functions/procedures at hand after a RESTART. In this example, after a RESTART, you may use the procedure openbank bk2;, which will open up m:\common\databanks\bk2.gbk.

 

As mentioned, you may put a gekko.ini file in the program folder (where gekko.exe is located, cf. Help --> About... in the Gekko main window). This file is always run before any other statements (including any gekko.ini in the working folder), so a gekko.ini in the program folder could contain general settings that change seldomly, like mode, frequency, time period, paths, etc..

 

 


 

Note

 

The RESET statement clears up in the same way as RESTART, but will skip any existing gekko.ini file.

 

The INI statement can be used to run the gekko.ini file separately (RESTART is the same as RESET followed by INI).

 

Note: With option interface remote = yes, Gekko may be remote-controlled from a special remote.gcm program file in the working folder (cf. OPTION).

 

 


 

Related statements

 

RESET, INI, DELETE, CLOSE, CLOSEALL, CLEAR, CLS, CUT