anyKode Marilou
ContentsIndexHome
PreviousUpNext
Starting Exec (v4 and v5)

Starting the simulator Marilou-Exec.

You can start Marilou-Exec using several ways: 

 

Running Exec from within Marilou:

Load a Marilou project into the editor, then click on the Execute Simulation icon: 

 

 

 

This command is also available in the Project menu. The running simulation configuration is the one visible in the list beside the Execute Simulation button (this is the active configuration). If EXECV5 BETA is installed, it become possible to choose the simulator to be run. The default simulator is EXEC V4.X. 

 

From a shortcut:

Exec can be run using a shortcut (located on the desktop for example). Needed parameters are the same as the 'command line method'. Shortcut can be created automatically using the Create shortcut button from the configuration document. 

 

Command line mode:

Open a DOS console window, set the current directory as Marilou Bin directory as shown below (the exact location may depend on your installation): 

cd %MARILOU_INSTALL_DIR% 

 

 

 

From %MARILOU_INSTALL_DIR%\Bin directory:

  • Exec.exe /p:"c:\marilou\v2.0.0\samples\devices\servomotor\servomotor.mdsp"
  • Exec.exe /p:"%MARILOU_INSTALL_DIR%\samples\devices\servomotor\servomotor.mdsp"

 

From a C++ code:
#include "ModaCpp.h"
#include "conio.h"

int main(int argc, char* argv[])
{
ModaCPP::Connection *connection=new ModaCPP::Connection(true);

STARTUPINFO ProcessStartupInfo;
PROCESS_INFORMATION ProcessInformation;

memset(&ProcessStartupInfo,0,sizeof(ProcessStartupInfo));
memset(&ProcessInformation,0,sizeof(ProcessInformation));
ProcessStartupInfo.cb=sizeof(ProcessStartupInfo);

//creates the Exec process
if(CreateProcess(    L"%MARILOU_INSTALL_DIR%\\bin\\Exec.exe",
                    L" /p:%MARILOU_INSTALL_DIR%\\samples\\devices\\servomotor\\ServoMotor.mdsp",
                    NULL,
                    NULL,
                    TRUE,
                    NORMAL_PRIORITY_CLASS,
                    NULL,
                    L"c:\\Marilou\\v2.0.0\\bin",
                    &ProcessStartupInfo,
                    &ProcessInformation
            ))
    {
    //EXEC process is started, wait for complete engine startup during 5s (max).
    if(connection->WaitMODAServerIsRunningOnLocalhost(5000))
        {
        //Ok, all the engine is running, then connect MODA to moda server.
        if(connection->Connect("127.0.0.1"))
            {
            //you can do your program here, read sensors etc.
            //...

            connection->Disconnect();
            }

        }

    //Kill Exec
    TerminateProcess(ProcessInformation.hProcess,0);
    CloseHandle (ProcessInformation.hProcess);
    CloseHandle (ProcessInformation.hThread);

    //Wait for EXEC complete stop
    ModaCPP::Connection::WaitForEXECCompleteStopOnLocalhost(10000);
    }
}

The table below shows the parameters that you may use in command-line mode: 

 

Parameter 
Syntax 
Description 
/p 
/p:"PROJECT_PATH" 
Selects the project to load. PROJECT_PATH is the project's file path. This parameter is required. Note that the /p: commutator can be omitted starting at Marilou 2010. 
/c 
/c:"CONFIG" 
Selects the configuration to be run. This parameter is optional. If the parameter is omitted, Exec shows the configurations list : you can choose the one to be run. 
/run 
/run 
Forces simulation to start in RUN mode. 
/pause 
/pause 
Forces simulation to start in PAUSE mode. 
/noload 
/noload 
Disallow applications referenced in Configuration->"Execute" panel to start. 
/port 
/port:TCPPORT 
Sets the MODA server TCP port (13000 by default). When Exec runs automatically an application (Configuration->Execute Panel->Application list), this port is added to the application's command line with the syntax:/modaport:TCPPORT 
/instance 
/instance:INSTANCE NUMBER 
The instance number is used in multi-instances working mode. INSTANCE NUMBER, 0 based, identify the current Exec instance. Do not use this flag if Exec is run in single instance or use/instance:-1

 

Exemple :

Exec.exe /p:"c:\marilou\v4.7.0\samples\devices\servomotor\servomotor.mdsp" /c:"fast" /run 

Exec.exe c:\marilou\v4.7.0\samples\devices\servomotor\servomotor.mdsp /port:40000 

 

Multi instances:

Exec.exe c:\marilou\v4.7.0\samples\devices\servomotor\servomotor.mdsp /port:40000 /instance:0 

Exec.exe c:\marilou\v4.7.0\samples\devices\servomotor\servomotor.mdsp /port:40001 /instance:1

Documentation v4.7 (18/01/2015), Copyright (c) 2015 anyKode. All rights reserved.
What do you think about this topic? Send feedback!