Sum 3
Sum 3
4
Software User’s Manual
National
Aerospace
Laboratory NLR
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Summary
EuroSim Mk4.4 is an engineering simulator to support the design, development and verification of space
(sub) systems defined by ESA programmes of various scales. The facility provides a reconfigurable
real-time execution environment with the possibility of man-in-the-loop and/or hardware-in-the-loop
additions.
This document describes the facilities available for usage in EuroSim Mk4.4, and how those facilities
can be used.
ii
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Revision Record
c Dutch Space BV iii
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
iv
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV v
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
vi
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Table of Contents
c Dutch Space BV vii
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Revision Record vi
Table of Contents ix
I EuroSim Basics 1
1 Introduction 3
1.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Where to start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Document conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Concepts 5
2.1 EuroSim simulation life-cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Simulator elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 The model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.2 Tasks and schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.3 The data dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.4 Simulation definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.5 The simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Services and tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.1 Project Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.2 Model Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.3 Model Description Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.4 Parameter Exchange Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.5 Calibration Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.6 Schedule Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.7 Simulation Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.8 Action Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.9 Initial Condition Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.10 Test Analyzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4 Facility and project management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.1 Facility manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.2 Project file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.3 Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.5 Application Programmers Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.6 Version management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4 EuroSim tutorial 19
4.1 The case study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
c Dutch Space BV ix
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
II EuroSim Reference 37
5 EuroSim reference 39
5.1 Starting EuroSim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.2 Menu items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.2.1 File menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.2.2 Edit menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.2.3 Tools menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.2.4 Help menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.2.5 Automatic addition of files to the project . . . . . . . . . . . . . . . . . . . . . 42
x
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV xi
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
xii
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV xiii
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
xiv
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV xv
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
xvi
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV xvii
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
xviii
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
IV Appendices 421
A Abbreviations 423
B Definitions 425
c Dutch Space BV xix
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
xx
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV xxi
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Bibliography 571
Index 573
xxii
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Part I
EuroSim Basics
c Dutch Space BV 1
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 1
Introduction
1.1 Purpose
The purpose of this document is to provide a user of the EuroSim facility with an understanding of the
functions available and the logical order in which they should be used in order to achieve the objective
of developing and executing a simulation model for a particular application.
It is expected that the user has some basic UNIX knowledge and familiarity with simulation in general.
This manual is also available on-line, including hypertext.
1.2 Scope
This document describes the use of the EuroSim facility. It provides details of the functions that are
available for the user, and relates these functions to a typical operational scenario. It also provides
guidance on the development of the application model itself, including the recommended structure of the
model, and the library routines provided by the facility.
In this manual the main functions of the EuroSim facility are described from the user’s point of view.
The document is divided in four parts: the first part, Chapter 2 and Chapter 3, describes the general
functionality of EuroSim, its user interface and some of the underlying concepts.
Next, Chapter 4, contains a complete case study for building a working simulator. The more basic
functions are described here, but not in detail.
For more detail, chapters 5 through 12, contain a reference guide to all menu items, concepts and objects
which can be found in the various editors and windows of EuroSim.
Chapters 19 through 21 contain information on using hardware in the loop with EuroSim.
Finally, a number of appendices contain the remaining information. Abbreviations and terms are defined
in Appendix A and Appendix B respectively. The remaining appendices go into more detail on some of
the features of EuroSim.
c Dutch Space BV 3
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
4
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 2
Concepts
This chapter introduces the concepts and elements which are common to EuroSim. These include version
management and the API interface. Concepts and elements specific to an EuroSim tool or editor are
described in the reference chapters for these tools and editors.
Facility Management
Model Code
Simulator
Simulator
Development
Test Scenarios
Preparation
Test Results
Test Execution
(Simulation)
Test
Analysis
The life-cycle is summarized in Figure 2.1 (no feedback loops are displayed). In the figure, the following
phases are shown:
Simulator development
In this phase the model is assembled from existing submodels, or build from scratch. Existing
simulator code can be integrated into the model. Also, an executable version of the simulator is
created, including the scheduling of simulator tasks.
Test preparation
During this phase scenarios for a particular simulator are defined, including stimuli, initial
conditions, recording and on-line monitoring requirements.
Test execution
During this phase the simulator is being run, and the execution of the simulator is monitored.
Test analysis
During this phase the results from the simulator run are processed and analyzed.
c Dutch Space BV 5
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The last rectangle, facility management, offers services with respect to project management and manage-
ment of EuroSim software and hardware configurations. For more information on facility management,
refer to [OM11].
For each of these phases, one or more tools are available to the user. See Section 2.3 for more details.
• A model.
• A data dictionary.
• realize a requested change in simulator state (e.g. from executing to standby); see Section 2.2.5
for more information on simulator states.
The tasks and schedule are defined using the Schedule Editor (see Chapter 10), which is available through
the Project Manager.
1
Ada-95 is not supported in the Windows NT/XP version.
6
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
init
Unconfigured Initializing
(automatic)
(automatic)
abort
Standby
stop
Exiting go pause
abort
Executing
State transitions can be triggered by issuing a state transition command, either from the Simulation
Controller, the model, or the schedule. The labels in Figure 2.2 correspond to the buttons available in the
Simulation Controller (see Section 11.3.1) as well as the MDL commands (see Appendix E). The only
missing state transition is the reset as it is too complicated to put in the drawing. Reset can be issued from
standby state and is a combination of a stop and an init command where the simulation is not completely
stopped and restarted.
The simulator can be run in one of two modes: real time or non-real time. When a simulation is started
in non-real time, the simulation server will try to run the simulation as close to real time as possible. This
means that task timing overruns in the simulation will not generate real-time errors. Also, a simulation
running non-real time will not claim a whole simulation server: other simulations can also be running
(also non-real time). In non-real time mode, it is also possible to instruct EuroSim to run the simulation
as fast as possible (see Section 11.8.5 for more information).
c Dutch Space BV 7
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• The second level of support is through a number of services which are available to the model
developer. Services are functions in the EuroSim software that can be called from within model
code. See Section 2.5 and Appendix D.
In the next sections, an overview is given of the available tools.
8
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
2.4.3 Project
A EuroSim project consists of:
• a description
• a directory where the files reside (also called the project root)
c Dutch Space BV 9
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The API for the EuroSim services is relatively simple: it consists of a number of predefined function calls
that can be used from within the user’s model code. See Appendix D for a description of the available
functions.
The API for the simulation model is a bit more complicated, as EuroSim does not know beforehand what
the user’s model code will look like. Therefore, in order for the model code to be used in EuroSim, the
user has to add API information to the model code: the API header. This API header consists of a number
of lines at the top of the model code. As the information is stored as comments, the source code will still
be usable outside of EuroSim. Using the Model Editor of EuroSim (see Chapter 6), the user can easily
enter the functions and variables in the source code which need to be available to EuroSim.
The information from all the API headers in the model together forms the data dictionary of the model
(see Section 2.2.3).
The API information required by EuroSim is defined using four keywords (the ’ is part of the keyword):
• ’Global_Input_Variables
• ’Global_Output_Variables
• ’Global_State_Variables
• ’Entry_Point
The choice of these keywords stems from systems theory, a discipline closely related to the application
areas of EuroSim. In systems theory, a classical way to look at systems is from a causal input/output
point of view, often referred to as the ‘black box’ approach to modeling of systems. Inputs are converted
to outputs via a so-called black box (Figure 2.3).
black box
state
input output
control
An example would be a heater: a current (in Amperes) goes in, a heat flow (in Joules/second) comes
out. These inputs and outputs are mapped onto the API-header keywords ’Global_Input_Variables
and ’Global_Output_Variables.
The next step in the modeling process is to extract (i.e. to model) the memory function of the system.
The memory at a certain time is known as the state of the system. The state of the system describes
in detail how inputs are converted to outputs. Whereas inputs and outputs are the means with which a
system communicates to the outside world, there does not exist something like a unique state: the notion
of state is very much a mathematical modeling tool.
However, as the system has to be implemented in software to be usable in EuroSim, some way has to
be found to define this state. The memory portion of the state is defined using so-called state variables.
These map onto the keyword ’Global_State_Variables. The part of the state that determines exactly
how to transform input to output using the current state is defined by the functions (or subroutines, or
procedures) in the source code. EuroSim assumes that one source code file (i.e. C, Fortran or Ada-95
file) contains one black box.
Note: as far as EuroSim is concerned, it doesn’t really matter whether a variable is tagged input, output
or state. Each tag will allow EuroSim to access the variable during the simulation. There’s only one
case where it does make a difference, and that’s for the Schedule Editor. This editor can check for data
overlap between two tasks, but it will only consider the input and output variables of the tasks’ entry
points in this check.
10
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
As EuroSim needs a way to “run” the black box (i.e. to trigger it at the right times) there is a need for
a certain amount of control on the black box. This control is given to EuroSim by declaring a number
of functions to be an ’Entry_Point, which means that these functions can be called by EuroSim when
necessary.
An additional bonus of specifying all the variables is that it allows the user define some additional
attributes, such as description, unit, etc., which might be useful to the Test Conductor and Observer when
running the simulator. Also, the variables can be monitored, recorded, or changed during a simulation
run if they are defined in the API header.
There are a number of constraints on the model code in order for this API information to be used correctly.
First of all, within EuroSim C, Fortran, Ada-95, C++ and Java2 can be used as languages to build the
model. Further, programming language specific, constraints are described in Appendix H. For standalone
development of models stubs are provided in the etc directory of the EuroSim distribution. These stubs
are provided for C and C++ and are delivered in source code.
c Dutch Space BV 11
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
than one person can share the same repository, but also keep their own work version.
All versioning actions are done through the Tools:Version menu (see Section 3.5.4).
If an existing software repository, created using the RCS or CVS tool, is to be used within EuroSim, this
can be accomplished by setting the ‘Repository’ to the RCS or CVSROOT directory. The ‘Project root’
should point to an appropriate working directory, with the restriction that the RCS or CVS repository tree
has the same structure as the project tree.
12
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 3
EuroSim uses a graphical user interface (GUI) for all tools available to the user. This chapter describes
the following elements of the user interface:
• The keyboard shortcuts which can be used to quickly access functions from the menus.
• Menu items and buttons that can not be selected (either due to the context, or because they are
currently not implemented in EuroSim) are shown grayed out.
• Where applicable, keyboard shortcuts are shown next to the item. For more information, refer to
Section 3.3.
As the EuroSimGUI’s are based upon the Qt toolkit, the following elements are used for user input:
• Radiobuttons (circles) which behave the same as checkboxes, with the exception that of a group
of related radiobuttons, only one can be active.
• Normal buttons (rectangles), which have a descriptive label such as ‘Save’ on top of the button.
Pushing the button performs an action.
• Textfields (large rectangular areas, sometimes with sliders alongside it), which can be used to enter
text. If the field has sliders, they can be used to reveal parts of the field which are not shown on
screen.
c Dutch Space BV 13
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• The Alt key can be used to access the menubar. Once selected, menu options can be selected by
using the cursor keys followed by Return or by typing the underlined letter for a particular menu
option. Escape aborts from the menu traversal.
• Specific, often used, menu items can also be selected directly using a short cut. These shortcuts
are usually combinations of the Ctrl and Alt keys and a character key, and are shown next to the
menu item.
In textfields, the usual editing keys such as Tab, Enter, arrow keys, Home and End are available. Besides
these keys, the following keys have special meaning:
On systems running the X Window System (UNIX platforms), the second mousebutton inserts the Xbuffer
selection at the cursor location.
OK Acknowledges the question, or accept the changes made in a window and close the window.
Apply Accept the changes made in a window, but do not close the window.
Browse Open a dialog to select an item from a list. Often used to select a file.
14
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Open Pop-up a file selection dialog box in which a file to be opened can be selected. If there are any
unsaved changes to the current file, first a warning dialog box will appear (see New).
Save Save the current file without closing it. If the current file has never been saved before (an
‘Untitled’ file), a file selection dialog box will pop-up asking the user to enter the name of the
file. Note that this item cannot be selected if there are no unsaved changes. Note that a window
title will have an asterisk appended to the name of the file in the title if the file needs to be
saved.
Save As Save the current file with a different name. The newly created file will become the current file.
Exit Close the tool and all windows associated with it. If there are any unsaved changes, a warning
dialog box will pop up.
Cut Move the selected portion of data from the tool window to the clipboard.
Copy Copy the selected portion of data from the tool window to the clipboard.
Paste Move the contents of the clipboard to the tool window. Depending on the tool, the location
where to paste can be selected.
Delete Remove the selected portion of data from the tool window.
c Dutch Space BV 15
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Update Update the selected file with the latest version from the repository.
Get. . . Get a specific version of the selected file from the repository. If the checkbox Remove file
before update is checked, then before the selected version is retrieved, the old file is removed.
Otherwise the selected version is merged with the current version. The version with a check-
mark in front is the required version.
Detailed. . .
Show the detailed version history of the selected file. The version with a checkmark in front is
the required version.
Set Required. . .
Select a required version of the selected file. The version with a checkmark in front is the
current required version.
16
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Diff with. . .
Show the differences of the selected file with another version of that file. The version with a
checkmark in front is the required version.
c Dutch Space BV 17
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
18
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 4
EuroSim tutorial
In this chapter, a complete pass through the EuroSim life-cycle is described. An example is used to
describe all steps necessary to create a successful simulation with EuroSim. The user is advised to check
the reference part of the user manual (Chapter 5, and onwards) for more information on menu items and
the various objects in the EuroSim environment. See Section 2.1 for a description of the life-cycle.
• Set the environment variable EFOROOT to the directory where EuroSim has been installed (by de-
fault this is /usr/EuroSim);
4.2.2 Linux
To run EuroSim on a Linux platform, type esim at the command prompt.
c Dutch Space BV 19
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
After a short while, the main EuroSim window will appear (see Figure 4.1). This window will display
the projects to which you have access. If no project is shown ask the EuroSim facility manager to create
one for you, or alternatively, create your own project, as described in the next section.
• The EuroSim Facility Manager creates a directory where the shared project database can be stored.
20
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
4.5.1 Model
The model for this simulation is divided into four parts:
The two initialization sub-models will initialize all the variables of the model.
The thruster sub-model will monitor the altitude and keep it within limits. These limits are between 210
km and 280 km respectively. When it is below the lower limit the thruster will increase the altitude until
it reaches the upper limit. At that point it will wait until the altitude has decayed to the lower limit and
the process starts all over again. In Figure 4.3 the flowcharts of the two main sub-models are shown.
These flowcharts could be compared to a first version of the design. Later on in the case study, more
optimized code will be used.
no yes
altitude <
altitude > 0?
upper limit?
yes
no
yes
altitude >
lower limit?
no
c Dutch Space BV 21
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Save the model by selecting File:Save. As model name, enter SUM.model in the file selection window.
This file selection is shown because the new model has not been saved before. The next time the model
is saved, no file selection window is shown.
22
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
SUBROUTINE DECAYALTITUDE
DECAYCOUNTER = DECAYCOUNTER + 1
IF (DECAYCOUNTER .GT. DECAYSPEED) THEN
DECAYCOUNTER = 0
IF (ALTITUDE .GT. 0) THEN
ALTITUDE = ALTITUDE - 1
ENDIF
ENDIF
RETURN
END
Save the source file, and close the editor. Repeat the process for Initialize_Altitude with the source
file:
C Parameter Definition.
PARAMETER (DECAYSPEEDDEFAULT = 100)
ALTITUDE = 0
DECAYCOUNTER = 0
DECAYSPEED = DECAYSPEEDDEFAULT
RETURN
END
Listing 4.3: The C source code for the Thruster file node
/*
File: Thruster.c
#define On 1
#define Off 0
c Dutch Space BV 23
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
void Thruster(void)
{
if (thrusterOnOff == On) {
if (speedCounter++ > satelliteAscentSpeed) {
speedCounter = 0;
altitude++;
thrusterOnOff = (altitude < upperAltitudeLimit);
}
}
else {
thrusterOnOff = (altitude < lowerAltitudeLimit);
}
}
Listing 4.4: The source file for the Initialize Thruster node
/*
File: Initialize_Thruster.
Contents: Initialize the thruster simulation model.
*/
#define SPEED_DEFAULT 10
#define On 1
#define Off 0
void Initialize_Thruster(void)
{
satelliteAscentSpeed = SPEED_DEFAULT;
speedCounter = 0;
thrusterOnOff = On;
lowerAltitudeLimit = 210;
upperAltitudeLimit = 280;
}
24
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
When added to the API header (checkmark used), additional information on entry points and variables can
be entered (such as a description). Select the decayaltitude entry point and click the ‘Description’ field
on the right. Enter the description The altitude decay operation. Select the altdata$altitude
variable. The ‘Type’ and ‘Init Source’ fields cannot be changed, as they are extracted from the source
file. Enter a description of The altitude of the satellite. Enter as ‘Unit’ the string [km], as ‘Min’
the value 0 and as ‘Max’ the value 1000. Repeat this for the altdata$decayspeed variable, using the
values:
c Dutch Space BV 25
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The meaning of this message is that the compiler can not find a declaration with the name altitude.
Inspection of the source files indicates that the C function Thruster uses an external declaration of a
variable with the name altitude. Although the Fortran source has a variable with the name ALTITUDE
it is not possible to connect these two variables in the way the current satellite model has been written.
This is a general problem with linking Fortran and C code. It arises from compiler conventions, not from
the EuroSim tools.
To solve the problem, change the altitude variable in the file Thruster.c to the following struct
declaration:
extern struct altitudeDataStruct
{
int ALTITUDE;
int DECAYSPEED;
int DECAYCOUNTER;
} altdata_;
altdata_.ALTITUDE
Note that the altitude variable is used in three places. Be sure to change them all. The Thruster.c
source file should now look like:
/*
File: Thruster.c
#define On 1
#define Off 0
26
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
int ALTITUDE;
int DECAYSPEED;
int DECAYCOUNTER;
} altdata_;
int thrusterOnOff;
int speedCounter = 0;
int satelliteAscentSpeed;
int lowerAltitudeLimit;
int upperAltitudeLimit;
void Thruster(void)
{
if (thrusterOnOff == On) {
if (speedCounter++ > satelliteAscentSpeed) {
speedCounter = 0;
altdata_.ALTITUDE++;
thrusterOnOff = (altdata_.ALTITUDE < upperAltitudeLimit);
}
}
else {
thrusterOnOff = (altdata_.ALTITUDE < lowerAltitudeLimit);
}
}
When the changes to the source file have been made, try rebuilding the simulator. If the build was
successful, the messages SUM.exe MADE and all DONE should be displayed in the status window.
Save the model and exit the model editor. In the EuroSim main window choose Edit:Add Model and
select SUM.model to add the created model to the project.
c Dutch Space BV 27
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
button. This will copy the entry point to the entry points list, indicating that this entry point belongs to
the task we are defining. Do the same with the Initialize_Altitude entry point.
When a task is executed, each of the entry points contained in the task will be executed sequentially. For
this initializing task the order is not important, but if it is, the up and down arrow buttons can be used
to re-order the entry points. Timing information can be entered for each entry point. As we don’t have
such information at this moment, we will leave it empty. Later on, if the simulation has been executed
successfully, it is possible to import a timings file created by the simulator, which contains the various
data required here.
Now change the name of the task to Initialize by entering the new name in the field Taskname below
the Data Dictionary box. Press the OK button. The task on the Schedule Editor now also has the name
Initialize.
Next, from the Insert menu, select the menu item Internal Event. Select STATE_ENTRY from the submenu.
Put it on the tab page. Next select a flow (curved arrow) from the tool button bar. Click the left mouse
button on the internal event. Keep the left mouse button pressed and move the mouse to the task. Notice
how the flow follows the cursor. Release the left mouse button again above the task. The two are now
connected.
Finally, add the PAUSE output connector to the tab page, and connect a flow from the task to the output
connector. The initializing schedule should now look something like Figure 4.6.
28
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 29
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
range yourself. As you can see, the first time you select Manual Scaling the min and max values will be
determined from the Variables list (if possible). The Monitor Editor should now look like Figure 4.8.
Close the editor with the OK button. On the Altitude tab page, the new monitor is shown.
30
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 31
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The Recorder Editor has two tab pages. Change to the Script tab page, and notice that now a ‘Condition’
has been filled in: at a frequency of 100 Hz, the ‘Action’ will be executed. Although not used here, the
‘Inactive’ setting can be useful for temporarily disabling a recording action (or others, e.g. a check on
variable values). Active actions are represented by an ‘A’ in the status column.
The Condition and Action fields are read only, but by checking the Manual checkbox you can customize
these fields.
Close the Recorder Editor with the OK button. A second icon is now visible on the Scenario tab page.
The tab page should now look like Figure 4.11.
Save the simulation definition by selecting File:Save. Requesting Save will cause the Save As. . . file
selector to appear as this simulation definition has currently no filename. The simulation definition
should be saved as SUM.sim.
32
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 33
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Now we will load the test results generated during the simulation. Select File:Select Test Results File.
This will show a file selection window. Now find the recording file generated during the simulation. It
will be in a directory like 2001-08-30/15:33:30. Select the Altitude.tr file, which contains a list of all
recording files created during the simulation (in this case, just one). Right click on the variable browser
window (on the left) and select Expand All Nodes. The window should now look like Figure 4.12.
Figure 4.12: The Test Analyzer with the simulation results loaded
Now select Plot:New Plot. The plot view (top right) now shows an icon representing the plot. The plot
properties tabpages (bottom right) have also become available.
Enter Altitude as the plot title and Plot of altitude against time as a description. Press the Apply
button to commit the changes. The text under the plot icon in the plot view will be updated. The window
should now look like Figure 4.13.
34
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
The next step is to create a curve of the altitude versus the simulation time. Select the variable altitude$altitude.
Now click on the variables and curves tab of the plot properties tabpages. The curve editor appears. Drag
the selected variable from the variable browser to the curve editor. A new curve is created and the window
should look like Figure 4.14.
This completes the plot. Double clicking the plot icon in the plot view will show the plot.
c Dutch Space BV 35
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
36
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Part II
EuroSim Reference
c Dutch Space BV 37
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 5
EuroSim reference
This chapter describes the top-level interface of EuroSim (esim), the Project Manager. For a description
of the various EuroSim components, such as the Model Editor and Schedule Editor, refer to the next
chapters.
the IRIX and Windows NT/XP platform environment variables are defined in the file $EFOROOT/bin/esim.bashrc.
See also Section 4.2.
The Project Manager will use the global project database file projects.db in the directory pointed to
by the EFO_HOME environment variable. If EFO_HOME has not been set before starting EuroSim, EuroSim
will use the subdirectory .eurosim in your home directory.
1
On the Windows NT/XP platform, the DISPLAY environment variable will not be used by EuroSim
2
This variable only needs to be set to override the default value ($HOME/.eurosim)
c Dutch Space BV 39
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The file projects.db contains all project references. If projects.db does not exist, EuroSim will create
a new file.
Each individual project should have its own project directory (preferably in a subdirectory of EFO_HOME).
This directory contains a local project database file project.db, which contains all references to project
related models and files.
For a full list of the initialization files and environment files used by EuroSim, refer to Appendix F.
The Project Manager shows a screen with a ‘Project’ combobox to select a project, a ‘Model’ combobox
to select a model and a ‘Files’ list showing all files that refer to the model. Double clicking a file will
start the associated editor. The editor buttons start an empty editor in the project directory.
EuroSim can be terminated by selecting the File:Exit menu option.
Fill in the various project description items of the window. For the dialog field descriptions
refer to Section 5.2.3, item “Project Settings. . . ”.
Remove Project
Use this option to remove the current project from the projects list. The actual project files
(such as the model file, the schedule, etc.) are not deleted.
40
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Remove Model
Removes the currently selected model file from the project. The actual model file and associated
project files are not deleted.
Name The project name is the name that appears in the project list of the Project Manager,
as well as in various other places, such as the name of the root node of the model
hierarchy in the Model Editor.
Description
The project description is a free-text field that can be used for a more precise descrip-
tion of the project.
Directory
The project directory is the top of the directory tree in which all project related files
will be stored. The Browse button can be used to search for an existing directory. Use
the operating system file protections to protect project files against unauthorized use.
c Dutch Space BV 41
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Under UNIX one could for example create a UNIX group for each EuroSim project and
make the project files writable by group members only. Depending on the security
level required, the project files can be made world readable or not3 .
Version Control System
Defines which version control system will be used for this project. Currently EuroSim
supports the CVS and Cadese4 version control systems.
Repository Root
The repository root is the top of the directory tree in which the version management of
the various model files will be stored. Refer to Section 2.6, for a discussion whether
the repository can best be kept separate from the project root or not. The Browse but-
ton can be used to search for an existing directory. If an existing RCS or CVS repository
is to be used within EuroSim, make sure that the tree under the project root has the
same structure as the repository tree. The repository root field is optional and can be
left empty. See Appendix M on how to set-up a repository root.
Preferences. . .
Opens a dialog to set the preferences. The following items can be set.
Do not prompt to add files automatically
When you start one of the EuroSim editors from the Project Manager and create a new
file, you are prompted whether the new file should be added to the current project. If
you check this item, you will not be prompted and the decision whether to add the file
to the current project depends on the value of the next item.
Never add files automatically
If this option is checked, new files that are created by one of the EuroSim editors will
not be added to the current project automatically. If you want to add a newly created
file afterward, then use the appropriate menu command.
3
Making UNIX groups and assigning members requires ‘root’ privileges and hence is a system administrators/facility man-
agers job. Implementing a good protection strategy is not easy, but is assumed to be within the knowledge of the system
administrator.
4
Not supported in the Windows NT/XP version.
42
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 6
This chapter provides details on the Model Editor. The various objects which can be added to the model
tree, the menu items of the editor and their options are described. For menu items not described in this
chapter, refer to Section 3.5.
Note that only org nodes and file nodes can be directly added to the model hierarchy (using the menu
options Edit:Add Org Node, Edit:Add File Node) or Edit:Add Directory. The other nodes are put into the
c Dutch Space BV 43
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
model hierarchy indirectly, e.g. by parsing the files. Informational messages are written to the logging
window while parsing the files.
The next sections describe each of the nodes. The default icon for the node is shown in the left margin.
If more than one icon is used, all are shown.
44
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
See Section 3.5.4 for information on how to change the version requirement.
c Dutch Space BV 45
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• parameter: a variable set as a parameter may only be changed at initialization time by an initial
condition.
• unit: the unit of the variable, e.g. km. It is for informational purposes only and written to the
dictionary for use by other EuroSim tools, such as the API tab of the Simulation Controller.
The latter two (min and max) are checked at run-time when f.i. a user changes the value through the API
tab of the Simulation Controller.
If the API information in the file contains variables that are not available in the source code a red
cross is drawn through the icon.
Note that the entry point and variable information is extracted from the file after the language specific
pre-processor has processed the file. In particular, if compile flags determine which entry points are
available the API may show conflicts when compile flags change.
In order to avoid problems with globals that only have a local ‘extern’ declaration in entry points, the
extern keyword will be emitted by EuroSim when creating the data dictionary. In particular this means
that for externals with function scope no API information can be generated.
46
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• if there are a lot of API variables within a particular sub-model (source code file), then selecting
variables which appear below their relevant entry points gives you an additional level of hierarchy
which can ease identification and manipulation of API variables later on
• if there is a significant amount of data dependency between entry points which needs to be taken
into account during scheduling, then again, the variables beneath entry points should be selected,
as this relationship is used when determining tasks which share data (see also Section 10.3.5, on
intersection)
c Dutch Space BV 47
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Save As If the model file is saved to a different directory, the file nodes are updated so that the newly
saved model file shares its files with the original model file. If you want a copy of the model
file with the relative pathnames of file nodes unchanged, thus possibly referring to non-existing
files, use the UNIX cp or DOS copy command from the command line of a shell.
Exit Exit the Model Editor.
48
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Rename Node
Rename the currently selected file or org node.
Properties
Shows the properties of a file node (see Figure 6.2) and allows specifying another file name for
this file node.
Clear Min
Clears the minimum value(s) of a variable node.
Clear Max
Clears the maximum value(s) of a variable node.
Add SMP2 Lib node. . .
When an org-node is select in the model hierarchy, or when the root node is selected, this menu
item can be used to attach a new SMP2 lib node as a child to the selected node. The name of
the new node can be entered. This will be the name of the SMP2 library that is produced by the
files that will be attached to the SMP2 lib node. Refer to Chapter 18 for more information.
c Dutch Space BV 49
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parse File(s)
Parse the selected file(s) to discover it’s API and/or find items that can be added to the API of the
sub-model.
Save API
Writes the API information to the sub-model source file.
Clear API
Removes the API information from the sub-model source file.
Also, specific compiler options can be specified, including directories where the compilers
should look for include files. In the libraries field, libraries which need to be linked to the
50
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
simulator should specified in the form -llibraryname. One of the more often used libraries is
‘m’, the math library.
The Makefile field allows you to define the Makefile that is executed by the ModelEditor when
you push the Build All and Cleanup buttons. This option is for instance usefull if you have to
assure that libraries are rebuild before the EuroSim build links them to the simulator. When
nothing is specified in the Makefile field, the ModelEditor will issue the command ’gmake -f
¡modelname¿.make -C ¡project directory¿ ¡target¿’ where ¡target¿ is either ’all’ or ’clean’ based
on the button you pressed. The name of the file specified in the Makefile field will replace the
¡modelname¿.make part in this command. Your user defined Makefile should accept the all and
clean targets, and execute the original EuroSim make command at the appropriate time.
Figure 6.5 shows the available pre-defined build support options for the simulator. Selecting
one or more of these options causes libraries such as ‘external simulator’ or ‘telemetry and
telecommand’ to be linked in, augmenting the simulator with extra runtime functions. Usage of
Ada-95 and/or Fortran runtime libraries requires explicit selection of the appropriate options.
Options are described in the EuroSim.capabilities manual page, and can be listed using the
esimcapability command.
c Dutch Space BV 51
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Figure 6.6 shows the available configuration options for the simulator. Selecting one of the
options allows you to change the default value. It is possible that during run-time you exceed
one of the buffer sizes or need more heap or stack memory. In that case change the appropriate
size so that the simulator runs without exceeding the sizes.
52
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
The Compilers tab page (see Figure 6.7) allows you to specify which compiler(s) and related
utilities to use to build the simulator. When specifying a command, the default used by the build
command will be overruled. Leaving a field blank in the dialog will cause the build command
to use the default command.
You can specify just the command (provided its directory can be found in the PATH environment
variable) or the full path, for example:
/usr/bin/gcc
You can also specify additional command line options for a specific command, for example:
g77 --no-second-underscore
The commands specified on this tab page dialog are not stored in the model file, but in a global
resource1 . Therefore, the command specifications are model independent. The specifications
are read by the ModelMake utility when generating the makefile that is used to build the simu-
lator executable. They are effective after the Tools:Cleanup command.
Clear Logging
Clears the logging window at the bottom of the Model Editor.
Save Logging
Opens a file dialog where you can select or specify the name of the file to save the contents of
the logging window.
Preferences
Shows a dialog where you can specify your preferences, such as always saving API information
to files and saving the changes to the .model file or automatically clearing the logging window,
before starting a build.
1
Located in the .eurosim sub-dicrectory of your home directory (Unix systems) or in the registry (Windows systems)
c Dutch Space BV 53
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
54
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Model Editor specific preferences and preferences related to version control can be changed using the
Preferences dialog (see menu Tools:Preferences).
c Dutch Space BV 55
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
56
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 7
This chapter provides details on the Model Description Editor (MDE). The menu items that are specific
to the MDE will be described in separate subsections of this chapter. For menu items not described in this
chapter, refer to Section 3.5.
7.1 Introduction
The use of the MDE is optional, but you would typically use Model Description files when integrating
several independent models into one simulator without wanting to do the integration explicitly in (model)
source code. Use Model Description files in combination with Parameter Exchange files (see Chapter 8)
to exchange data between models.
Model Description files serve as input to functions of the Simulator Integration Support library, which is
described in detail in Chapter 22.
The MDE can be used to create one or more Model Description files that describe copies of API variables1
that exist in the data dictionary. The data dictionary itself is built by the build process (make) that can be
started from the EuroSim Model Editor, see Section 6.4.6.
The copies of the variables can have names that are different from the ones in the data dictionary. This
is especially useful when the data dictionary contains API variables with ambiguous names (f.i. when the
source code of the model is generated by a software generation tool) or when you address an index in an
array variable and wish to give it a more descriptive name, for example:
sun/update/input/X sun.c/vector[0]
sun/update/input/Y sun.c/vector[1]
sun/update/input/Z sun.c/vector[2]
7.2 Datapool
All variables created by the MDE (i.e. the copies of the API variables) will be added to a special node in
the data dictionary, the so called “datapool”. In order to update these variables in the datapool, special
entry points are automatically generated. These entry points contain the source code to copy the values
of the variables of the model to the copies in the datapool (in case of output variables) or vice versa (in
case of input variables). The datapool and the generated entry points are merged into the data dictionary
during the last step of the build process so that the datapool variables and entry points are available to
the EuroSim simulator.
1
An API variable is a model variable that is marked in the Model Editor to be exported to the data dictionary.
c Dutch Space BV 57
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
58
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 59
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
60
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
The Name field contains the name of the entry point or variable. In cas of a variable node, the fields
Unit and Description are shown. The Unit defines the physical unit of the variable. The Description is
the textual description of the variable. The Data Dictionary field allows you to select the Dict path of
an entry point or variable. In case of a variable to check boxes are available for User defined type and
Error injection. If you check the User defined type box, the Dict path field is changed to User defined
variable declaration. That declaration must be a valid variable declaration in C syntax. The type can be
any basic C type or array. If you check the error injection box the error injection function is enabled for
that variable.
c Dutch Space BV 61
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
62
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 8
This chapter provides details on the Parameter Exchange Editor (PXE). The menu items that are specific
to the PXE will be described in separate subsections. For menu items not described in this chapter, refer
to Section 3.5.
8.1 Introduction
The use of the PXE is optional, but you would typically use Parameter Exchange files when integrating
several independent models into one simulator without wanting to do the integration explicitly in (model)
source code. Use Parameter Exchange files in combination with Model Description files (see Chapter 7)
to exchange data between models.
Parameter Exchange files serve as input to functions of the Simulator Integration Support library, which
is described in detail in Chapter 22.
The PXE can be used to create one or more Parameter Exchange files that describe which output variables
in the datapool should be copied to which input variables in the datapool, see Section 7.2 for a brief
description on how to create the datapool using the EuroSim Model Description Editor.
c Dutch Space BV 63
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
64
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 65
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
66
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 9
This chapter provides details on the Calibration Editor (CE). The menu items that are specific to the
CE will be described in separate subsections. For menu items not described in this chapter, refer to
Section 3.5.
9.1 Introduction
The use of the CE is optional, but you would typically use Calibration files when you need to interface
with external hardware such as electrical front-ends.
Calibration files serve as input to functions of the Calibration library, which is described in detail in
Section 9.6.1.
The CE can be used to create one or more Calibration files that describe the transformation from engi-
neering values to raw values and vice versa.
• polynomial equation
• interpolation
• lookup table
The constants a,b,c,d,e are coefficients which, when correctly chosen, approximate any correlation func-
tion closely enough for the intended purpose.
The interpolation method uses point pairs to create a continuous function by performing a linear interpo-
lation between these points.
The lookup table method creates a discrete correlation function using a lookup table to convert the input
to the output value. If the input value is not present in the lookup table, an error condition is raised. (Thus
similar to point pairs, but without linear interpolation).
c Dutch Space BV 67
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
68
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 69
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Detailed information can be found in the on-line manual page esimCalibration and in the EuroSim Man-
ual Pages document.
70
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 10
This chapter provides details on the Schedule Editor. The various items which can be placed on the
schedule tab pages, all menu items of the editor and their options are described. For menu items not
described in this chapter, refer to Section 3.5.
c Dutch Space BV 71
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
When an item is placed in the tab page, it is given some default values for the properties of the item.
These can be changed by double-clicking the item, or by selecting the item and activating the menu item
Edit:Properties (or pressing Alt-Enter on the keyboard). When the item is shown in a color other than
yellow, there is an error for the item. The error message can be viewed alongside the properties of the
item. For a list of possible error messages, refer to Appendix C.
Items in the tab page can be repositioned by selecting the item with the left mouse button and, whilst
holding the button pressed down, moving the item to another location on the tab page. All flows to and
from the item will remain connected.
Labels can also be repositioned in the same way. This allows you to move the label out of the way if a
flow passes through the label. The position of the label remains relative to the item it belongs to.
In the next sections, each of the items is described, together with the properties which can be modified.
The graphic representation of the item in the tab page of the Schedule Editor is shown on the left.
10.2.1 Tasks
A task item represents a list of one or more entry points. Each task represents a single execution unit
during the simulation. Grouping entry points within a task will ensure that the operations (represented
by the entry points) are executed sequentially. In a schedule, tasks can be activated by:
• a simulator execution state transition (STATE ENTRY connector on entering and STATE EXIT
connector on leaving a state)
• through an input connector that is triggered from an operation that has ended execution
• a frequency changer
Tasks have an AND relation on their input flows. Only after all connected inputs have been activated will
the task become active.
The following properties can be modified in the Edit Task Properties window (see Figure 10.2):
72
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Entry Points
This list shows all entry points that are associated with the task. The ‘Data Dictionary’ list
contains all known entry points, the ‘Entry Points’ list shows the entry points selected for the
current task. The list can be modified by pressing the buttons in-between the two listboxes. An
entry point can be copied from the ‘Data Dictionary’ list to the ‘Entry Points’ list (right arrow),
or removed from the task list (the ‘Delete’ button). The up and down arrow buttons can be used
to re-order the entry points. For editing the entry point list a model file should be selected, so
a data dictionary will be loaded into memory (see also Section 10.3.1): the data dictionary file
of the model must have been build, otherwise the list will be empty and no entry points can be
selected.
Timing information for the selected entry point is shown next to the ‘Entry Points’ list. Timing
information can be modified by clicking on the entry point timing values. Timing information
can also be imported into the scheduler using the File:Import timings. . . menu item. The
latter is only possible if you have already performed a simulation run with this schedule, which
produces the timings file.
Beneath the entry point values the total timings for the current task are displayed. Entry points
in a task are executed sequentially, so the timing information is calculated by adding the values
for the individual entry points in the task.
Taskname
The name of the task.
Processor
The processor on which the task should be executed. The default is ‘Any’.
Priority The priority with which the task should run. Default is ‘Moderate’.
Preemptable
Set this to ‘No’ if the task may not be interrupted by another task.
Allowed Duration
The maximum allowed task duration in milliseconds, with microsecond resolution. The dura-
tion is checked after task completion and results in a warning when exceeded. By default the
duration is unchecked. For Periodic tasks the maximum is the tasks’ input period. For Non
Periodic tasks the maximum is unlimited.
Deadline
The time period after which the task must have finished. The deadline is relative to the start of
task execution and can be specified with a ’basic cycle’ period resolution. For Periodic tasks
the default and maximum deadline values are equal to the tasks’ input period. For Non Periodic
tasks the deadline is unchecked by default. The maximum is the main cycle period. As soon as
a deadline is exceeded a real-time error is raised and the scheduler inserts basic cycles until the
task finishes (in the ’Executing’ state this means the Simulation time is effectively halted).
Times (for Allowed Duration and Deadline) are always in multiples of the basic clock cycle (see Fig-
ure 10.8).
Task statistics are shown in the window below the entry points:
Running
The time that the code in the entry points was actually executing.
Blocked
The time between task activation and start of execution.
Preempted
The time the task was preempted by a higher priority task.
Duration
The total time to execute the task entry points.
c Dutch Space BV 73
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Offset The start of execution measured from the start of the current cycle.
Finished
The end of execution measured from the start of the current cycle (Offset + Duration).
Non-real-time tasks have an OR relation on their input flows. As soon as one of the connected inputs
have fired, the non-real-time task is activated. If an AND relation is needed, this can be easily created by
inserting a real-time task between the connected input items and the non-real-time tasks. The real-time
task then assures the AND relation on the input flows, and subsequently activates its output flow to the
non-real-time task.
The following properties can be modified in the properties dialog (see Figure 10.3)
Entry Points
This field indicates the entry points that will be triggered by this non real-time task. This list
can be modified just like real-time tasks (see Section 10.2.1).
Taskname
The name of the non real-time task.
Buffer Capacity
This indicates the buffering capacity of the non real-time task.
The Period field is inherited from the schedule. Timingsfile shows the selected timingsfile. Error shows
the status of the non real-time task.
74
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
The following properties are shown in the properties window (see Figure 10.4):
Tasks This list shows all tasks currently connected to the mutual exclusion.
Shared Task Variables
The Shared Task variables box shows a list of the variables that are shared by the listed task(s).
The following properties can be modified in the properties window (see Figure 10.5):
Input Ratio and Output Ratio
show the ratio between the input and output frequencies. Only M:1 or 1:N ratios are allowed.
An 1:N store (e.g. 10Hz/50Hz) means that upon activation of the frequency changer the output
flows of the store are activated N times (5 in the example) directly one after another. To achieve
a more regular task activation (50 Hz in the example), the task after the output flow should also
be connected to a 50Hz timer. An M:1 store will activate the output flow only once every M
input activations.
Offset The delay of the output activation in milliseconds. Only valid for M:1 ratios. It must be a
multiple of the basic clock cycle (see Section 10.4.7). A value of zero (0) means that the output
c Dutch Space BV 75
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
will be activated on the first input activation. The default activates the output after M input
activations.
Note that the output side of the synchronous store runs mutually exclusive with the input side.
See also Section 10.4.3 and Section 10.4.4.
The Output Frequency and Output Period are updated when the ratio changes.
The last item, Error, shows the status of the item.
The following properties can be modified in the properties window (see Figure 10.6):
Name The name of the input connector. Predefined events cannot be renamed, only user defined input
events can be renamed. The name must be unique.
Capacity
This indicates the buffering capacity of the connector.
Raised by
This indicates the sources of the event. An event can be raised internally by model code, a
script or the event connection. An event can also be raised by an External Event Handler, e.g.
a handler connected to a HW device or a signal handler (see section Section 10.3.5: external
event handler).
Output connectors have an OR relation on their input flows. As soon as one of the connected inputs have
fired, the output connector will raise the output event. If an AND relation is needed, this can be easily
created by inserting a real-time task between the connected input items and the output connector. The
real-time task then assures the AND relation on the input flows, and subsequently activates its output
flow to the output connector to raise its event.
No properties can be modified. Only user defined output events can be renamed.
76
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
10.2.7 Timers
Timers activate their output at the specified frequency and can be used to activate f.i. tasks. The max-
imum allowed frequency can be defined in the Schedule Configuration tool (see Section 10.3.5). The
system uses 200 Hz (IRIX) or 100 Hz (Linux, Windows NT/XP) as default value.
The following properties can be modified in the properties dialog (see Figure 10.7):
Frequency and Period
Use either of these to set the frequency of the timer. If one is modified, the other is updated au-
tomatically. The maximum and default frequency is 200 Hz (IRIX) or 100 Hz (Linux, Windows
NT/XP). The frequency range allowed is 0.001 Hz up to and including the maximum frequency,
with a step 0.001 Hz.
Offset The delay of the output activation in milliseconds. This must be a multiple of the basic period
(see Section 10.4.7).
Error shows the status of the timer.
10.2.8 Flows
Flows are used to connect items in the schedule. They represent triggers going from one item to another.
c Dutch Space BV 77
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Refresh Reads in the new data dictionary that is associated with the currently selected model. This
option is useful if you have an instance of the Model Editor open and update the model - and
data dictionary by building it - while you are also editing the schedule.
78
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
RESET System reset. Requests transition from ‘Standby’ to the ‘Initializing’ state.
ABORT System abort. Requests transition from ‘Standby’ or ‘Executing’ to the ‘Unconfigured’ state.
c Dutch Space BV 79
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Type This determines which clock is used by the scheduler. The availability of clocks de-
pends on the selected model and target platform (see Section 10.4.9).
Period / Frequency
The desired period or frequency at which the scheduler should operate. The default
is 100 Hz, but this can be raised up to 1000 Hz, depending on the clock type. The
requested frequency is converted to a period in milliseconds. This period is used as
the basis to calculate simulation time, so round numbers are in favour. Note that
on some platforms it is possible to specify external clock sources. In that case it is
important that you specify the right frequency for correct simulation time calculation.
Real time
The number of processors to be allocated to the scheduler. The maximum number of
real-time processors is 10. The default value is 3 processors.
Number of Action Managers
The number of action managers which can be explicitly scheduled in each simulator
state. The default value is 1.
External Event Handlers. . .
This menu item will show the list of External Event Handlers (see Figure 10.9). Here Exter-
nal Event Handlers can be added, deleted or modified. The user has to specify the processor
that handles the external event. With ’exclusive’ use of the specified processor, the scheduler
excludes the processor from the ’any’ pool for task execution1 . Event handlers that have an ’au-
tomatic’ handler type, automatically add an input connector to the Insert:External event menu
(see Section 10.3.4.1). The external event gets the same name as the event handler. Event han-
dlers of handler type ’user defined’, need additional code to handle the event and optionally
raise one or more user defined input connectors, see Section 19.5.1.
Intersection. . .
This item will show the Intersection dialog (see Figure 10.10). The Intersection window shows
all variables that are shared by all the selected tasks. This way, it is easy to see if there are any
(possibly unwanted) interactions between tasks.
1
This setting has no meaning on single CPU machines.
80
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
CPU load. . .
The fields of this window show the processor load for each of the processors per state of the
schedule (see Figure 10.11). The processor load is calculated using the mean duration (exe-
cution) fields of the tasks. Timings for tasks assigned to ‘Any’ processor are split among all
processors. If any of the processors has a load of more than 50%, this will result in a non-
feasible schedule.
Timebar. . .
With the timebar dialog the scheduler trace file can be specified (see Figure 10.12) and viewed
(see Figure 10.13). Note that the trace file can grow substantially, so only use it when you are
debugging your schedule. Specify its location (path) somewhere on a local drive, thus avoid
using a networked drive.
c Dutch Space BV 81
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
82
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Note that even in the example above the starting time is never exactly the same, one of A or B will start
slightly earlier than the other (the difference might be in nanoseconds). Which one in this case runs first
depends on system internal behavior.
A B
freq=50Hz freq=200Hz
offs=0ms offs=0ms
C D
With this schedule it is defined that task A and D must be activated each 5 ms, task B must be activated
each 10 ms, and task C must be activated each 20 ms. The maximum frequency on which the scheduler
can activate tasks is for all states default 200 Hz. This means that the “real-time” is split up in time
slots of 5 ms. For the example, the scheduler will activate tasks A and D in slot 1,2,3,. . . , task B in slot
2,4,6,. . . , and task C in slot 4,8,12,. . .
In the previous example, the sequence of tasks within the slots, is not defined. To define the sequence
between tasks within the slots, dependencies (between tasks with the same frequency) and frequency
changers (for tasks with different frequencies) can be used. In the following example the sequence of
tasks within the time slots is defined with dependencies and frequency changers.
freq=200Hz
D B C
offs=0ms
A
200/100 100/50
Note that the frequency of task D is still 200Hz, the frequency of task B is still 100Hz and the frequency
of task C still 50Hz. These frequencies are now defined in the output frequency of the frequency changer.
With these frequency changers it is defined that the time slots and sequences of tasks, within these slots,
will be:
c Dutch Space BV 83
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
In the previous example we used frequency changers to define the sequences of tasks. With the defined
sequence it is implicitly defined that tasks do not run simultaneous. If we do not want to define a
sequence, but we only want to define that tasks are not executing simultaneous, we can use mutual
exclusions. Tasks that read or write from the same mutual exclusion, are never executed by the scheduler
simultaneous. For example, if we have a “printing” task that prints the contents of a linked list on 50 Hz,
and a “updating” task that is changing the list at 200 Hz. It is obvious that the updating task may not run
simultaneous with the printing task. To solve this problem, we can use a frequency changer.
freq=200Hz freq=50Hz
offs=0ms offs=0ms
Update Print
List List
List
5Hz/0ms
A AET=200ms
5Hz/1Hz
B C
In this figure, the frequency changer must guarantee that task A will run mutual exclusive with tasks B
and C. The allowed execution time of task A is limited to a maximum of 200 msec as a consequence of
the frequency of 5Hz.
After 5 activations of Sync Store, the store will activate tasks B and C, before releasing task A for the
next activation. However, task A must be released in 200msec (its AET), or else it will cause real-time
errors. The total allowed execution time of the combination of task B and task C is therefore limited to a
maximum of 200msec. In practice, the duration of task A will be larger than zero, which further reduces
the allowed execution time of B+C.
If the execution of B+C is more than allowed, a solution might be to store the part of the code that needs
the mutual exclusive behavior in a separate task. For instance:
84
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
5Hz/0ms
A AET=200ms
5Hz/1Hz
D E
B C
The part of the code of B and C that needs to be executed mutually exclusive with A (because it accesses
the same variables) is stored in D and E. The remaining code is still in tasks B and C.
Now only the code in D and E must have a combined duration that is smaller than 200msec.
Note: D and E do not run mutually exclusive. If that is required, this can be accomplished by connecting
these two tasks to a mutual exclusion (see Section 10.3), or even simpler by combining the code contained
in D and C in one task.
1Hz/0ms
1Hz/5Hz
5Hz/0ms
Without the 5Hz timer, B is activated 5 times in rapid succession after each activation of A. Therefore
the frequency of B would not be exactly 5 Hz, but would be determined by the execution duration of B.
This is sufficient if only the ratio between A and B is of importance. However if it is required that B must
be executed with an exact frequency of 5Hz, then the 5Hz timer should be added, which forces B to wait
200msec between the successive executions of B. The advantage of not adding a timer is that execution
time is more efficiently used.
1. You can synchronize explicitly in the Schedule Editor, using the schedule items available
2. You can use a ‘flag’ variable in memory to pass the status information about the I/O.
c Dutch Space BV 85
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
C D
B
Task A performs some action. When finished, the non real-time task D is activated which performs the
task D containing entry points that do the I/O actions. Within task D, when it has performed its I/O
actions, a call to the function esimRaiseEvent is made (in this case with argument “C”). This function
call activates the Input Connector C which in turn will activate Task Item B. Data read by task D can now
be used by task B.
When task A needs to perform I/O, it sets a variable (e.g. io_request) and activates the input connector
C by calling esimRaiseEvent(C). Task A keeps on running.
The activation of C will cause an activation of D. Task D connected to non real-time task D will perform
its I/O and will set a variable (for instance io_handled) when the I/O operation is ready.
While running, task A scans variable io_handled to verify if I/O has completed. When it detects that
this variable has been set, both io variables can be reset, and data read in the I/O action can be used.
Note that, within this approach, it is also possible to activate input-connector C from a MDL script instead
of a task. Using this feature, D can be activated from the Simulation Controller.
86
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
NB. If in the period between the request and the transition more state requests are given, these requests
are buffered by the scheduler (up to 32) and applied on FIFO basis at the next main cycle boundaries, with
one at a time.
10.4.7 Offsets
Offsets are used to “delay” tasks to following time slots. Suppose we have the following schedule:
freq=20Hz freq=20Hz
offs=0ms offs=10ms
A B
When offsets are used, state transitions will still be on the main cycle boundaries. This means that task
B must still be activated (according to the current executing schedule), in the first two slots of the new
state. This guarantees that the number of activations for each tasks are always the same. I.e. a functional
model will always complete leaving the system in a deterministic state.
Note that no synchronization whatsoever is performed between the schedules in the ‘old’ and ‘new’ state:
this is omitted under the assumption that there is only one nontrivial EuroSim state (state EXECUTING),
and that any other state is to perform simple procedures, such as initialization or keeping hardware alive.
Supporting state synchronization would unnecessarily add to the complexity of the scheduler. The user
must however be aware of a possible overlap in execution of the schedules of two states ‘just after’ a
state transition when offsets are used.
Note: One exception is made for the transition to ABORT. An abort transition does not wait until the
main cycle boundary, but is directly done by the scheduler. This means that all tasks, inclusive tasks with
an offset, are directly stopped.
c Dutch Space BV 87
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
When the action manager is not scheduled explicitly, i.e. not placed on the tab page in the Schedule
Editor, the action manager is added to the schedule with a default frequency that is equal to the Basic
Frequency of the scheduler and with a priority of Low. In many cases this will be sufficient, as this will
activate the action manager with a high frequency, and after all other tasks have been activated.
However, there are cases where the action manager should be scheduled more carefully using the Sched-
ule Editor. One such case has already been mentioned: to provide logging of variables on a specific
moment in the overall schedule. Another example is the case in which only one real-time executor is
available on which a low frequency task with long duration is running. Due to its long duration some
time slots are filled completely, leaving no time to run the action manager. In this case the default Low
priority will lead to real-time errors. Scheduling the action manager in the Schedule Editor with a higher
priority may be the solution. This is illustrated below:
88
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 89
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
90
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 11
This chapter provides details on the Simulation Controller. The panes and tab pages of the editor, the
various objects that can be created, all menu items of the editor and their options are described. For menu
items not described in this chapter, refer to Section 3.5.
c Dutch Space BV 91
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
definitions will be lost. This information is now stored in the Simulation Definition file and in the .usr
files.
92
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Monitors could be stored in a scenario, but this is obsolescent. Instead, monitors should be defined in
MMI files. If an old scenario containing monitors is imported, then the monitors should be converted
using the menu Tools:Convert Old Monitors. Existing monitors in a scenario cannot be edited, only
converted and deleted.
Not all of these components have to be present in one simulation definition. Only the references to the
model and schedule are required.
The required (active) initial conditions are indicated in the Input Files tab page: the initial conditions
marked Active form the set of values that will be applied if you request “Init” or “Reset” from the Simu-
lation Controller. Values which have been updated are then used in tasks scheduled for the “initializing”
state. The set of active initial conditions can be updated by activating or deactivating the appropriate file
in the Input Files tab page.
Alternatively, you can request Control:Apply Initial Condition. . . from the Simulation Controller to
cause the data values within the file to be applied directly to the current simulation. In this case, the
values are used to override the current simulation values. The simulation state is not affected when this
option is used.
c Dutch Space BV 93
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
MDL is a simple yet versatile language for simulation scripting. It allows users to write control scripts in
a limited free-text, C-like language. Appendix E contains a comprehensive overview of MDL.
A script action is made up from four parts:
All of these items can be modified with the Action Editor, which is described in more detail in Sec-
tion 11.14. The Action Editor is started when creating a new action, or when modifying an existing
action.
11.2.5 Monitors
While it is possible to create a monitor script action, this type of monitor has become obsolescent.
Generally you only come across a monitor action when loading an old (EuroSim Mk2 or earlier) .mdl
scenario file or when you explicitly create a script action containing a monitor.
When an obsolescent monitor action is triggered a new tab page Script Monitors will appear that contains
the created monitor.
In EuroSim Mk4.4 a monitor is no longer a script action. Instead monitors are defined in a .mmi file and
can be edited in the corresponding MMI tab page. You can create multiple MMI tab pages, each containing
a set of monitors.
In order to reduce required bandwidth between the simulator and Simulation Controller, you can deacti-
vate an MMI file. When and MMI file is inactive, its monitors will not be subscribed for updates from the
simulator. You can activate or deactivate an MMI file when the simulator is running. The monitors will
then subscribe or unsubscribe for updates as appropriate.
Monitors on the scenario tab page can be converted to an MMI tab page by using Tools:Convert Old
Monitors.
There are two built-in monitor types: alpha-numerical and graphical monitors.
94
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
With alpha-numeric monitors, a window will be shown in the MMI tab page in which the current value of
one or more variables will be presented. The window will be updated when the value changes.
Graphical monitors use one of three types of graphs to display the values of variables:
See Section 11.16.3 for a more detailed description of the Monitor Editor.
For user-defined monitors, a special plugin type can be used. This type uses shared libraries to load
plugins. For a more detailed description and examples see Section 11.15.
At the top is the menu bar and a tool bar. At the bottom a status bar provides additional state information.
New Create a new Simulation Definition. The same as the File:New menu item.
Open
Open an existing Simulation Definition. The same as the File:Open menu item.
Save Save the current Simulation Definition. The same as the File:Save menu item.
Up Go up one level in the folder hierarchy. Available when the scenario is represented using icons.
The same as the View:Up menu item.
New Folder
Create a new folder. Available in the scenario tab page. The same as the Insert:New Folder
menu item.
Init Initialize the simulator. The same as the Control:Init menu item.
Reset
Reset the simulation. The same as the Control:Reset menu item.
Pause
Pause the simulation. The same as the Control:Pause menu item.
Step Advance the simulation through one executing cycle. The same as the Control:Step menu item.
Go Put the simulation in executing state. The same as the Control:Go menu item.
Stop Stop the simulation. The same as the Control:Stop menu item.
c Dutch Space BV 95
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Abort
Abort the simulation. The same as the Control:Abort menu item.
Mark
Place a mark in the journal file. The same as the Insert:Mark Journal menu item.
96
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• The simulation time (it is expressed in seconds or as an absolute time displayed as YYYY-mm-dd
HH:MM:SS.ssss if the simulation uses UTC).
• The wall clock time (elapsed time since start-up or the UTC time if the simulation uses UTC).
c Dutch Space BV 97
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
recording files
These are the files that result from the recording actions as defined in the scenario definition.
For each recorder a file is created with the name recordername.rec if the default name was
chosen in the scenario definition.
test result file
This file contains a list of all recordings performed during the simulation run. This file will have
the extension .tr.
All these files are created in a directory with a name like 2001-12-14/15:33:30, which includes the date
and time of the simulation run.
98
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
specify values in the initial conditions if these values override the initial value specified in the API header.
The initial conditions are set prior to execution of the code, and a simulation can be re-initialized during
a run.
The validity of the initial condition cannot be checked by EuroSim. However, the Initial Condition editor
will only allow values of the correct type to be entered which are the range that was specified in the API
headers of the model.
The initialization sequence is as follows:
• first the simulator is loaded and the variables will get the values as they are hard coded in the
source file.
• next the model is loaded and the variables defined in the API headers will get their designated
default values
• finally, the initial conditions are used to set the variables specified in the Initial Condition files,
with their values. The order of appearance in the Input Files tab page determines the order of
initialization. I.e., the top-most Initial Condition file is applied first, followed by the second file,
etc.
c Dutch Space BV 99
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
MMI A sub-menu with all MMI tab pages. The selected tab page will be raised to the top.
Scenarios
A sub-menu with all Scenario tab pages. The selected tab page will be raised to the top.
Toolbar Button Labels
Show text below the toolbar buttons. This setting is saved in a settings file and will be restored
the next time the Simulation Controller is started.
Large Toolbar Buttons
Show large icons for the toolbar buttons instead of the default small icons. This setting is saved
in a settings file and will be restored the next time the Simulation Controller is started.
Tabbar Labels
Show text on the tab-bar. Disabling this setting can be useful if your Simulation Definition
file contains a lot of MMI and/or script files. This setting is saved in a settings file and will be
restored the next time the Simulation Controller is started.
Refresh If the data dictionary or schedule file have been changed, then reload these files.
Clear Log
All the messages (if any) in the message tab pane currently on top are deleted.
100
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 101
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
If the checkbox Use FTP is enabled, as in Figure 11.6, the dialog allows a host to be specified
where the simulation should be started. At that time the relevant simulator files will be uploaded
using FTP to that host. This functionality is required for starting simulators on the Phar Lap
ETS platform (see Appendix Q).
102
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Init This will initialize the simulator. Standard this process comprises of the following steps:
1
Speed Control has no effect if an external clock is used whose frequency cannot be changed by EuroSim.
c Dutch Space BV 103
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
1. Load the application model associated with the current simulation definition.
2. Use the data dictionary information to set initial values.
3. Use the Initial Condition files (if active) to update initial values.
4. Execute the task from the initializing schedule through the scheduler.
5. Execute the actions that are tagged as active during the initializing state. Once the initial-
ization is complete, the simulator will be in the standby state at simulation time 0.0000
seconds, or the simulation time set by a script or model code.
If Use FTP has been enabled in the Server:Select Server dialog the following steps are executed
before the default steps:
1. Check if no model is running on the selected host. If there is, an error is displayed and the
Init action is aborted.
2. Collect the application model files and transfer these to the selected Phar Lap ETS host
using FTP.
3. Collect the required “stub” DLL files for the model and transfer these as well.
4. Generate and transfer a “run.cmd” file that specifies the model with the correct runtime
parameters.
... Rest of the steps.
Reset This will reset the simulation (i.e. perform steps 2 through 5 of the initialization process). Note
that if the schedule contains an output connector connected to ABORT, the simulation cannot
be reset.
Step This will advance the simulation through one executing cycle. If the schedule contains a low
frequency task, then this could be a significant period of time.
Pause This will temporarily stop the simulation (put it in standby state). The simulation is not neces-
sarily completely inactive however, as tasks and actions specified for the standby state will be
still executed.
Stop This will stop the simulation gracefully. The simulator will be transitioned to the exit state, all
open files will be properly closed and the connection to the simulation will be disconnected.
If the simulation was run on the Phar Lap ETS platform using the Use FTP option from Server:Select
Server dialog, the result files from the simulation will be retrieved using FTP and stored in the
result directory.
Abort This will abort the simulation instantaneously. Open files will not be closed by EuroSim, but
rather by the operating system, which results in loss of data as data still in memory is not saved.
If a test execution has resulted in a simulator hang, or remaining executables from previous
simulation runs, use the Server:Show Current Simulations menu option and select the offending
simulation and request Kill Sim to remove the remaining executables.2
Raise Event
Show a list of available user defined events. Select an event and raise that event by either double
clicking the event or pressing the Raise Event button. This menu item is only available when
the connection to the simulator is active and if at least one user defined event is available.
2
As a last resort, use the efoKill command from a UNIX shell or Windows NT/XP command prompt to remove the remaining
executables, see Section 13.7.2. The efoList command can be used to list the simulator runs currently executing on the host
machine, see Section 13.7.1 or the UNIX manual pages for more information.
104
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Suspend/Resume Recording
This menu option allows the user to activate/deactivate all recording actions in the simulation
via a single request. This can be useful for temporarily suspending recording during a simula-
tion run.
Take Snapshot
This menu option will pop-up a window (see Figure 11.9) with which a snapshot of the current
state of all simulation variables can be made. In the same window a comment can be added to
the snapshot. The file created has a default extension of .snap. Snapshot files can be used as
initial condition files (see Section 11.7).
Apply Snapshot
This menu item will have a sub-menu showing all available initial condition and snapshot files,
i.e. all files referenced within the current simulation definition. Select one of the initial condi-
tions to override current simulation values with the values in that file.
Apply Initial Condition
Apply the selected initial condition file to the currently active simulation to override the current
simulation values with the values from the selected file.
Check Health
Check whether the connection to the simulator is working correctly. A message appears in the
log pane describing the health status of the simulator.
Settings in this dialog allow you to specify how the Simulation Controller GUI behaves. This
is independent from the project that is loaded. Settings that can be specified define for instance
c Dutch Space BV 105
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
the maximum number of Simulation Definition files that are stored in the most recently used
files list in the File menu. You can also select whether all changes are always automatically
written to disk when the stimulator is started, or which debugger will be launched when you
use the Start Debugger (F5) option from the Debug menu. The MMI Auto Disable option forces
the Simulation Controller to automatically disable any non visible MMI tab. This mode should
only be used when large number of MMI tabs and monitors are used, and the user experiences
that the Simulation Controller becomes unresponsive. In such extreme case the responsiveness
can be improved by disabling tabs. Switching the MMI Auto Disable mode on automates the
disabling, leaving only the visible MMI tab active.
CPU Load
This option enables or disables a CPU load monitor as shown in Figure 11.11.
The average and peak load percentage readings are shown for each CPU. The loads are measured
over the time interval specified in the line edit in the last column. The average load shows the
average of the measured loads over a 500 milliseconds period. The graphical plot shows the
maximum of the measured loads over the 500 milliseconds period. The peak load reading shows
the maximum measured load encountered during the simulation.
The load measurement time interval can be set in a range from 1 to 9999 ms. If you edit values
in the last column you should press the Apply Time button to actually use the changed value.
If the measurement interval is larger then 500 milliseconds, then the average load will be equal
to the actual load in the plot as the time measurement interval is larger then the 500 msec
interrogation period used by the Simulation Controller.
This CPU load monitor is only available if a connection to a simulator is active and the simulator
is running in real time.
Rec/Stim Bandwidth
This menu item will show in a window (see Figure 11.12) the runtime bandwidth (in bytes/sec-
ond) for the recorders and stimuli defined in all scenarios in the Simulation Definition. There
are two estimates: one for all actions and one for all active actions. These estimates do not take
into account start and stop times of these actions, or any other conditions (such as a test like if
varx >100 record ...). The actual bandwidth values are only available during a simulation.
The Time before disk full item is an estimate based on the bandwidth of the active recorders and
does not take other file actions into account. It also assumes that all recorder files are written to
the results directory as displayed in this window.
Press the Rescan button to perform a new calculation based on the most actual bandwidth and
free disk space values.
106
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Configuration
This menu item will display a window in which various information on the current simulation is
given (see Figure 11.13). In the top half of the window the names of the files currently in use as
model, schedule, export, alias file, TSP map file, data dictionary, initial condition and scenario
are displayed, as well as any stimuli data files referenced so far. Finally, the actual stimuli
throughput (in bytes/sec) is given. In the bottom half of the window any recording data files in
use and the recording throughput are given. Also (prior to requesting Init), the user can change
here the directory in which all results files should be stored, as well as whether additional date
and time subdirectories should be created where the results files are placed. The Show Paths
button can be used to view the full path of each of the file names. The Rescan button can be
used to get the latest information on the throughput rates.
c Dutch Space BV 107
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
You can reorder the scenario or MMI tab pages. To do that you drag and drop a scenario or MMI file to
before or after another scenario or MMI file.
To reorder the Initial Condition files (and thus the order in which these files are applied) you can also use
drag and drop to move then around.
The following Edit menu items are available in the Input Files tab page:
Properties
Allows you to edit the properties of the selected file. For scenario and MMI files the correspond-
ing tab page will be raised to the front. For Initial Condition and User Program Definition files
a dialog will appear.
Delete Remove this file from the Simulation Definition. Note that the actual file is not deleted, the
entry is only removed from the Simulation Definition.
Activate
Only valid for Scenario, MMI and Initial Condition files. Mark this file Active, i.e. this file will
be used when the simulator starts.
108
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Deactivate
Only valid for Scenario, MMI and Initial Condition files. Mark this file Inactive, i.e. this file
will not be used when the simulator starts. Inactive scenario, MMI and initial condition files are
ignored by the simulator.
Launch Only valid for User Program files. This will launch the program definition.
If the launch User Program produces output and/or error messages then a window will pop up
that shows those messages.
The following Control menu item is available in the Input Files tab page:
Apply Initial Condition
The currently selected initial condition file will be applied to the running simulation.
Double clicking on the file name has the same effect as selecting Properties from the Edit menu. There
are a few exceptions: double clicking on a User Program Definition file when a connection to the Simu-
lator is active will Launch the program.
c Dutch Space BV 109
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The schedule used by the simulation definition can be debugged in the Schedule tab page (see Sec-
tion 11.10.1).
110
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
11.10.2.4 Breakpoint
This is used to indicate the entry point(s) which have a breakpoint attached.
11.10.2.5 Trace
This is used to indicate the entry point activation will be traced. A traced entry point writes time-tagged
messages in the Simulation Controller log window. If an entry point has both a trace and a breakpoint,
only the breakpoint is shown.
Step Advance the simulation to the next entry point to be executed. This button should not be con-
fused with the Step button on the Simulation Controller window itself. You can use the function
key F10 to quickly access this menu item.
c Dutch Space BV 111
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
112
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Actions in the scenario tab page can be either active or inactive (indicating whether it will be automat-
ically checked against its run condition during a simulation run). For active actions the action name is
shown in blue instead of black and (for the tree view only) the last column Status is marked with an ‘A’.
By toggling the Active checkbox in the Action Editor dialog you can change the initial Active state.
c Dutch Space BV 113
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
During a simulation you can activate an inactive action or deactivate an active action. This does not
modify the Active property of the action. When the simulation ends the Active status returns to its
original setting.
When an action is actually executing, the Status column is marked with an ‘X’ (for the tree view only)
and the action name is shown in green instead of blue (active action) or black (inactive action).
Icons are used to represent actions (stimuli, recorders, monitors, scripts) or folders. The following icons
are used in the scenario tab page:
Recorder
this icon is used for recorder actions (defined using the Recorder Editor)
Stimulus
this icon is used for stimulus actions (defined using the Stimulus Editor)
Monitor
this icon is used for monitor actions (can only appear in old pre-Mk.3 scenario files)
Script
this icon is used for script (free format MDL) actions
Folder
this icon is used for folders that can contain other actions or folders.
Double clicking on these actions when a simulation is running will have the following effect depending
on the type of action:
Recorder
activate or deactivate this recorder
Stimulus
activate or deactivate this stimulus
Monitor
start this monitor (it will show up on the Script Monitors tab page)
You can drag and drop actions and folders from one place to another. In order to rename a folder or
action you can click on the item with the left mouse button to select it, then click again to edit the name.
You can also press F2 to edit the name of the selected item.
114
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
The following Edit menu items are available in the scenario tab page:
Undo/Redo
Action changes and changes to the hierarchy structure of a scenario (i.e. actions moved to
another folder, folders dragged to another position, folders deleted or added) can be undone and
redone.
Cut/Copy/Paste
Actions and folders support the usual cut, copy and paste operations. An action/folder that is
copied or cut from one scenario tab page can be pasted onto the tab page of another scenario.
Activate/Deactivate
Activate or deactivate the selected action. Only available if a simulation is running.
Properties
Start the editor for the selected action.
Delete Delete the selected action or folder. The action or folder is not placed in the clipboard and thus
cannot be pasted.
Edit Scenario Caption
Change the caption of the scenario tab page.
Delete Scenario Tab Page
Delete the scenario tab page. You will be asked to confirm this operation.
The following Edit menu items are available in the scenario tab page:
Show Icon View
Toggle between the tree view and the icon view of the scenario.
Rearrange Icons
Icon view specific: rearrange the icons of the scenario.
Up Icon view specific: by double clicking on a folder you move down in the action hierarchy. This
menu item moves the icon view to one level up the action hierarchy.
The following Insert menu items are available in the scenario tab page:
New Recorder
Create a new recorder action. See Section 11.14.2 for more information.
New Stimulus
Create a new stimulus action. See Section 11.14.3 for more information.
New Script
Create a new script action. See Section 11.14.1 for more information.
c Dutch Space BV 115
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
New Folder
Create a new folder called New Folder followed by a unique number. You can immediately edit
the generated folder name and change it to something more appropriate.
The following Control menu item is available in the scenario tab page:
Execute Action
Execute the selected action. Only available when the connection to the simulator is active.
The following Tools menu items are available in the scenario tab page:
Commandline Script
Quickly enter an action script and execute it. Only available if there is a connection to a simu-
lator.
Convert Old Monitors
Convert all monitor actions in this scenario to a new MMI tab page. You are asked for the file
name of the new .mmi file, the caption for the new tab page and if you want to delete the old
monitors after conversion.
• Properties
• Activate
• Deactivate
• Execute Action
• Delete
• Cut
• Copy
• Paste
• Undo
• Redo
The other context menu appears when you click outside the tree area to the right of the last column or
below the last row (see Section 11.13.1 for a description of the menu items):
• New Recorder
• New Stimulus
• New Script
• New Folder
• Up
• Paste
• Undo
116
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• Redo
• Rearrange Icons
The window consists of several parts, each part corresponding to an element of an action, as described
in Section 11.2.2. In the first three parts, the following attributes can be entered:
Action name
This is the name of the action as it appears in the tree or icon view. It should be a unique name
within the current scenario.
Description
A description of the action.
c Dutch Space BV 117
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The next part of the window is a text entry area where the execution condition of the current action can be
specified. The execution condition is specified using the Mission Definition Language (see Appendix E).
The final part of the window is another text entry area in which the actual action script can be entered.
The Check script button can be used to check whether or not the entered MDL scripts are syntactically
correct.
The MDL Keywords button will pop up a small window with a list of all available MDL commands. With
the Add to Clipboard button (or by double clicking on a command) you can copy the command to the
clipboard and paste it in the Condition or Action text entry areas.
The Events button will show a window with all input connectors from the schedule. With the Add to
Clipboard button (or by double clicking on an events) you can copy the events to the clipboard and paste
it in the Condition or Action text entry areas. If no user defined input connectors are found, then this
button will not appear.
Any errors that are detected in the condition or action text will appear in the Errors area at the bottom of
the window.
The left hand side of the window contains a Dictionary Browser (see Section 11.5) that you can use to
drag and drop variables from the dictionary to the condition or action text areas. You can select more
than one variable and they will be inserted into the text as a list of variables, one per line.
Besides drag and drop you can also double click on a variable to add it at the current cursor position, or
use the Add Variable button to add all selected variable at the current cursor position.
118
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
It should not be necessary to check the Manual checkbox when building simple recorders. For more
complex recorders you could start with the Variables tab page, fill in all the fields, switch to the Script
tab page, check the Manual checkbox and then customize the condition and action.
In the Variables tab page, the following information can be entered to define a recording action.
Action name and Description
As for the script action attributes.
Recorder File
The name of the file in which the recorded variable values should be stored. The default file
name is actionname.rec.
Frequency, Start Time and End Time
The three attributes specify when the recording should start and stop, and with what sample rate
the variable values should be written to the file. Note: if UTC is selected times should entered
as YYYY-mm-dd HH:MM:SS[.sss], e.g. 2001-12-31 16:01:02.400.
Switch Per.
A switch time can be specified whether the recorder should switch periodically. This value is
given in units of seconds or hours. After each elapsed switch time the recorder actionname.rec
is closed and actionname-nnn.rec is opened (with switch counter nnn).
Below these attributes the Recorded Variable listbox is shown. If any variables were added from the
Dictionary Browser (see Section 11.5), they are shown here. Variables can be added using drag and drop,
by double clicking on a variable in the Dictionary Browser, or by selecting variables in the Dictionary
Browser and pressing the Add button to add them. To remove a variable from the list, select it, and press
the Remove button. You can change the order of the variables by selecting variables in the listbox and
using the Up and Down buttons.
The values of the variables in the list are recorded into the specified file at the specified frequency.
EuroSim automatically generates an MDL-script for this purpose, which can be viewed in the Script tab
page. If you want to use a non-numerical start or end time you can change the values manually in that
tab. For example, you can use a simulator variable as the end time.
c Dutch Space BV 119
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Stimulus File
This should be the name of the input file containing the stimulus data.4 You can use the Browse
button to select an input file.
Frequency, Start Time and End Time
The three attributes specify when the stimulus should start and stop, and with what sample rate
the variable values should be read from the file. Note: if UTC is selected times should entered
as YYYY-mm-dd HH:MM:SS[.sss], e.g. 2001-12-31 16:01:02.400.
Variables
If any variables were added from the Dictionary Browser (see Section 11.5), they are shown
here. Variables can be added using drag and drop, by double clicking on a variable in the
Dictionary Browser, or by selecting variables in the Dictionary Browser and pressing the Add
button to add them. To remove a variable from the list, select it, and press the Remove button.
You can change the order of the variables by selecting variables in the listbox and using the Up
and Down buttons.
Stimulus Variables
The variables you add to the Variables list must match with the variables from this list. This
list is extracted from the selected stimulus file. The variable types are shown in both lists and
in the Dictionary Browser. This makes it easier to find a match. If the Variables list is empty
4
Note that this action editor can only be used to make stimuli actions which read in data from an external source. To update
a variable using a function (e.g. to feed a sinusoidal value), this needs to be defined using a script Action Editor with e.g. varZ
= sin(varX).
120
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
when a stimulus file was selected, then the program tries to prefill the Variables list with correct
matches.
Mode This can either be set to soft, hard or cyclic. With the first option, the data in the stimulus file is
read in sequential order at the specified frequency, and the timestamps attached to the data are
ignored. With the second option, only those data from the file are used whose timestamp match
the current simulation time (or has the nearest elapsed time) when the data is requested. Data
between these points are ignored. With the third option the data in the stimulus file is read in
sequential order and after the last data point read, the stimulus file is reread from the beginning.
These stimuli data is applied in ‘soft’ manner.
simtime data
0.9 10
1.9 15
2.9 17
3.9 19
4.9 20
5.9 18
6.9 15
7.9 15
8.9 14
9.9 12
If the stimulus action is to update variable ‘Z’ at a frequency of 0.5 Hz, and the stimulation mode was set
to soft, then ‘Z’ would be updated as follows, i.e. every 2 seconds the next value is used from the file:
Simulation:
simtime Z
0 10
2 15
4 17
6 19
8 20
10 18
12 15
14 15
16 14
18 12
20 no more data
If the stimulus actions is to update variable ‘Z’ at a frequency of 0.5 Hz, and the stimulation mode was
set to hard, then ‘Z’ would be updated as follows, i.e. every 2 seconds the most ‘up-to-date’ value is used
from the file:
Simulation:
simtime Z
0 0
2 15
4 19
6 18
8 15
10 12
12 no more data
c Dutch Space BV 121
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
If the stimulus action is to update variable ‘Z’ at a frequency of 0.5 Hz, and the stimulation mode was
set to cyclic, then ‘Z’ would be updated as follows, i.e. every 2 seconds the next value is used from the
file, and when there is no more data, the data from the file is used again:
Simulation:
simtime Z
0 10
2 15
4 17
6 19
8 20
10 18
12 15
14 15
16 14
18 12
20 10 (start from the beginning)
22 15
etc.
122
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
When you select a monitor by clicking on the monitor window with the left mouse button a rectangle
with ‘grab handles’ appears. By clicking on the handles and moving the mouse around (keeping the left
mouse button pressed) you can resize the monitor. If you click inside the rectangle and move the mouse
around you can move the monitor to another place.
You can insert a new monitor by using the Insert:New Monitor menu item or by double clicking in the
MMI tab page. Double clicking on a monitor will open the Properties window where you can modify the
properties of that monitor.
You can insert a new plugin by using the Insert:New Plugin menu item. Double clicking on plugin
monitor will open the Properties window where you can modify the properties of that plugin.
You can insert a new action button by using the Insert:New Action Button menu item. Double clicking
on an action button will open the Properties window where you can modify the properties of that action
button.
c Dutch Space BV 123
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The following Insert menu items are available in the MMI tab page:
New Monitor
Create a new monitor. See Section 11.16.3 for more information.
New Plugin
Create a new plugin. See Section 11.15 for more information.
New Action Button
Create a new action button. See Section 11.16.4 for more information.
• Properties
• Copy to Desktop
• Delete
• Cut
• Copy
• Paste
• Undo
• Redo
The other context menu appears when you click directly on the tab page background (see Section 11.16.1
for a description of the menu items):
• New Monitor
• Paste
• Undo
• Redo
The latter two menu items, Activate MMI Tab Page and Deactivate MMI Tab Page, are short-cuts to the
Activate and Deactivate menu items that are available in the Edit menu of the Input Files tab page (see
Section 11.9.1).
124
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Style Select the style of the monitor. The following styles are available:
Alpha Numeric
Give a textual representation of the value of a variable.
Plot against Simulation Time
Use the value of the variable as the Y-axis value and the simulation time as the X-axis
value.
Plot against Wall Clock Time
Use the value of the variable as the Y-axis value and the wall clock time as the X-axis
value.
c Dutch Space BV 125
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
XY-Plot Use the value of the variable as the Y-axis value and the value of a designated other
variable as the X-axis value.
Depending on the style some of the other properties in the monitor editor become enabled or disabled.
For the Alpha Numeric style the Read Only checkbox in the variable properties area is only enabled if the
variable is an input variable and the Format combobox is only enabled if the variable is not a string. For
the plot styles all properties are enabled except for the Read Only checkbox and the Format combobox.
The X-Axis Variable combobox is only enabled when the XY-Plot style is selected.
The following properties are available when one of the plot styles is selected:
History This value indicates how many samples of each variable should be simultaneously displayed.
Once the maximum is reached, the older values will be discarded.
Manual scaling
This checkbox can be checked if the user wishes to specify the minimum and maximum values
for the axis.
Minimum
The minimum value for the corresponding axis.
Maximum
The minimum value for the corresponding axis.
Rotation
The rotation of the labels on the corresponding axis.
The following property is available when the XY-Plot style is selected:
X-Axis Variable
Select a variable from the Variables list that provides the X-Axis variable values.
126
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
255 %X FF
255 %08X 000000FF
255 0x%08X 0x000000FF
3.141592 %.2f 3.14
3000 %.2E 3.00E+03
Table 11.1: Examples of formatting and conversion.
A script action will now appear on the MMI tab as a button. Pressing the button when simulator is
running will execute the action. Recorders and stimuli appear as a checkbox. When checked the recorder
or stimulus is active, when unchecked it is not active. Toggling the checkbox will activate/deactivate the
recorder or stimulus. See Figure 11.22 for an example.
c Dutch Space BV 127
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
A new message tab can be created either by choosing Insert:New Message Tab menu item or by double
clicking on the empty space (to the right of the last message tab) in the Tab header. A dialog box to edit
the message tab properties appears (see Section 11.17.1).
Note: i) The message tab with title ”Default” is the default message tab. This title does not
appear if this is the only message tab.
ii) The default message tab cannot be edited or deleted. However, the messages can be
copied and cleared if necessary.
128
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Name Enter the name of the message tab (which appears in the tab header).
Message types
A list of all message types in the model, in the currently running simulation session and the
built-in EuroSim defined message types (message, warning, error and fatal). If a message type
appears in gray color it means either a simulator is currently disconnected (not running) or
that the message type is not defined in the currently running simulation session. Even if some
message types appear gray, they can be selected to create a message filter.
Inverse Check this check box to indicate that the selected message type messages should not be logged
in this message tab.
• Clear Log
c Dutch Space BV 129
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• Delete
• Undo
• Redo
130
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 12
The Test Analyzer can be used to create and display plots of the generated test results. It uses PV-
WAVE1 or gnuplot to display and print the plots. For most plots the user interface of the Test Analyzer
is sufficient, but it is also possible to send commands to the PV-WAVE or gnuplot back-end directly.
The purpose of this chapter is to provide a detailed reference of the Test Analyzer.
The first part of this chapter describes how to start and use the Test Analyzer (Section 12.1 - Section 12.2).
The second part can be used for reference (Section 12.4 - Section 12.7).
c Dutch Space BV 131
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Menu bar
For a detailed description of the menu items see Section 12.7.
Toolbar A description of the action the toolbar button performs is displayed if the mouse is left above
the button for a short period of time. The toolbar provides a shortcut to many often used menu
items like undo, redo, add plot, etc.
Plot view
The plot view holds the icons representing the plots that are defined.
Variable browser
The variable browser contains the variables found in the test results that are loaded. You can
use these variables to create or edit curves in the plots.
Plot properties
The plot properties pane contains three tabpages. The first page deals with the general plot
properties like plot title and description. The second page is dedicated to the curves of the plot
(curve editor). The third page is used to change axes related settings like scaling (linear/loga-
rithmic) and axis range.
Statusbar
The status bar displays the location of the currently loaded test results file on the right. The rest
of the statusbar is used to show short (status) messages.
132
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Figure 12.2: Importing plot definition files. Click on the “File type” combobox to switch between file
formats.
Next, browse to the plot definition file that needs to be imported and click on the OK button. A warning
message will appear stating that the pdf file will be converted. Press OK to convert the pdf file.
The Test Analyzer now contains the converted data. If you wish you can save the converted file with
File:Save or with File:Save As. . . in case you wish to save the file under a different name.
c Dutch Space BV 133
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Adding curves
Curves can be added to a plot in many ways. The easiest way is to use drag and drop. Select the variables
you would like to add as curves in the variable browser and drag them to the curve editor or on the desired
plot icon in the plot view. More information can be found in Section 12.4.2.
Changing curves
To change a curve or one of its properties, click on it in the curve editor. An edit field will appear
depending on where you clicked. For example, clicking the variable name in one of the curves axis will
show a selection box with the variables used (or recently used) in the plot.
A more detailed list of the possibilities can be found in Section 12.4.2
Removing curves
To remove a curve, select it in the curve editor and press the delete key, use the toolbar or menu (
Curve:Remove Curve).
Changing other plot settings
General plot settings can be changed on the “General” tab page of the plot properties area. This in-
cludes settings like plot title, description, legend position etc. A more detailed list can be found in
Section 12.4.1.
Settings related to the axes like scaling and range can be changed on the “Axes” tab page of the plot
properties area. Detailed information can be found in Section 12.4.3
It is possible to print to the printer or to print to file(s). Printing to the printer will print each plot on a
separate page, while printing to file will print each plot in a separate file.
134
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Plot title
The title of the plot is shown on the plot view as well as on the plot itself.
Plot description
This can be a more elaborate description of the plot and is shown on the plot.
Legend position
The legend is placed on the specified position.
Simulation time
The simulation used in the plot can be set to either all data or to a specified time range.
Grid To display a grid check the “Show grid” option. Optionally, a grid style can be entered. The
effect of the grid style depends on the back-end. In gnuplot for example, this influences the line
style of the grid.
Note that the apply button must be pressed after you have made your changes.
About curves
As shown in Figure 12.5, a variable or function must be specified for the X and Y in each curve2 .
Some of the fields in the curve editor can be edited by clicking them. For example, to change the line
style of a curve click on the last column of the curve’s row and type in the desired style.
2
This is different from previous versions of the Test Analyzer, where there could be only one x-axis variable or function in
a plot.
c Dutch Space BV 135
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Legend text
The legend text can be specified manually by typing in a legend text or it can be generated
automatically. In that case, one of these formats can be chosen:
• variable name
• variable path
• variable description
Line style
The effect of the line style depends on the back-end and the output media (screen or printer).
With gnuplot, for example, the decimals specify the linetype as specified in the gnuplot doc-
umentation and the hundredths specify the style. Up to nine gnuplot styles are supported.
Example: the value “100” will give you the gnuplot “points” style.
Variable
The axis variable can be changed in two ways. The drop-down list contains the recently used
variables in this plot and can be chosen the normal way. It is also possible to drag a variable
from the variable browser and drop it on the desired axis.
Axis The axis can be set to “Primary” or “Secondary”. The primary axis is on the left for X and at
the bottom for Y. The secondary axis is the right axis for X and the top axis for Y.
Adding curves
Curves can be added in many ways:
• Double click a variable in the variable browser. The selected variable is added as a curve. Initially,
the variable is plotted against simulation time so do not forget to change this if necessary.
• Drag the variables selected in the variable browser to an empty spot of the curve editor. If there is
a variable with “time” or “x” in its name it is used as the x-axis variable. The curves created are
all other variables plotted against this curve (or against the first variable if no such variable could
be found). This is probably the easiest method.
• Select Curves:Add Curve from the menu. The result is the same as dragging the selected
variables from the variable browser to the curve editor.
The axis properties that can be set include axis range, scale and label. “Automatic axis range” calculates
a default range from the data values. “Automatic axis label” creates a default label for the selected axis
based on the variable names.
136
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
The variable browser has two columns. The first column contains the variables, the second column
contains the variable descriptions.
• Large icons
• Small icons
• List
In small icons and list mode, the plot icon is small and the plot title is shown right of the icons instead of
below them.
The difference between small icons and list mode is the order of display. In small icons mode the icons
are ordered left to right while in list mode the icons are ordered top to bottom.
c Dutch Space BV 137
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Open. . .
Opens an existing .plt file. Can also be used to import old .pdf files.
Close Closes the current .plt file. Asks to save changes if there are unsaved changes.
Exit Exits the program. Asks to save changes if there are unsaved changes.
Redo
Redoes the last undone action if possible.
Cut Cuts the selected item from the document and places it on the clipboard.
Copy Copies the selected item from the document and places it on the clipboard.
Small icons
Toggles the plot view to small icon mode. The icons are smaller, the plot title is shown next to
the icon and icons are initially placed right to left.
138
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
List Toggles the plot view to list mode. The icons are small, the plot title is shown next to the icon
and icons are initially placed top to bottom.
New Plot
Creates a new, empty plot.
Delete Plot(s)
Deletes the plots selected on the plot view.
Show Plot(s)
Shows the plots selected on the plot view.
Close Plot Window
Closes an open plot window for the selected plot. If you are using gnuplot the plot window can
also be closed as usual. However, if you are using PV-WAVE you must close the plot window
this way.
Print. . .
Prints the selected plots.
c Dutch Space BV 139
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
By default, the function editor displays the variables already in use by the selected plot. If a variable is
required that is not yet listed, it suffices to drag and drop the variable from the variable browser onto the
function editor.
To add a user defined function, type it in the edit field below the list and press the add button. User
defined functions are added to the bottom of the list and are tagged as “func”. They can be edited by
clicking on the function. An edit field will then appear.
140
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
To use a function in a plot, drag and drop the function from the function editor to the desired axis of the
desired curve in the curve editor. It is also possible to click on the variable or function field of the desired
axis of the desired curve and then select the function from the list.
Note that unused functions and variables are removed between sessions. That is, if you save the .plt file
and load it again unused variables and functions are not longer listed.
Figure 12.12: The plot back-end interface window, showing PV-WAVE output.
c Dutch Space BV 141
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• sin($1)
• $1 ˆ 2
• $1 * exp(0.1)
• $1 + (3 * $2)
• !Dtor * $2
The last example shows the use of the PV-WAVE system variable “deg to rad”; this and other possibilities
are described in Section 12.10.2.
PV-WAVE has various operators and functions available, including the following:
• */+-ˆ
• !Dtor: Contains the conversion factor to convert degrees to radians. The value is pi/180, which is
approximately 0.0174533
• !Radeg: A floating-point value for converting radians to degrees. The value is 180/pi or approxi-
mately 57.2958
PV-WAVE Reference Volume 2 (Chapter 4): gives an overview of all the available system variables
(although the majority are concerned with plot appearances/defaults and are not relevant for function
definitions).
3
It is assumed that simulation_time is used for the x axis variable, but it could be some other variable of course.
142
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
info, V1
V1 DOUBLE = Array(307)
print, V1
0.0029616649 0.0059233298 0.0088849947 0.011846660
0.014808325 0.00092749497 0.0038891599 0.0068508248
0.0098124897 0.012774155 0.015670285 0.0018549899
.......
simtime = V1
temp1 = V2
temp2 = V5
temp3 = V6
tempTable = build_table("simtime, temp1, temp2, temp3")
Now, to select and display a subset of the data the following commands can be used:
subsetTable = query_table(tempTable,
" * Where simtime > 10.0 and simtime < 12.0")
print ,"time celltmp[1][1] celltmp[1][2] celltmp[1][3]"
for i=0, N_ELEMENTS(subsetTable)-1 do begin PRINT, subsetTable(i)
To export the selected data, and store it in a file (as ASCII), use the following command:
status = DC_WRITE_FIXED(‘table.dat’,subsetTable.simtime,
subsetTable.temp1,subsetTable.temp2,subsetTable.temp3,/Col )
c Dutch Space BV 143
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
xd = simtime
yd = temp1
n_sample = N_ELEMENTS(xd)
samp_rate = (n_sample-1)/(xd(n_sample-1) - xd(0))
x = FINDGEN(n_sample) - (n_sample/2.)
x_ind = WHERE(x GE 0)
x(x_ind) = x(x_ind)+1.
x_freq = x * samp_rate/ FLOAT(n_sample)
y_proc = ABS(FFT(yd, -1))
PLOT, x_freq, SHIFT(y_proc, n_sample/2.)
A FFT plot should then appear. Plots generated with the plot command can be removed again by using
the command wdelete,0 (for plot number 0)
Also, various statistical analysis functions are available through PV-WAVE. For example:
144
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Figure 12.13: The plot back-end interface window, showing gnuplot output.
• sin($1)
• log10($3)
• $1 * exp(0.1)
• $1 + (3 * $2)
The name of the file is shown in bold. The data can be accessed using gnuplot’s using command, as
shown in the plot command above. See the gnuplot documentation for more information.
c Dutch Space BV 145
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
146
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 13
13.1 Introduction
This chapter provides details on the batch utility for the perl scripting language1 . Various perl modules
have been created that provide an interface to existing EuroSim libraries. This means that a batch script
is no more than an ordinary perl script using EuroSim modules.
The main reason to choose perl as the batch utility engine is that it is the ultimate glue language. The
EuroSim modules can be combined with the built-in features of perl itself or with one of the many perl
modules which are freely available on the internet. A complete overview of all available perl modules
can be found on the Comprehensive Perl Archive Network (CPAN).
There is an interactive shell which can be used to type commands directly on the command line to start
and manipulate simulators. This tool has been implemented in perl using the EuroSim modules and a
few other helper modules for the command line interaction.
Section 13.2 describes the conversion utility for people using the event-probe tool. Section 13.3 shows
you how to use the interactive batch shell. Section 13.4 explains all EuroSim modules. Section 13.5
shows you how to extend the batch utility to integrate it in a larger system. Section 13.6 contains a
simple example script.
c Dutch Space BV 147
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
When you start a simulation in interactive mode (the default when starting esimsh) an xterm window is
started to show the journal messages.
$object->method($arg1, $arg2);
There is one module which forms an exception to this rule for convenience reasons when using the
interactive shell: EuroSim::Session. All functions (methods) can be called directly without the object
reference. This is done to reduce typing in the interactive shell. Each function uses the current session.
This works fine as long as you only have one session. If you want to manage multiple sessions in parallel
within one script you must use the full notation.
$s = new EuroSim::Session("some.sim");
$s->realtime(1);
$s->init;
This command will use the information defined in the simulation definition file to start the simulator.
The realtime flag results in a real-time run of the simulator.
As you can see you pass similar information to the function call as needed by the simulation controller.
In the simulation controller you open a simulation definition file and then you select whether or not
you want to run real-time. Then you hit the init button, which launches the simulator. The simulation
controller automatically connects to the simulator, just like the init function does. This function also
sets up a number of callback functions for incoming events. The information carried by each event is
stored in the session structure. The user can at any moment print the contents of this structure by calling
print_session_parameters.
To install a new handler for an event you call the function event_addhandler with the name of the event
you want to handle and the callback to call for that event. You can install more than one handler for each
event. Handlers are called in the order they were installed. The name of the event is the same as the name
of the enumeration identifier, e.g. rtExecuting. To remove the handler, call event_removehandler with
the same parameters.
Each callback receives the following parameters:
148
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Example:
sub cb_standby
{
my ($session, $event_name, $simtime_sec, $simtime_nsec,
$wallclock_sec, $wallclock_nsec) = @_;
print "going to standby at $wallclock_sec\n";
}
$session->event_addhandler("rtStandby", \&cb_standby);
It is possible to synchronously wait for an event you expect. In this case you call wait_event with the
name of the event (same name as used to install a handler) and an optional time-out.
To synchronously wait for some time to pass, you can call wait_time. This function takes the number
of seconds you want to wait as an argument.
A complete overview of all functions provided by this module can be found in the manual page Eu-
roSim::Session(3).
MDL Hash table of loaded MDL files. Each hash key is the name of a loaded MDL file. The hash value
is a EuroSim::MDL object. MDL files are loaded at start-up when a .sim file is loaded or during
run-time when extra MDL files are loaded. Extra files can be loaded by the built-in event handler
for event maNewMission or by manually adding MDL files with new_scenario.
clientname
The name under which this session is known to the simulator. The value is set with the function
clientname.
cwd Current working directory of the simulator. The value is set by the built-in event handler for
event maCurrentWorkingDir.
dict Data dictionary file name. The value is set by the built-in event handler for event
maCurrentDict.
eventlist
List of events present in the schedule. The value is set by the built-in event handler for the
following events: scEventListStart, scEventInfo, scEventListEnd. The eventlist is an
array of hash tables. Each table consists of three elements:
c Dutch Space BV 149
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
startup timeout
Simulation startup timeout. The default value is 5 seconds and it can be change with the function
startup_timeout.
initconds
Initial condition files. The value is set by the built-in event handler for event
maCurrentInitconds.
calibrations
Calibration files. The value is set by the event handler for event maCurrentCalibrations.
logwindow
EuroSim::Window object. Used to display simulation messages in interactive mode.
monitored vars
Table of monitored variables.
outputdir
Result directory used in current simulation run. The value is set by the built-in event handler
for event maCurrentResultDir.
schedule
Schedule file name. The value is defined in the simulation definition file.
speed The clock acceleration factor achieved by the simulator. Values larger than 1 indicate faster
than real-time. Values smaller than 1 indicate slower than real-time. The value is set by the
built-in event handler for event scSpeed.
state Simulator state. Can be: unconfigured, initialising, standby, executing, exiting. The value is
set by the built-in event handler for the following events: rtUnconfigured, rtInitialising,
rtStandby, rtExecuting and rtExiting.
stimulator bandwidth
Stimulator bandwidth in bytes/second. The value is set by the built-in event handler for event
maStimulatorBandwidth.
tasklist List of tasks present in the schedule. The value is set by the built-in event handlers for the events
scTaskListStart, scTaskStart, scTaskEntry, scTaskEnd and scTaskListend. The field
tasklist is a hash table. Each key in the hash table is the name of a task (e.g. $session->tasklist->taskname).
Each task consists of a number of entry points and a flag called disable. The disable flag is set
by the built-in event handler of scTaskDisable. The entry points are stored in an array. Each
array element is a hash table consisting of three fields:
150
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
trace Flag indicating that this entry point is being traced. The value is set by the built-in event handler
for event scSetTrc.
time mode
The time mode can be relative or absolute (UTC). Relative is 0 and absolute is 1. The value is
set by the built-in event handler for event maCurrentTimeMode.
alias Alias file used in current simulation run. The value is set by the built-in event handler of event
maCurrentAliasFile.
tsp map
TSP map file used in current simulation run. The value is set by the built-in event handler of
event maCurrentTSPMapFile.
user defined outputdir
User defined output directory path. This directory path overrides the default output directory
path. The value is set with the function outputdir.
wallclock time
The wallclock time (as seen by the running simulator). The value is set by the built-in event
handler for event dtHeartBeat.
wallclock boundary
The wallclock boundary time to be used for timed state transitions. If you add an integer number
of times the main cycle time to this value it will produce a valid state transition boundary time.
simtime boundary
The simulation time boundary to be used for timed state transitions. If you add an integer num-
ber of times the main cycle time to this value it will produce a valid state transition boundary
time.
main cycle
The main cycle time of the current schedule. It can be used to calculate valid boundary times
for timed state transitions.
watcher
Event::io object. Used to process incoming events.
where Current breakpoint. The value is set by the built-in event handlers for the following events:
scWhereListStart, scWhereEntry, scWhereListEnd. It is cleared by the following events:
scStepTsk and scContinue. The value is an array of value pairs stored in an array. The first
value in the array is the task name and the second is the entry number. For example:
write access
Flag to indicate whether this client is allowed to change variable values in the simulator. The
value is set by the built-in event handler for event maDenyWriteAccess.
c Dutch Space BV 151
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
A complete overview of all functions provided by this module can be found in the manual page Eu-
roSim::MDL(3).
152
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
2. Load one or more initial condition files into that data dictionary
This initial condition file can be used in a new simulation run, or it can be loaded into an already running
simulator. In order to load it into a running simulator, the simulator must be in standby state, or it can be
used for reinitialization.
A complete overview of all functions provided by this module can be found in the manual page Eu-
roSim::InitCond(3).
Example:
# load a data dictionary
$dict = EuroSim::Dict::open("test.dict");
c Dutch Space BV 153
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
13.6 Example
The following example is a complete script which performs one simulation run. Some event handlers are
installed as well as some monitors.
#!/usr/bin/perl
# This is an example perl script using the EuroSim bindings
# to automate a simulation run.
# Import all modules.
use EuroSim ’:all’;
use EuroSim::InitCond ’:all’;
use EuroSim::Session ’:all’;
use EuroSim::Link ’:all’;
use EuroSim::Conn ’:all’;
use EuroSim::MDL ’:all’;
# Set to real-time.
$s->realtime(1);
154
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
# Wait one second. This should be more than enough for the 2Hz
# update to take place.
$s->wait_time(1);
# Go to executing state.
$s->go;
c Dutch Space BV 155
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
13.7.1 efoList
The efoList command line utility shows a list of currently running simulators. See the ICD document or
the manual page efoList(1) for information on the command line options that can be passed to efoList.
13.7.2 efoKill
The efoKill command line utility lets you terminate a running simulator. See the ICD document or the
manual page efoKill(1) for information on the command line options that can be passed to efoKill.
156
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 14
14.1 Introduction
This chapter provides details on the batch utility for the java programming language. Various java classes
have been created that provide an interface to existing EuroSim libraries. This means that a batch appli-
cation is no more than an ordinary java application using EuroSim classes.
The java glue code is generated using SWIG. It is possible to generated wrapper code for multiple
scripting languages using the same interface definition. The python and TCL interfaces are generated in
the same manner.
The batch utility for java consists of various classes. Each class (or group of classes) is described in a
separate chapter. The most import classes are the Session and EventHandler classes.
Due to the fact that the classes are in fact wrapper classes around existing C++ code you have to load the
native code library explicitly. In order to use the EuroSim batch classes you have to add the following
code:
import nl.eurosim.batch.*;
// your code
}
c Dutch Space BV 157
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The constructor of the Session class uses the information in the simulation definition file to start the
simulator.
As you can see you pass similar information to these calls as needed by the simulation controller. In
the simulation controller you open a simulation definition file and then you can click on the Init button
which launches the simulator. The simulation controller automatically connects to the simulator, just
like the init method does. This function also sets up a number of standard event handlers for incoming
events (messages) from the simulator. The information is stored in the session class. The user can at any
moment print the contents of this structure by calling the print_session_parameters method.
To install a new event handler you have to create a derived class from the EventHandler class. The con-
structor of the class also installs the event handler so that it the event handler methods are automatically
called on each incoming event. To remove the event handlers call the remove method of the event handler
class. See Section 14.3 for detailed information on each event handler class method.
It is also possible to synchronously wait for an event you expect. In this case you call the wait_event
method with the name of the event (same name as the method in the event handler class) and an optional
time-out.
To synchronously wait for some time to pass, you can call wait_event with an empty string as the event
name.
public Session()
public Session(String sim)
public Session(String sim, String hostname)
Description
Creates a EuroSim simulation session by loading the given simulation definition file sim. The
simulation run will be started on the host with the given hostname or on the current host if not
specified.
Parameters
sim the simulation definition file name
hostname the name of the host on which to run the simulator
158
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
14.2.3.2 Methods
Return value
Simulator state
c Dutch Space BV 159
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Returns the path name of the exports file.
Return value
Path name of the exports file
Return value
Recorder bandwidth in bytes/second
160
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
Stimulator bandwidth in bytes/second
c Dutch Space BV 161
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
Main cycle in seconds.
162
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
The auto init flag, true if the state transition to initializing state is performed automatically,
false if it isn’t.
Automatic state transition to initializing is the default.
c Dutch Space BV 163
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
Initial condition files. If the simulation is running, then the value is set by the event handler for
event maCurrentInitconds.
164
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 165
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
event The name of the event to wait for. If the event name is empty this function can be used
to read all pending events while waiting for the given amount of time.
timeout ms The timeout in milliseconds. A value of -1 means that this this function will wait
until the event arrives for an unlimited amount of time. A value of 0 means that the function
will return immediately even if the event has not arrived yet.
Return value
true if the event had arrived, false if it has not.
166
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Return the session info for the session with the given index.
Parameters
idx The index in the session list.
Return value
The session info.
public String recorder action(String name, double freq, vector string vars)
c Dutch Space BV 167
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Create a recorder script.
Parameters
name The action name.
freq The recorder frequency.
vars A list of all variables to be recorded.
Return value
The fully composed recorder script.
168
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
The size of the list.
Parameters
idx The index in the current breakpoint list.
Return value
The breakpoint location.
c Dutch Space BV 169
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
The list of MDL files.
170
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Change the simulator state from stand-by to executing. Equivalent to the Go button of the test
controller. The variant specifying the time is used for timed state transitions. The wallclock
time is specified as sec seconds and nsec nanoseconds.
Parameters
sec Wallclock time (seconds)
nsec Wallclock time (nanoseconds)
Return value
1 on success, 0 on failure.
Description
Stop the simulation run. Equivalent to the Stop button of the test controller. The variant speci-
fying the time is used for timed state transitions. The wallclock time is secified as sec seconds
and nsec nanoseconds.
Parameters
sec Wallclock time (seconds)
nsec Wallclock time (nanoseconds)
Return value
1 on success, 0 on failure.
c Dutch Space BV 171
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
sec Wallclock time (seconds)
nsec Wallclock time (nanoseconds)
Return value
1 on success, 0 on failure.
172
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Create a new scenario in the simulator. This new scenario is only a container for new actions.
It is not a file on disk. It is a pure in core representation.
Parameters
scen The scenario name.
Return value
1 on success, 0 on failure.
c Dutch Space BV 173
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Trigger the execution of the action with name action in scenario with name scen. This is
equivalent to triggering an action manually on the scenario canvas of the Simulation Controller.
Parameters
scen The scenario file name.
action The action name.
Return value
1 on success, 0 on failure.
174
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Make a mark in the journal file. The comment string is optional. This is equivalent to the “Mark
Journal” and “Comment Journal Mark” menu options in the “Insert” menu of the Simulation
Controller.
Parameters
comment Comment string
Return value
1 on success, 0 on failure.
c Dutch Space BV 175
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
snapfile Path name of snapshot file.
hard “on” or “off”.
Return value
1 on success, 0 on failure.
176
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Enable/disable tracing of entry points. Entry points are defined by specifying the number of the
entry point entrynr (numbering starts at 0) and the name of the task taskname. To enable a trace
set enable to true, to disable it set it to false. Tracing an entry point means that messages are
printed to the journal window.
Parameters
taskname Name of the task.
entrynr Entry point number
enable true to enable, false to disable
Return value
1 on success, 0 on failure.
c Dutch Space BV 177
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
taskname Name of the task.
Return value
1 on success, 0 on failure.
178
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
1 on success, 0 on failure.
public int raise event(String eventname, SWIGTYPE p void data, int size)
public int raise event(String eventname)
Description
Raise event with name eventname in the scheduler. An event is defined by the input connector
on the scheduler canvas. The event is handled as fast as possible. Event data with a given size
can optionally be passed together with the event.
Parameters
eventname Name of the event
data Data
size Size of data in bytes.
Return value
1 on success, 0 on failure.
public int raise event at(String eventname, int sec, int nsec, SWIGTYPE p void
data, int size)
public int raise event at(String eventname, int sec, int nsec)
public int raise event at(String eventname, int sec)
Description
Raise event with name eventname in the schedler at a specified wallclock time. The wallclock
time is specified as sec seconds and nsec nanoseconds. Event data with a given size can option-
ally be passed together with the event.
Parameters
eventname Name of the event
sec Wallclock time in seconds.
nsec Wallclock time in nanoseconds.
data Data
size Size of data in bytes.
Return value
1 on success, 0 on failure.
public int raise event at simtime(String eventname, int sec, int nsec, SWIGTYPE
data, int size)
public int raise event at simtime(String eventname, int sec, int nsec)
public int raise event at simtime(String eventname, int sec)
c Dutch Space BV 179
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Raise event with name eventname in the schedler at a specified simulation time. The simula-
tion time is specified as sec seconds and nsec nanoseconds. Event data with a given size can
optionally be passed together with the event.
Parameters
eventname Name of the event
sec Simulation time (seconds)
nsec Simulation time (nanoseconds)
data Data
size Size of data in bytes.
Return value
1 on success, 0 on failure.
180
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
1 on success, 0 on failure
// constructor
public ExampleEventHandler(Session s)
{
super(s);
}
ExampleEventHandler eh;
c Dutch Space BV 181
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
public EventHandler(Session s)
Description
Construct a new EventHandler and install the handler.
Parameters
s The simulator session
14.3.1.2 Methods
182
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 183
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Inform the client that an action has been deleted.
Parameters
mission The name of the mission.
actionname The name of the action.
public void maExecuteCommand(String name, String command, int action mgr nr)
Description
Inform the client that a one shot action has been executed.
184
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Parameters
name The name of the action.
command The commands of the action.
action mgr nr The number of the action manager that has executed the action.
public void maMessage(int simtime sec, int simtime nsec, int runtime sec,
int runtime nsec, int sev, String process, String msg)
Description
Inform the client that a message has been generated in the simulator. This message is also
automatically logged in the journal file by the simulator.
Parameters
simtime sec Simulation time stamp (seconds part)
simtime nsec Simulation time stamp (nanoseconds part)
runtime sec Wallclock time stamp (seconds part)
runtime nsec Wallclock time stamp (nanoseconds part)
sev Severity of the message. The name of the severity can be retrieved by using the sev_to_string()
method of the Session class.
process Name of the simulator thread from where the message was generated.
msg The message text.
c Dutch Space BV 185
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
bandwidth Number of bytes per seconds written to disk.
186
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 187
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
188
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
entrynr The number of the entry point in the task (counting starts at 0).
enable The trace is enabled (true), or disabled (false).
c Dutch Space BV 189
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
190
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 191
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
public static int session kill by name(String simname, int signal, String
hostname)
public static int session kill by name(String simname, int signal)
public static int session kill by name(String simname)
Description
Kill a simulation session by name.
Parameters
simname The name of the session. This is normally the basename of the executable.
signal The signal to send to the session (default = SIGTERM)
hostname The name of the host where the session runs (default = localhost)
Return value
-1 if creating the connection with the EuroSim daemon on the host failed, 0 on success, other-
wise the result is the value of errno of the failed kill system call or EPERM if you do not have
the right permissions to kill the simulator or ESRCH if the simulator with the specified name
could not be found.
public static int session kill by pid(int pid, int signal, String hostname)
public static int session kill by pid(int pid, int signal)
public static int session kill by pid(int pid)
Description
Kill a simulation session by pid.
Parameters
pid The process id of the session.
signal The signal to send to the session (default = SIGTERM)
hostname The name of the host where the session runs (default = localhost)
Return value
-1 if creating the connection with the EuroSim daemon on the host failed, 0 on success, oth-
erwise the result is the value of errno of the failed kill system call or EPERM if you do not
have the right permissions to kill the simulator or ESRCH if the simulator with the specified
pid could not be found.
192
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 193
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
194
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Get the number of entry points of the task.
Return value
The number of entry points.
c Dutch Space BV 195
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
196
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Get the data dictionary file.
Return value
The path name of the data dictionary file.
c Dutch Space BV 197
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
The path name of the TSP map file.
198
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
14.11.1 Constructors
14.12.1 Constructors
c Dutch Space BV 199
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
200
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 201
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
14.13.1 Constructors
Parameters
Change the update frequency of the view.
frequency The update frequency in Hz.
Return value
0 is success, -1 is failure.
202
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 203
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
14.15.1 Constructors
public * get()
public * get(int idx0)
public * get(int idx0, int idx1)
public * get(int idx0, int idx1, int idx2)
Description
Get the value of a single variable or single array element. The variant without the idx* param-
eters is for a single variable, the others are for 1, 2 and 3 dimensional arrays.
Parameters
idx0 Index in first dimension.
idx1 Index in second dimension.
idx2 Index in third dimension.
Return value
The value of the variable. The type of the return value depends on the type of the function. The
type mapping is listed above in the introduction.
204
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 205
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
206
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 15
15.1 Introduction
This chapter provides details on the batch utility for the python scripting language. Various python
classes have been created that provide an interface to existing EuroSim libraries. This means that a batch
application is no more than an ordinary python script using EuroSim classes.
The python glue code is generated using SWIG. It is possible to generated wrapper code for multiple
scripting languages using the same interface definition. The Java and TCL interfaces are generated in the
same manner.
The batch utility for python consists of various classes. Each class (or group of classes) is described in a
separate chapter. The most import classes are the Session and EventHandler classes.
The constructor of the Session class uses the information in the simulation definition file to start the
simulator.
As you can see you pass similar information to these calls as needed by the simulation controller. In
the simulation controller you open a simulation definition file and then you can click on the Init button
which launches the simulator. The simulation controller automatically connects to the simulator, just
like the init method does. This function also sets up a number of standard event handlers for incoming
events (messages) from the simulator. The information is stored in the session class. The user can at any
moment print the contents of this structure by calling the print_session_parameters method.
To install a new event handler you have to create a derived class from the EventHandler class. The con-
structor of the class also installs the event handler so that it the event handler methods are automatically
called on each incoming event. To remove an event handler, just delete the created event handler object.
See Section 15.3 for detailed information on each event handler class method.
It is also possible to synchronously wait for an event you expect. In this case you call the wait_event
method with the name of the event (same name as the method in the event handler class) and an optional
time-out.
c Dutch Space BV 207
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
To synchronously wait for some time to pass, you can call wait_event with an empty string as the event
name.
Session([sim[, hostname]])
Description
Creates a EuroSim simulation session by loading the given simulation definition file sim. The
simulation run will be started on the host with the given hostname or on the current host if not
specified.
Parameters
sim the simulation definition file name
hostname the name of the host on which to run the simulator
15.2.3.2 Methods
cwd()
Description
Returns the path name of the current working directory of the simulator. The value is set by the
event handler for event maCurrentWorkingDir.
Return value
Path name of the current working directory
dict()
Description
Returns the path name of the EuroSim data dictionary of the simulator. The value is set by the
event handler for event maCurrentDict.
Return value
Path name of the EuroSim data dictionary
208
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
outputdir()
Description
Returns the path name of the directory where the output files of the simulator are stored (journal
file, recorder files, etc.) The value is set by the event handler for event maCurrentResultDir.
Return value
Path name of the output directory
state()
Description
Returns the simulator state. Can be: unconfigured, initialising, stand-by, executing, exiting. The
value is set by the event handler for the following events: rtUnconfigured, rtInitialising,
rtStandby, rtExecuting and rtExiting.
Return value
Simulator state
journal()
Description
Returns the path name of the journal file.
Return value
Path name of the journal file
schedule()
Description
Returns the path name of the schedule file.
Return value
Path name of the schedule file
exports()
Description
Returns the path name of the exports file.
Return value
Path name of the exports file
alias([alias])
Description
Set or get the alias file name.
Parameters
alias Override the alias file specified in the SIM file. If alias was not specified, then the alias
file remains unchanged.
Return value
Path name of the alias file. If the simulation is running, then the value is set by the event handler
for event maCurrentAliasFile.
c Dutch Space BV 209
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Set or get the TSP map file name.
Parameters
tsp map Override the TSP map file specified in the SIM file. If tsp map was not specified, then
the TSP map file remains unchanged.
Return value
Path name of the TSP map file. If the simulation is running, then the value is set by the event
handler for event maCurrentTSPMapFile.
model()
Description
Returns the path name of the model file.
Return value
Path name of the model file
recording bandwidth()
Description
Returns the recorder bandwidth in bytes/second. The value is set by the event handler for event
maRecordingBandwidth.
Return value
Recorder bandwidth in bytes/second
stimulator bandwidth()
Description
Returns the stimulator bandwidth in bytes/second. The value is set by the event handler for
event maStimulatorBandwidth.
Return value
Stimulator bandwidth in bytes/second
speed()
Description
Returns the clock acceleration factor achieved by the simulator. Values larger than 1 indicate
faster than real-time. Values smaller than 1 indicate slower than real-time. The value is set by
the event handler for event scSpeed.
Return value
Acceleration factor
sim time()
Description
Returns the simulation time (as seen by the running simulator). The value is set by the event
handler for event dtHeartBeat.
Return value
Simulation time in seconds
wallclock time()
210
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Returns the wallclock time (as seen by the running simulator). The value is set by the event
handler for event dtHeartBeat.
Return value
Wallclock time in seconds
wallclock boundary()
Description
Returns the wallclock boundary time to be used for timed state transitions. If you add an
integer number of times the main cycle time to this value it will produce a valid state transition
boundary time.
Return value
Wallclock time boundary in seconds
simtime boundary()
Description
Returns the simulation time boundary to be used for timed state transitions. If you add an
integer number of times the main cycle time to this value it will produce a valid state transition
boundary time.
Return value
Simulation time boundary in seconds
main cycle()
Description
Returns the main cycle time of the current schedule. It can be used to calculate valid boundary
times for timed state transitions.
Return value
Main cycle in seconds.
recording()
Description
Returns the flag indicating that recording is enabled or not. True means enabled, false means
disabled. The value is set by the event handler for event maRecording.
Return value
Recording is enabled
write access()
Description
Returns the flag to indicate whether this client is allowed to change variable values in the sim-
ulator. The value is set by the event handler for event maDenyWriteAccess.
Return value
Client is allowed to change variables
time mode()
c Dutch Space BV 211
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Returns the time mode. It can be relative or absolute (UTC). Relative is 0 and absolute is 1.
The value is set by the event handler for event maCurrentTimeMode.
Return value
Time mode
realtime([realtime])
Description
Set or get the realtime mode.
Parameters
realtime If the realtime mode is not specified, then the realtime mode is not set. If realtime is
0, then realtime mode is disabled, otherwise it is enabled. The new setting will not effect
an already running simulation.
Return value
The realtime mode, true for realtime, false for non-realtime. If a simulation is running, then the
value as was set by the event handler for event scGoRT is reported. Non-realtime is the default.
prefcon([prefcon])
Description
Set or get the preferred connection.
Parameters
prefcon The preferred connection. This can be used in a situation where you need to reconnect
to an already running simulator. To start new simulation runs, this number is not used. If
prefcon was not specified, then the preferred connection is not set.
Return value
Return the connection number of the current simulation session.
startup timeout([timeout])
Description
Set or get the startup timeout.
The startup timeout default is 5 seconds. If starting up a simulator takes longer than this you
must change that default to a higher value.
If timeout was not specified, then the startup timeout is not set.
212
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Parameters
timeout The startup timeout.
Return value
Return the startup timeout in seconds of the current simulation session.
clientname([clientname])
Description
Set or get the name under which this session is known to the simulator.
Parameters
clientname The client name of the current simulation session. The default is “esimbatch”. If
clientname was not specified, then the client name is not changed.
Return value
Return the client name of the current simulation session.
initconds([initconds])
Description
Set or get the initial condition files.
Parameters
initconds Override the initial condition files specified in the SIM file. If initconds was not
specified, then the initial condition files remain unchanged.
Return value
Initial condition files. If the simulation is running, then the value is set by the event handler for
event maCurrentInitconds.
calibrations([calibrations])
Description
Set or get the calibration files.
Parameters
calibrations Override the calibration files specified in the SIM file. If calibrations was not
specified, then the calibration files remain unchanged.
Return value
Calibration files. If the simulation is running, then the value is set by the event handler for event
maCurrentCalibrations.
workdir([workdir])
Description
Set or get the work directory.
Parameters
workdir Use this directory as the work or project directory instead of the current directory.
Return value
The work directory.
c Dutch Space BV 213
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
outputdir Use this output directory instead of the default date/time directory. If not set, then
the user defined output directory is not changed.
Return value
The user defined output directory.
hostname([hostname])
Description
Set or get the EuroSim server hostname.
Parameters
hostname Use this EuroSim server. If not set, then the hostname is not changed.
Return value
The EuroSim server hostname.
sim([sim[, hostname]])
Description
Set or get the simulation definition file.
This simulation definition file is used to start the simulator. Information derived from the sim-
ulation definition file is used to provide sensible defaults for all parameters.
Parameters
sim The simulation definition file. If not set, then the simulation definition is not changed.
hostname The EuroSim server hostname. If not set, then the local host is used instead.
Return value
The filename of the simulation definition file.
init()
Description
Start a new simulation run.
Return value
1 on success, 0 on failure.
join channel(channel)
Description
Join a channel of a simulation session. By default each session connects to all channels. The
following channels are available: mdlAndActions, data-monitor, rt-control, sched-control. To
join all channels use channel “all”.
Parameters
channel The channel to join.
Return value
1 on success, 0 on failure.
leave channel(channel)
Description
Leave a channel of a simulation channel.
214
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Parameters
channel The channel that you want to leave.
Return value
1 on success, 0 on failure.
monitor add(var)
Description
Monitor a variable.
The value of the variable is updated with 2 Hz.
Parameters
var The variable from the data dictionary that you want to monitor.
Return value
1 on success, 0 on failure.
monitor value(var)
Description
Retrieve the value of a monitored variable
Parameters
var The name of the monitored variable.
Return value
the value of the variable
monitor remove(var)
Description
Remove the monitor of a variable.
Parameters
var The variable from the data dictionary that should be removed from the monitor list.
Return value
1 on success, 0 on failure.
c Dutch Space BV 215
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Create a list of all sessions and return the size of that list.
Parameters
hostname If set, then report the sessions running on that host. Otherwise report all sessions
running on the subnet.
Return value
the number of sessions.
session list(idx)
Description
Return the session info for the session with the given index.
Parameters
idx The index in the session list.
Return value
A SessionInfo object.
esim connect()
Description
Connect to a running simulation; a new journal file is opened.
Return value
1 on success, 0 on failure.
esim disconnect()
Description
Disconnect from the simulation session. The simulator will continue to run in the background.
216
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Parameters
name The action name.
script The action script.
condition The optional condition.
Return value
The fully composed action script.
event list(idx)
Description
Return the event info of the event with the given index.
The value is set by the event handler for the following events: scEventListStart, scEventInfo,
scEventListEnd.
Parameters
idx The index in the event list (the first element has index 0).
c Dutch Space BV 217
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
An EventInfo object.
Return value
The size of the list.
where list(idx)
Description
Return the current breakpoint with the given index.
The value is set by the event handlers for the following events: scWhereListStart, scWhereEntry,
scWhereListEnd. It is cleared by the following events: scStepTsk and scContinue.
Parameters
idx The index in the current breakpoint list.
Return value
A WhereInfo object describing the break point location.
task list(idx)
Description
Return the task info for the task with the given index.
The value is set by the event handler for events scTaskListStart, scTaskStart, scTaskEntry,
scTaskEnd and scTaskListend. Each task consists of a number of entry points and a flag called
disable. The disable flag is set by the event handler of scTaskDisable.
Parameters
idx The index in the task list.
Return value
A TaskInfo object.
218
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Parameters
taskname The name of the task.
Return value
The index in the task list.
mdl list()
Description
Return a list of all loaded MDL files.
MDL files are loaded at start-up when a .sim file is loaded or during run-time when extra MDL
files are loaded. Extra files can be loaded by the event handler for event maNewMission or by
manually adding MDL files with new scenario.
Return value
The list of MDL files.
action list(mdl)
Description
Return a list with the names of all the actions.
Parameters
mdl The name of the MDL file.
Return value
The list of action names.
monitored vars()
Description
Return a list of all monitored variables.
Return value
The list of variables.
sev to string(sev)
Description
Return a string respresentation of a message severity
c Dutch Space BV 219
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
sev Message severity
Return value
String representation of severity
go([sec[, nsec]])
Description
Change the simulator state from stand-by to executing. Equivalent to the Go button of the test
controller. The variant specifying the time is used for timed state transitions. The wallclock
time is specified as sec seconds and nsec nanoseconds.
Parameters
sec Wallclock time (seconds)
nsec Wallclock time (nanoseconds)
Return value
1 on success, 0 on failure.
stop([sec[, nsec]])
Description
Stop the simulation run. Equivalent to the Stop button of the test controller. The variant speci-
fying the time is used for timed state transitions. The wallclock time is secified as sec seconds
and nsec nanoseconds.
Parameters
sec Wallclock time (seconds)
nsec Wallclock time (nanoseconds)
Return value
1 on success, 0 on failure.
pause([sec[, nsec]])
Description
Change the simulator state from executing to stand-by. Equivalent to the Pause button of the
test controller. The variant specifying the time is used for timed state transitions. The wallclock
time is secified as sec seconds and nsec nanoseconds.
Parameters
sec Wallclock time (seconds)
nsec Wallclock time (nanoseconds)
Return value
1 on success, 0 on failure.
freeze([sec[, nsec]])
Description
Change the simulator state from executing to stand-by. Equivalent to the Pause button of the
test controller. The variant specifying the time is used for timed state transitions. The wallclock
time is secified as sec seconds and nsec nanoseconds.
Parameters
sec Wallclock time (seconds)
nsec Wallclock time (nanoseconds)
220
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
1 on success, 0 on failure.
step()
Description
Perform one main scheduler cycle. Equivalent to the Step button of the test controller.
Return value
1 on success, 0 on failure.
abort()
Description
Abort the current simulation run. Equivalent to the Abort button of the test controller.
Return value
1 on success, 0 on failure.
health()
Description
Request a health check of the running simulator. Prints health information to the test controller.
Return value
1 on success, 0 on failure.
reset sim()
Description
Restart the current simulation with the current settings. Equivalent to the Reset button of the
test controller.
Return value
1 on success, 0 on failure.
new scenario()
Description
Create a new scenario in the simulator. This new scenario is only a container for new actions.
It is not a file on disk. It is a pure in core representation.
Parameters
scen The scenario name.
c Dutch Space BV 221
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
1 on success, 0 on failure.
open scenario(scen)
Description
Open a new scenario file in the simulator with file name scen. The file must be on disk and
readable.
Parameters
scen Scenario file name.
Return value
1 on success, 0 on failure.
close scenario(scen)
Description
Close a currently opened scenario with name scen in the simulator.
Parameters
scen Scenario file name.
Return value
1 on success, 0 on failure.
222
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
snapshot([filename[, comment]])
Description
Make a snapshot of the current state of the variables in the data dictionary. The comment string
is optional. If you omit the filename, a filename is chosen of the form snapshot simtime.snap.
The snapshot is saved in the output directory, unless the filename is absolute. This is equivalent
to the “Take Snaphot...” menu option in the “Control” menu of the test controller.
Parameters
filename Path name of the snapshot file.
comment Comment string
Return value
1 on success, 0 on failure.
mark([comment])
Description
Make a mark in the journal file. The comment string is optional. This is equivalent to the “Mark
Journal” and “Comment Journal Mark” menu options in the “Insert” menu of the Simulation
Controller.
Parameters
comment Comment string
Return value
1 on success, 0 on failure.
c Dutch Space BV 223
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
sim message(msg)
Description
Send a message to the simulator for distribution to all clients. This is useful if your client
application is not the only client of the simulator. The message is broadcasted to all clients.
Parameters
msg Message string
Return value
1 on success, 0 on failure.
suspend recording()
Description
Suspend recording in the simulator. This is equivalent to unchecking the “Enable Recordings”
menu item of the “Control” menu of the Simulation Controller.
Return value
1 on success, 0 on failure.
resume recording()
Description
Resume recording in the simulator. This is equivalent to checking the “Enable Recordings”
menu item of the “Control” menu of the Simulation Controller.
Return value
1 on success, 0 on failure.
recording switch()
Description
Switch all recording files of a simulation run. All currently open recorder files are closed and
new recorder files are created. Recording will continue in the new recorder files.
Return value
1 on success, 0 on failure.
reload(snapfile[, hard])
Description
Load initial condition file or snapshot file with file name snapfile into the running simulator.
Parameter hard is by default “off”. This means that the simulation time stored in the snapshot
file is ignored. If hard is set to “on”, the simulation time is set to the value specified in the
snapshot file.
Parameters
snapfile Path name of snapshot file.
hard “on” or “off”.
Return value
1 on success, 0 on failure.
224
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Set the value of a variable.
Parameters
var The data dictionary path name of variable you want to change.
value The new value.
Return value
1 on success, 0 on failure.
get value(var)
Description
Get the value of a variable.
Parameters
var The data dictionary path name of the variable
Return value
The value, empty on failure
c Dutch Space BV 225
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
where()
Description
Request the current position when the scheduler has stopped on a break point. The reply to the
message is automatically stored and can be retrieved by using where list. Normally the position
is sent to the client whenever the scheduler hits a breakpoint. So there is rarely any need to
request the position manually if you store the position on the client side (as is done in this tool.)
Return value
1 on success, 0 on failure.
step task()
Description
Perform one step (=one entry point) in the scheduler debugger.
Return value
1 on success, 0 on failure.
cont()
Description
Continue executing upto the next breakpoint in the scheduler debugger.
Return value
1 on success, 0 on failure.
task disable(taskname)
Description
Disable task with name taskname in the current schedule of the simulator.
Parameters
taskname Name of the task.
Return value
1 on success, 0 on failure.
task enable(taskname)
Description
Enable task with name taskname in the current schedule of the simulator.
Parameters
taskname Name of the task.
Return value
1 on success, 0 on failure.
clear breaks()
Description
Remove all breakpoints in the current schedule of the simulator.
226
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
1 on success, 0 on failure.
clear traces()
Description
Remove all traces in the current schedule of the simulator.
Return value
1 on success, 0 on failure.
enable realtime()
Description
Switch to real-time mode. This can only be done when the simulator has started off in real-time
mode, and has switched to non-real-time mode.
Return value
1 on success, 0 on failure.
disable realtime()
Description
Switch to non-real-time mode.
Return value
1 on success, 0 on failure.
list tasks()
Description
Request a list of all tasks in the current schedule of the simulator. The list is also sent automat-
ically upon joining the “sched-control” channel.
Return value
1 on success, 0 on failure.
list events()
Description
Request a list of all events in the schedule of the simulator in all states. The list is automatically
sent to the client when subscribing to the “sched-control” channel at start-up.
Return value
1 on success, 0 on failure.
c Dutch Space BV 227
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
set speed(speed)
228
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Set the acceleration/deceleration of the scheduler of the simulator. Values smaller than 1 will
cause a proportional deceleration of the scheduler clock. Values larger than 1 will cause a
proportional acceleration of the scheduler clock. Magical value -1 means that the scheduler
will run in an optimized as-fast-as-possible mode.
Parameters
speed acceleration factor
Return value
1 on success, 0 on failure.
add MDL(mdlname)
Description
Load (another) new MDL file in the session.
Parameters
mdlname Path name of the MDL file.
Return value
1 on success, 0 on failure.
sync send(token)
Description
Send sync token to simulator
Parameters
token synchronization token id
Return value
1 on success, 0 on failure
sync recv(token)
Description
Wait for sync token from simulator
Parameters
token synchronization token id
Return value
1 on success, 0 on failure
kill([signal])
Description
Kill the simulator with signal signal. By default the simulator is killed with SIGTERM.
Parameters
signal Signal to send to the simulator
Return value
1 on success, 0 on failure
c Dutch Space BV 229
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
# constructor
def __init__(self, session):
eurosim.EventHandler.__init__(self, session)
EventHandler(s)
Description
Construct a new EventHandler and install the handler.
Parameters
s The simulator session
15.3.1.2 Methods
session()
Description
Return the session for this event handler.
Return value
The Session object of the simulator session.
maOpenMission(mission)
230
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
A mission (MDL) file is opened.
Parameters
mission The filename of the mission file.
maCloseMission(mission)
Description
A mission (MDL) file is closed.
Parameters
mission The filename of the mission file.
maSimDef(simdef)
Description
Inform that client which simulation definition file is currently loaded.
Parameters
simdef The filename of the simulation definition file.
Return value
maCurrentDict(dict)
Description
Inform the client which data dictionary file is currently loaded.
Parameters
dict The filename of the data dictionary file.
Return value
maCurrentWorkingDir(cwd)
Description
Inform the client what the current working directory of the simulator is.
Parameters
cwd The path name of the current working directory.
maCurrentResultDir(result dir)
Description
Inform the client what the result directory is. The result directory contains all the journal files,
recorder files, snapshots and timings file.
Parameters
result dir The path name of the result directory.
maCurrentAliasFile(filename)
Description
Inform the client what the alias file is. The alias file contains the data dictionary aliases.
c Dutch Space BV 231
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
filename The path name of the alias file.
maCurrentTSPMapFile(filename)
Description
Inform the client what the TSP map file is. The TSP map file contains the TSP data dictionary
path name map.
Parameters
filename The path name of the TSP map file.
maNewAction(mission, actiontext)
Description
Inform the client that a new action has been created.
Parameters
mission The name of the mission.
actiontext The new action.
maDeleteAction(mission, actionname)
Description
Inform the client that an action has been deleted.
Parameters
mission The name of the mission.
actionname The name of the action.
maActionExecute(mission, actionname)
Description
Inform the client that an action is being executed.
Parameters
mission The name of the mission.
actionname The name of the action.
maActionExecuteStop(mission, actionname)
Description
Inform the client that an action is no longer being executed.
Parameters
mission The name of the mission.
actionname The name of the action.
maActionExecuting(mission, actionname)
Description
Inform a newly connected client that the action is currently executing.
Parameters
mission The name of the mission.
actionname The name of the action.
232
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
maActionActivate(mission, actionname)
Description
Inform the client that an action has been activated. I.e. is allowed to execute.
Parameters
mission The name of the mission.
actionname The name of the action.
maActionDeActivate(mission, actionname)
Description
Inform the client that an action has been deactivated. I.e. is no longer allowed to execute.
Parameters
mission The name of the mission.
actionname The name of the action.
maSnapshot(snapshot, comment)
Description
Handle maSnapshot event. This event is sent after a snapshot of the current simulator state has
been made.
Parameters
snapshot Path name of the snapshot file.
comment Comment describing the snapshot.
maMark(message, marknumber)
Description
Inform the client that a mark has been made in the journal file.
Parameters
message The descriptive message of the mark.
marknumber The number of the mark.
maMessage(simtime sec, simtime nsec, runtime sec, runtime nsec, sev, process,
msg)
Description
Inform the client that a message has been generated in the simulator. This message is also
automatically logged in the journal file by the simulator.
Parameters
simtime sec Simulation time stamp (seconds part)
c Dutch Space BV 233
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
maRecording(on off)
Description
Inform the client that recording has been globally enabled/disabled.
Parameters
on off If the string is equal to “on”, recording is enabled. If it is “off” it is disabled.
maRecordingBandwidth(bandwidth)
Description
Report the bandwidth used to record data to disk.
Parameters
bandwidth Number of bytes per seconds written to disk.
maStimulatorBandwidth(bandwidth)
Description
Report the bandwidth used to read data from disk for stimulation.
Parameters
bandwidth Number of bytes per second read from disk.
maRecorderFileClosed(filename)
Description
Inform the client that a recorder file has been closed and can be used for further processing.
Parameters
filename The file name of the recorder file.
maDenyWriteAccess(denied)
Description
Inform the client that the write access to variables is denied. This is the case if the client has
the role of observer.
Parameters
denied Flag to indicate denial of write access to the simulator variables.
maCurrentInitconds(simdef, initconds)
Description
Inform the client of the current list of initial conditions as used for the initialization of the
simulator.
234
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Parameters
simdef The name of the simulation definition file.
initconds The list of initial condition files (space separated).
maCurrentCalibrations(simdef, calibrations)
Description
Inform the client of the current list of calibration definition files as used by the simulator.
Parameters
simdef The name of the simulation definition file.
calibrations The list of calibration files (space separated).
maCurrentTimeMode(time mode)
Description
Inform the client of the current time mode. The time mode can be relative time or absolute time
(UTC mode).
Parameters
time mode The time mode, 0 is relative time mode, 1 is absolute time mode (UTC mode).
rtUnconfigured()
Description
Inform the client that the state of the simulator is unconfigured. This state means that the
simulator is either still starting up, or is in its final clean up phase. This is a transient state.
When starting up, the next state will be Initialising. When cleaning up the last event will be
evShutdown.
rtInitialising()
Description
Inform the client that the state of the simulator is initialising. Depending on the schedule
definition, this state will automatically be followed by the standby state. Otherwise you have
to manually change the state to standby using the eventStandby() method of the Session()
class.
rtStandby()
Description
Inform the client that the state of the simulator is standby.
rtExecuting()
c Dutch Space BV 235
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Inform the client that the state of the simulator is executing.
rtExiting()
Description
Inform the client that the state of the simulator is exiting. This is a transient state. The next
state will be the unconfigured state.
rtTimeToNextState(sec, nsec)
Description
Report the time to the next state transition. This is useful when the major cycle is quite long
(more than a couple of seconds). This can be the case if the schedule definition contains a clock
with a very low frequency or when the lowest common denominator of the clocks results in a
long major cycle.
Parameters
sec Time to next state (seconds part)
nsec Time to next state (nanoseconds part)
rtMainCycle(sec, nsec)
Description
Report the length of the main cycle of the schedule.
Parameters
sec Main cycle (seconds part)
nsec Main cycle (nanoseconds part)
scStepTsk()
Description
Inform the client that a step to the next task has been performed in debugging mode.
scContinue()
Description
Inform the client that the execution is now continued after being stopped on a break point in
debugging mode.
scGoRT(enable)
236
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Inform the client that the real-time mode has changed.
Parameters
enable Real-time mode is enabled (true) or disabled (false).
scTaskDisable(taskname, disable)
Description
Inform the client that a task has been disabled. This means that the task is no longer executed.
Parameters
taskname The name of the task.
disable The task is disabled (true), or enabled again (false).
scSpeed(speed)
Description
Report the speed of the scheduler clock. This is only relevant in non-real-time mode when
going slower or faster than real time.
Parameters
speed Speed factor. 1 means real-time, less than 1 means slower than real-time, more than 1
means faster than real-time. E.g. 2 means two times faster than real-time.
scTaskListStart()
Description
Start the description of the list of tasks.
scTaskStart(taskname, enabled)
Description
Start the description of a task. This is followed by a number of scTaskEntry events, one for
each entry in the order of execution in the task.
Parameters
taskname The name of the task
enabled The task is enabled (true), or disabled (false).
c Dutch Space BV 237
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
entryname The name of the entry point.
breakpoint The entry point has a break point set (true) or not set (false).
trace The entry point is traced (true) or not (false).
scTaskEnd()
Description
Report the end of the task information.
scTaskListEnd()
Description
Report the end of the list of tasks.
scEventListStart()
Description
Report the start of the list of schedule events.
scEventListEnd()
Description
Report the end of the list of events.
scWhereListStart()
Description
Report the start of the list of places where the scheduler has stopped execution when reaching a
break point. As there are possibly more than 1 executers executing tasks, there can be multiple
places where the execution has stopped.
scWhereEntry(taskname, entrynr)
Description
Report a location where the execution has stopped.
Parameters
taskname The name of the task.
entrynr The number of the entry point (counting starts at 0).
scWhereListEnd()
238
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
End of the list of locations where the execution has stopped.
scEntrypointSetEnabled(entrypointname, enabled)
Description
Report the enabling or disabling of the execution of an entry point. The execution of the entry
point is disabled for all tasks and also when executing the entry point from MDL scripts.
Parameters
entrypointname The name of the entry point.
enabled Whether the entry point is enabled for execution (true), or disabled (false).
dtLogValueUpdate(var, value)
Description
Report an updated value for a logged variable.
Parameters
var The name of the variable.
value The value of the variable.
dtHeartBeat()
Description
This event is sent at 2 Hz by default and indicates that the simulator is still alive. It is also the
last event sent after a series of dtLogValueUpdate events.
evLinkData(link id)
Description
Event that is used internally to transmit (TM/TC) packets. The actual data of the packet is not
passed to this callback function. It is stored internally and can be retrieved using the read()
method of the TmTcLink class.
Parameters
link id The symbolic name of the link.
evExtSetData(view id)
Description
Event that is used internally to update External Simulator Access views. The actual data of the
event is not passed to this callback function. It is decoded and stored in the view variables and
can be retrieved with the get() method of the ExtSimVar* classes.
c Dutch Space BV 239
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
view id The symbolic name of the view.
evEventDisconnect()
Description
Event that is received when the connection with the simulator is closed. This is normally done
using the method esim_disconnect().
host list()
Description
Return the list of EuroSim hosts.
Return value
The list of hosts.
240
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
name()
Description
Get the name of the event.
Return value
The name of the event
state()
Description
Get the number of the state where this event is defined.
Return value
The number of the state.
state name()
Description
Get the name of the state where this event is defined.
Return value
The name of the state.
is standard()
Description
Whether the event is a standard event or a user defined event.
Return value
true if it is a standard event, false if it is a user defined event.
c Dutch Space BV 241
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
name()
Description
Get the name of the task where the scheduler is currently stopped.
Return value
The task name.
entrynr()
Description
Get the entry point number of the current break point within the task.
Return value
The entry point number. Counting starts at 0.
name()
Description
Get the name of the entry point.
Return value
The name of the entry point.
breakpoint()
Description
Get the break point status of the entry point.
Return value
True if a break point is set, false if not.
trace()
Description
Get the trace status of the entry point.
Return value
True if a trace is set, false if not.
242
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
name()
Description
Get the name of the task.
Return value
The name of the task.
disabled()
Description
Get the disabled state of the task.
Return value
True if the task is disabled, false if it is enabled.
entry list(idx)
Description
Get the entry point information of the entry point with the given index.
Parameters
idx The entry point index (counting starts at 0).
Return value
An EntryInfo object describing the entry point information.
name()
Description
Get the name of the message.
Return value
The name of the message.
args()
Description
Get the argument types of the message. This is a character coded string with one character for
each argument type.
c Dutch Space BV 243
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
The argument types.
argdescr()
Description
Get a description of the arguments of the message.
Return value
The description of the arguments.
id()
Description
Get the numerical identifier of the message.
Return value
The numerical identifier.
sim hostname()
Description
Get the host name running the simulation session.
Return value
The host name.
sim()
Description
Get the simulation definition file.
Return value
The file name of the simulation definition file.
workdir()
Description
Get the working directory.
Return value
The path name of the working directory.
simulator()
Description
Get the simulator executable.
Return value
The path name of the executable.
244
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
schedule()
Description
Get the simulator schedule.
Return value
The path name of the schedule file.
scenarios()
Description
Get the list of scenario (MDL) files.
Return value
The list with path names of the MDL files.
dict()
Description
Get the data dictionary file.
Return value
The path name of the data dictionary file.
model()
Description
Get the model file.
Return value
The path name of the model file.
recorderdir()
Description
Get the recorder directory.
Return value
The path name of the recorder directory.
initconds()
Description
Get the list of initial condition files.
Return value
The list of path names of the initial condition files.
calibrations()
Description
Get the list of calibration files.
Return value
The list of path names of the calibration files.
exports()
c Dutch Space BV 245
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Get the exports file.
Return value
The path name of the exports file.
alias()
Description
Get the alias file.
Return value
The path name of the alias file.
tsp map()
Description
Get the TSP map file.
Return value
The path name of the TSP map file.
timestamp()
Description
Get the time stamp.
Return value
The time stamp.
prefcon()
Description
Get the connection number. Each session has a connection number that can be used to connect
a client to that session.
Return value
The connection number.
uid()
Description
Get the UNIX user id of the user who started the simulator.
Return value
The user id.
gid()
Description
Get the UNIX group id of the user who started the simulator.
Return value
The group id.
pid()
246
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Get the UNIX process id of the simulation session.
Return value
The process id.
realtime()
Description
Get the real-time state of the simulation session.
Return value
True if the simulator was started in real-time mode, false if it was started in non-real-time mode.
15.11.1 Constructors
TmTcLink(id, mode)
Description
Open one end of a TmTc link.
Parameters
id The symbolic name of the TmTc link.
mode Mode is “r”, “w” or “rw”, similar to the modes of the fopen() function in the standard C
library.
connect(s)
Description
Connect the link to the other end in a running simulator.
Parameters
s The Session object of the running simulator.
Return value
-1 on failure, 0 on success.
write(data)
Description
Write a packet to the link.
Parameters
data The data (binary string).
Return value
The number of bytes sent or -1 on failure.
read()
Description
Read data from the link.
Return value
The data read as a binary string.
c Dutch Space BV 247
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
15.12.1 Constructors
InitCond(filename, dictfile)
Description
Create a new set of initial conditions from an existing file.
Parameters
filename The initial condition file.
dictfile The path of the data dictionary file.
add(filename)
Description
Merge an existing initial condition file with the current initial condition data.
Parameters
filename The path of the to-be-merged initial condition file.
Return value
true on success, false on failure.
write(filename, binary)
Description
Write the initial condition data to a file.
Parameters
filename The path of the new initial condition file.
binary If true, write a binary file, otherwise write the data in human readable (ASCII) format.
Return value
true on success, false on failure.
simtime()
Description
Return the simulation time of the initial condition file.
Return value
The simulation time.
comment()
Description
Get the comment of in the initial condition file.
Return value
The comment string.
248
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 249
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
list([path])
Description
Get a list of child node names beneath a parent node.
Parameters
path The path of the parent node (default the root “/”).
Return value
The list of child node names.
15.13.1 Constructors
ExtSimView(session, id)
Description
Create a new External Simulator Access view.
Parameters
session The Session object of the simulation session.
id The symbolic identifier of the view.
add(var)
Description
Add a variable to this view.
Parameters
var An ExtSimVar object of the variable to add to the view.
Return value
0 on success, -1 on failure.
250
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
0 is success, -1 is failure.
change freq(frequency)
Description
Parameters
Change the update frequency of the view.
send()
Description
Send the view with the updated values to the simulator.
Return value
0 is success, -1 is failure.
type()
Description
Get the variable type.
Return value
The variable type.
is array()
Description
Find out if the variable is an array variable.
Return value
true if it is an array.
is fortran()
Description
Find out if the variable is a Fortran variable. Only relevant for arrays, as the Fortran column/row
order is different from C/Ada.
Return value
true if it is a Fortran variable.
nof dims()
c Dutch Space BV 251
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Get the number of dimensions of the array variable.
Return value
The number of array dimensions.
dims()
Description
Get the dimensions of the array variable.
Return value
The array dimensions.
path()
Description
Get the data dictionary path of the variable.
Return value
The data dictionary path.
size()
Description
Get the size in bytes of the variable.
Return value
The size in bytes.
15.15.1 Constructors
ExtSimVar*(path)
ExtSimVar*Array(path, dim0[, dim1[, dim2]])
ExtSimVar*FortranArray(path, dim0[, dim1[, dim2]])
Description
Create a new variable to be used in an ExtSimView.
Parameters
path The data dictionary path
dim0 The size of the first dimension.
dim1 The size of the second dimension.
dim2 The size of the third dimension.
252
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 253
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
254
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 16
16.1 Introduction
This chapter provides details on the batch utility for the TCL scripting language. Various TCL objects
have been created that provide an interface to existing EuroSim libraries. This means that a batch appli-
cation is no more than an ordinary TCL script using EuroSim objects.
The TCL glue code is generated using SWIG. It is possible to generated wrapper code for multiple
scripting languages using the same interface definition. The Java and Python interfaces are generated in
the same manner.
The batch utility for TCL consists of various objects. Each object (or group of objects) is described in a
separate chapter. The most import object is the Session class.
The constructor of the Session class uses the information in the simulation definition file to start the
simulator.
As you can see you pass similar information to these calls as needed by the simulation controller. In
the simulation controller you open a simulation definition file and then you can click on the Init button
which launches the simulator. The simulation controller automatically connects to the simulator, just
like the init method does. This function also sets up a number of standard event handlers for incoming
events (messages) from the simulator. The information is stored in the session class. The user can at any
moment print the contents of this structure by calling the print_session_parameters method.
To install a new event handler you have to add an event handler callback procedure. See Section 16.3.
It is also possible to synchronously wait for an event you expect. In this case you call the wait_event
method with the name of the event (same name as the method in the event handler class) and an optional
time-out.
To synchronously wait for some time to pass, you can call wait_event with an empty string as the event
name.
c Dutch Space BV 255
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
16.2.3.2 Methods
cwd
Description
Returns the path name of the current working directory of the simulator. The value is set by the
event handler for event maCurrentWorkingDir.
Return value
Path name of the current working directory
dict
Description
Returns the path name of the EuroSim data dictionary of the simulator. The value is set by the
event handler for event maCurrentDict.
Return value
Path name of the EuroSim data dictionary
outputdir
256
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Returns the path name of the directory where the output files of the simulator are stored (journal
file, recorder files, etc.) The value is set by the event handler for event maCurrentResultDir.
Return value
Path name of the output directory
state
Description
Returns the simulator state. Can be: unconfigured, initialising, stand-by, executing, exiting. The
value is set by the event handler for the following events: rtUnconfigured, rtInitialising,
rtStandby, rtExecuting and rtExiting.
Return value
Simulator state
journal
Description
Returns the path name of the journal file.
Return value
Path name of the journal file
schedule
Description
Returns the path name of the schedule file.
Return value
Path name of the schedule file
exports
Description
Returns the path name of the exports file.
Return value
Path name of the exports file
alias ?alias?
Description
Set or get the alias file name.
Parameters
alias Override the alias file specified in the SIM file. If alias was not specified, then the alias
file remains unchanged.
Return value
Path name of the alias file. If the simulation is running, then the value is set by the event handler
for event maCurrentAliasFile.
c Dutch Space BV 257
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
tsp map Override the TSP map file specified in the SIM file. If tsp map was not specified, then
the TSP map file remains unchanged.
Return value
Path name of the TSP map file. If the simulation is running, then the value is set by the event
handler for event maCurrentTSPmapFile.
model
Description
Returns the path name of the model file.
Return value
Path name of the model file
recording bandwidth
Description
Returns the recorder bandwidth in bytes/second. The value is set by the event handler for event
maRecordingBandwidth.
Return value
Recorder bandwidth in bytes/second
stimulator bandwidth
Description
Returns the stimulator bandwidth in bytes/second. The value is set by the event handler for
event maStimulatorBandwidth.
Return value
Stimulator bandwidth in bytes/second
speed
Description
Returns the clock acceleration factor achieved by the simulator. Values larger than 1 indicate
faster than real-time. Values smaller than 1 indicate slower than real-time. The value is set by
the event handler for event scSpeed.
Return value
Acceleration factor
sim time
Description
Returns the simulation time (as seen by the running simulator). The value is set by the event
handler for event dtHeartBeat.
Return value
Simulation time in seconds
wallclock time
Description
Returns the wallclock time (as seen by the running simulator). The value is set by the event
handler for event dtHeartBeat.
258
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
Wallclock time in seconds
wallclock boundary
Description
Returns the wallclock boundary time to be used for timed state transitions. If you add an
integer number of times the main cycle time to this value it will produce a valid state transition
boundary time.
Return value
Wallclock time boundary in seconds
simtime boundary
Description
Returns the simulation time boundary to be used for timed state transitions. If you add an
integer number of times the main cycle time to this value it will produce a valid state transition
boundary time.
Return value
Simulation time boundary in seconds
main cycle
Description
Returns the main cycle time of the current schedule. It can be used to calculate valid boundary
times for timed state transitions.
Return value
Main cycle in seconds.
recording
Description
Returns the flag indicating that recording is enabled or not. True means enabled, false means
disabled. The value is set by the event handler for event maRecording.
Return value
Recording is enabled
write access
Description
Returns the flag to indicate whether this client is allowed to change variable values in the sim-
ulator. The value is set by the event handler for event maDenyWriteAccess.
Return value
Client is allowed to change variables
time mode
Description
Returns the time mode. It can be relative or absolute (UTC). Relative is 0 and absolute is 1.
The value is set by the event handler for event maCurrentTimeMode.
c Dutch Space BV 259
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
Time mode
realtime
Description
Set or get the realtime mode.
Parameters
realtime If the realtime mode is not specified, then the realtime mode is not set. If realtime is
0, then realtime mode is disabled, otherwise it is enabled. The new setting will not effect
an already running simulation.
Return value
The realtime mode, true for realtime, false for non-realtime. If a simulation is running, then the
value as was set by the event handler for event scGoRT is reported. Non-realtime is the default.
prefcon ?prefcon?
Description
Set or get the preferred connection.
Parameters
prefcon The preferred connection. This can be used in a situation where you need to reconnect
to an already running simulator. To start new simulation runs, this number is not used. If
prefcon was not specified, then the preferred connection is not set.
Return value
Return the connection number of the current simulation session.
260
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
Return the startup timeout in seconds of the current simulation session.
clientname ?clientname?
Description
Set or get the name under which this session is known to the simulator.
Parameters
clientname The client name of the current simulation session. The default is “esimbatch”. If
clientname was not specified, then the client name is not changed.
Return value
Return the client name of the current simulation session.
initconds ?initconds?
Description
Set or get the initial condition files.
Parameters
initconds Override the initial condition files specified in the SIM file. If initconds was not
specified, then the initial condition files remain unchanged.
Return value
Initial condition files. If the simulation is running, then the value is set by the event handler for
event maCurrentInitconds.
calibrations ?calibrations?
Description
Set or get the calibration files.
Parameters
calibrations Override the calibration files specified in the SIM file. If calibrations was not
specified, then the calibration files remain unchanged.
Return value
Calibration files. If the simulation is running, then the value is set by the event handler for event
maCurrentCalibrations.
workdir ?workdir?
Description
Set or get the work directory.
Parameters
workdir Use this directory as the work or project directory instead of the current directory.
Return value
The work directory.
c Dutch Space BV 261
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
The user defined output directory.
hostname ?hostname?
Description
Set or get the EuroSim server hostname.
Parameters
hostname Use this EuroSim server. If not set, then the hostname is not changed.
Return value
The EuroSim server hostname.
init
Description
Start a new simulation run.
Return value
1 on success, 0 on failure.
262
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 263
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Retrieve the value of a monitored variable
Parameters
var The name of the monitored variable.
Return value
the value of the variable
esim connect
Description
Connect to a running simulation; a new journal file is opened.
Return value
1 on success, 0 on failure.
esim disconnect
Description
Disconnect from the simulation session. The simulator will continue to run in the background.
264
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Print a list of currently monitored variables and their current values. All variables in active
monitors send values to the batch tool. A table with all variables is kept with their current
values.
c Dutch Space BV 265
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
The fully composed stimulus script.
Parameters
idx The index in the current breakpoint list.
Return value
A WhereInfo object describing the break point location.
266
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
The size of the task list.
mdl list
Description
Return a list of all loaded MDL files.
MDL files are loaded at start-up when a .sim file is loaded or during run-time when extra MDL
files are loaded. Extra files can be loaded by the event handler for event maNewMission or by
manually adding MDL files with new scenario.
Return value
The list of MDL files.
monitored vars
Description
Return a list of all monitored variables.
Return value
The list of variables.
c Dutch Space BV 267
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Return the size of the event messages table.
Return value
The number of event messages.
go ?sec nsec?
Description
Change the simulator state from stand-by to executing. Equivalent to the Go button of the test
controller. The variant specifying the time is used for timed state transitions. The wallclock
time is specified as sec seconds and nsec nanoseconds.
Parameters
sec Wallclock time (seconds)
nsec Wallclock time (nanoseconds)
Return value
1 on success, 0 on failure.
268
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Change the simulator state from executing to stand-by. Equivalent to the Pause button of the
test controller. The variant specifying the time is used for timed state transitions. The wallclock
time is secified as sec seconds and nsec nanoseconds.
Parameters
sec Wallclock time (seconds)
nsec Wallclock time (nanoseconds)
Return value
1 on success, 0 on failure.
step
Description
Perform one main scheduler cycle. Equivalent to the Step button of the test controller.
Return value
1 on success, 0 on failure.
abort
Description
Abort the current simulation run. Equivalent to the Abort button of the test controller.
Return value
1 on success, 0 on failure.
health
Description
Request a health check of the running simulator. Prints health information to the test controller.
c Dutch Space BV 269
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
1 on success, 0 on failure.
reset sim
Description
Restart the current simulation with the current settings. Equivalent to the Reset button of the
test controller.
Return value
1 on success, 0 on failure.
270
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 271
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
filename Path name of the snapshot file.
comment Comment string
Return value
1 on success, 0 on failure.
mark ?comment?
Description
Make a mark in the journal file. The comment string is optional. This is equivalent to the “Mark
Journal” and “Comment Journal Mark” menu options in the “Insert” menu of the Simulation
Controller.
Parameters
comment Comment string
Return value
1 on success, 0 on failure.
suspend recording
Description
Suspend recording in the simulator. This is equivalent to unchecking the “Enable Recordings”
menu item of the “Control” menu of the Simulation Controller.
Return value
1 on success, 0 on failure.
resume recording
Description
Resume recording in the simulator. This is equivalent to checking the “Enable Recordings”
menu item of the “Control” menu of the Simulation Controller.
Return value
1 on success, 0 on failure.
recording switch
Description
Switch all recording files of a simulation run. All currently open recorder files are closed and
new recorder files are created. Recording will continue in the new recorder files.
Return value
1 on success, 0 on failure.
272
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 273
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
where
Description
Request the current position when the scheduler has stopped on a break point. The reply to the
message is automatically stored and can be retrieved by using where list. Normally the position
is sent to the client whenever the scheduler hits a breakpoint. So there is rarely any need to
request the position manually if you store the position on the client side (as is done in this tool.)
Return value
1 on success, 0 on failure.
step task
Description
Perform one step (=one entry point) in the scheduler debugger.
Return value
1 on success, 0 on failure.
cont
Description
Continue executing upto the next breakpoint in the scheduler debugger.
Return value
1 on success, 0 on failure.
274
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
1 on success, 0 on failure.
clear breaks
Description
Remove all breakpoints in the current schedule of the simulator.
Return value
1 on success, 0 on failure.
clear traces
Description
Remove all traces in the current schedule of the simulator.
Return value
1 on success, 0 on failure.
enable realtime
Description
Switch to real-time mode. This can only be done when the simulator has started off in real-time
mode, and has switched to non-real-time mode.
Return value
1 on success, 0 on failure.
disable realtime
Description
Switch to non-real-time mode.
Return value
1 on success, 0 on failure.
c Dutch Space BV 275
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
list tasks
Description
Request a list of all tasks in the current schedule of the simulator. The list is also sent automat-
ically upon joining the “sched-control” channel.
Return value
1 on success, 0 on failure.
list events
Description
Request a list of all events in the schedule of the simulator in all states. The list is automatically
sent to the client when subscribing to the “sched-control” channel at start-up.
Return value
1 on success, 0 on failure.
276
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Parameters
eventname Name of the event
sec Simulation time (seconds)
nsec Simulation time (nanoseconds)
data Data
size Size of data in bytes.
Return value
1 on success, 0 on failure.
kill ?signal?
c Dutch Space BV 277
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Kill the simulator with signal signal. By default the simulator is killed with SIGTERM.
Parameters
signal Signal to send to the simulator
Return value
1 on success, 0 on failure
Each message type has a specific set of arguments apart from an initial set of standard arguments. The
specific arguments are described in the next section. The initial set of standard arguments are:
session The Session object.
maNewMission mission
Description
A new mission (MDL) is created.
Parameters
mission The name of the mission.
maOpenMission mission
Description
A mission (MDL) file is opened.
Parameters
mission The filename of the mission file.
maCloseMission mission
278
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
A mission (MDL) file is closed.
Parameters
mission The filename of the mission file.
maSimDef simdef
Description
Inform that client which simulation definition file is currently loaded.
Parameters
simdef The filename of the simulation definition file.
Return value
maCurrentDict dict
Description
Inform the client which data dictionary file is currently loaded.
Parameters
dict The filename of the data dictionary file.
Return value
maCurrentWorkingDir cwd
Description
Inform the client what the current working directory of the simulator is.
Parameters
cwd The path name of the current working directory.
maCurrentAliasFile filename
Description
Inform the client what the alias file is. The alias file contains the data dictionary aliases.
Parameters
filename The path name of the alias file.
maCurrentTSPMapFile filename
Description
Inform the client what the TSP map file is. The TSP map file contains the TSP data dictionary
path name map.
c Dutch Space BV 279
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
filename The path name of the TSP map file.
280
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
maRecording on off
Description
Inform the client that recording has been globally enabled/disabled.
c Dutch Space BV 281
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
on off If the string is equal to “on”, recording is enabled. If it is “off” it is disabled.
maRecordingBandwidth bandwidth
Description
Report the bandwidth used to record data to disk.
Parameters
bandwidth Number of bytes per seconds written to disk.
maStimulatorBandwidth bandwidth
Description
Report the bandwidth used to read data from disk for stimulation.
Parameters
bandwidth Number of bytes per second read from disk.
maRecorderFileClosed filename
Description
Inform the client that a recorder file has been closed and can be used for further processing.
Parameters
filename The file name of the recorder file.
maDenyWriteAccess denied
Description
Inform the client that the write access to variables is denied. This is the case if the client has
the role of observer.
Parameters
denied Flag to indicate denial of write access to the simulator variables.
282
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Inform the client of the current time mode. The time mode can be relative time or absolute time
(UTC mode).
Parameters
time mode The time mode, 0 is relative time mode, 1 is absolute time mode (UTC mode).
rtUnconfigured
Description
Inform the client that the state of the simulator is unconfigured. This state means that the
simulator is either still starting up, or is in its final clean up phase. This is a transient state.
When starting up, the next state will be Initialising. When cleaning up the last event will be
evShutdown.
rtInitialising
Description
Inform the client that the state of the simulator is initialising. Depending on the schedule
definition, this state will automatically be followed by the standby state. Otherwise you have
to manually change the state to standby using the eventStandby() method of the Session()
class.
rtStandby
Description
Inform the client that the state of the simulator is standby.
rtExecuting
Description
Inform the client that the state of the simulator is executing.
rtExiting
Description
Inform the client that the state of the simulator is exiting. This is a transient state. The next
state will be the unconfigured state.
c Dutch Space BV 283
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Parameters
sec Time to next state (seconds part)
nsec Time to next state (nanoseconds part)
scStepTsk
Description
Inform the client that a step to the next task has been performed in debugging mode.
scContinue
Description
Inform the client that the execution is now continued after being stopped on a break point in
debugging mode.
scGoRT enable
Description
Inform the client that the real-time mode has changed.
Parameters
enable Real-time mode is enabled (true) or disabled (false).
284
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Inform the client that a trace has been set on an entry point in a task.
Parameters
taskname The name of the task.
entrynr The number of the entry point in the task (counting starts at 0).
enable The trace is enabled (true), or disabled (false).
scSpeed speed
Description
Report the speed of the scheduler clock. This is only relevant in non-real-time mode when
going slower or faster than real time.
Parameters
speed Speed factor. 1 means real-time, less than 1 means slower than real-time, more than 1
means faster than real-time. E.g. 2 means two times faster than real-time.
scTaskListStart
Description
Start the description of the list of tasks.
scTaskEnd
Description
Report the end of the task information.
scTaskListEnd
Description
Report the end of the list of tasks.
scEventListStart
c Dutch Space BV 285
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Report the start of the list of schedule events.
scEventListEnd
Description
Report the end of the list of events.
scWhereListStart
Description
Report the start of the list of places where the scheduler has stopped execution when reaching a
break point. As there are possibly more than 1 executers executing tasks, there can be multiple
places where the execution has stopped.
scWhereListEnd
Description
End of the list of locations where the execution has stopped.
286
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Parameters
var The name of the variable.
value The value of the variable.
dtHeartBeat
Description
This event is sent at 2 Hz by default and indicates that the simulator is still alive. It is also the
last event sent after a series of dtLogValueUpdate events.
evLinkData link id
Description
Event that is used internally to transmit (TM/TC) packets. The actual data of the packet is not
passed to this callback function. It is stored internally and can be retrieved using the read()
method of the TmTcLink class.
Parameters
link id The symbolic name of the link.
evExtSetData view id
Description
Event that is used internally to update External Simulator Access views. The actual data of the
event is not passed to this callback function. It is decoded and stored in the view variables and
can be retrieved with the get() method of the ExtSimVar* classes.
Parameters
view id The symbolic name of the view.
evEventDisconnect
Description
Event that is received when the connection with the simulator is closed. This is normally done
using the method esim_disconnect().
c Dutch Space BV 287
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
host list
Description
Return the list of EuroSim hosts.
Return value
The list of hosts.
288
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
name
Description
Get the name of the event.
Return value
The name of the event
state
Description
Get the number of the state where this event is defined.
Return value
The number of the state.
state name
Description
Get the name of the state where this event is defined.
Return value
The name of the state.
is standard
Description
Whether the event is a standard event or a user defined event.
Return value
true if it is a standard event, false if it is a user defined event.
name
Description
Get the name of the task where the scheduler is currently stopped.
Return value
The task name.
entrynr
Description
Get the entry point number of the current break point within the task.
Return value
The entry point number. Counting starts at 0.
c Dutch Space BV 289
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
name
Description
Get the name of the entry point.
Return value
The name of the entry point.
breakpoint
Description
Get the break point status of the entry point.
Return value
True if a break point is set, false if not.
trace
Description
Get the trace status of the entry point.
Return value
True if a trace is set, false if not.
name
Description
Get the name of the task.
Return value
The name of the task.
disabled
Description
Get the disabled state of the task.
Return value
True if the task is disabled, false if it is enabled.
290
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
The number of entry points.
name
Description
Get the name of the message.
Return value
The name of the message.
args
Description
Get the argument types of the message. This is a character coded string with one character for
each argument type.
Return value
The argument types.
argdescr
Description
Get a description of the arguments of the message.
Return value
The description of the arguments.
id
Description
Get the numerical identifier of the message.
Return value
The numerical identifier.
c Dutch Space BV 291
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
sim hostname
Description
Get the host name running the simulation session.
Return value
The host name.
sim
Description
Get the simulation definition file.
Return value
The file name of the simulation definition file.
workdir
Description
Get the working directory.
Return value
The path name of the working directory.
simulator
Description
Get the simulator executable.
Return value
The path name of the executable.
schedule
Description
Get the simulator schedule.
Return value
The path name of the schedule file.
scenarios
Description
Get the list of scenario (MDL) files.
Return value
The list with path names of the MDL files.
dict
Description
Get the data dictionary file.
Return value
The path name of the data dictionary file.
model
292
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Get the model file.
Return value
The path name of the model file.
recorderdir
Description
Get the recorder directory.
Return value
The path name of the recorder directory.
initconds
Description
Get the list of initial condition files.
Return value
The list of path names of the initial condition files.
calibrations
Description
Get the list of calibration files.
Return value
The list of path names of the calibration files.
exports
Description
Get the exports file.
Return value
The path name of the exports file.
alias
Description
Get the alias file.
Return value
The path name of the alias file.
tsp map
Description
Get the TSP map file.
Return value
The path name of the TSP map file.
timestamp
Description
Get the time stamp.
c Dutch Space BV 293
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Return value
The time stamp.
prefcon
Description
Get the connection number. Each session has a connection number that can be used to connect
a client to that session.
Return value
The connection number.
uid
Description
Get the UNIX user id of the user who started the simulator.
Return value
The user id.
gid
Description
Get the UNIX group id of the user who started the simulator.
Return value
The group id.
pid
Description
Get the UNIX process id of the simulation session.
Return value
The process id.
realtime
Description
Get the real-time state of the simulation session.
Return value
True if the simulator was started in real-time mode, false if it was started in non-real-time mode.
16.11.1 Constructors
294
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
connect s
Description
Connect the link to the other end in a running simulator.
Parameters
s The Session object of the running simulator.
Return value
-1 on failure, 0 on success.
write data
Description
Write a packet to the link.
Parameters
data The data (binary string).
Return value
The number of bytes sent or -1 on failure.
read
Description
Read data from the link.
Return value
The data read as a binary string.
16.12.1 Constructors
c Dutch Space BV 295
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
add filename
Description
Merge an existing initial condition file with the current initial condition data.
Parameters
filename The path of the to-be-merged initial condition file.
Return value
true on success, false on failure.
simtime
Description
Return the simulation time of the initial condition file.
Return value
The simulation time.
comment
Description
Get the comment of in the initial condition file.
Return value
The comment string.
296
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Description
Get the numerical value of a variable.
Parameters
path The data dictionary path.
Return value
The numerical value of the variable.
list ?path?
Description
Get a list of child node names beneath a parent node.
Parameters
path The path of the parent node (default the root “/”).
Return value
The list of child node names.
c Dutch Space BV 297
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
16.13.1 Constructors
add var
Description
Add a variable to this view.
Parameters
var An ExtSimVar object of the variable to add to the view.
Return value
0 on success, -1 on failure.
Parameters
Change the update frequency of the view.
298
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
send
Description
Send the view with the updated values to the simulator.
Return value
0 is success, -1 is failure.
type
Description
Get the variable type.
Return value
The variable type.
is array
Description
Find out if the variable is an array variable.
Return value
true if it is an array.
is fortran
Description
Find out if the variable is a Fortran variable. Only relevant for arrays, as the Fortran column/row
order is different from C/Ada.
Return value
true if it is a Fortran variable.
nof dims
Description
Get the number of dimensions of the array variable.
Return value
The number of array dimensions.
dims
Description
Get the dimensions of the array variable.
Return value
The array dimensions.
path
c Dutch Space BV 299
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Description
Get the data dictionary path of the variable.
Return value
The data dictionary path.
size
Description
Get the size in bytes of the variable.
Return value
The size in bytes.
16.15.1 Constructors
300
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Return value
The value of the variable. The type of the return value depends on the type of the function. The
type mapping is listed above in the introduction.
c Dutch Space BV 301
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
302
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 17
17.1 Introduction
The purpose of the Simulation Model Portability SMP standard is to promote portability of models among
different simulation environments and re-use of simulation models.
EuroSim complies to the SMP standard by offering the complete SMPAPI and by easily importing existing
models into the EuroSim tooling. Information on using the SMP functions can be found in the handbook
[SMP03].
• void ManagerPublishInterfaces(void)
• void ManagerInitialise(void)
The first function is responsible for publishing the interfaces of the models. It calls the publish functions
for all the models it manages. The second function is responsible for the initialisation of the models.
The user has to enable the Simulation Model Portability support option in the Model Editor build options
dialog.
c Dutch Space BV 303
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Figure 17.1: Model Editor Build Options dialog box with SMP support enabled.
After this the user only has to run the Build All command to compile the model source into a runnable
simulator. The command also generates a schedule file from the SMP scheduling functions called during
the initialization function. This file can be edited by the EuroSim schedule editor. The generated file
is placed in the directory where all generated files are placed. This directory is derived from the model
file name and is called model.OS, where OS can be IRIX 64, IRIX, Linux or WINNT. This directory and
its contents are removed when the user runs the Cleanup command. It is therefore wise to save the file
into another directory when changes have been made. The best directory for this would be the directory
where you have stored the model file.
17.4 Limitations
Currently the scheduling calls performed in the SMP code are translated to EuroSim equivalents in the
schedule file when they are called during initialization and not during a run. Because of this, the param-
eters of a service are ignored and cannot be used. It is also not possible to register services with a zero
cycle time. These limitations are recorded as EFO-SPR-2635 in the EuroSimSPR database.
Published data and services are placed under the SMP org node in the EuroSim data dictionary.
SMIAddCallbackRequest Y
Table 17.1: SMP 1.4 Compliance Matrix
304
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
SMICreateParameters Y
SMIDuplicateParameters Y
SMIEnvAddServiceToSchedule Y
SMIEnvGetSimulatedTime Y
SMIEnvReadAsciiObjectData Y
SMIEnvWriteAsciiObjectDetails Y
SMIEnvWriteMessage Y
SMIFreeParameters Y
SMIGetArrayDetails N
SMIGetCallbackCount Y
SMIGetCallbackID Y
SMIGetDataDetails Y
SMIGetDataID Y
SMIGetDataValue Y
SMIGetObjectCount Y
SMIGetObjectDetails Y
SMIGetObjectID Y
SMIGetParameterDetails Y
SMIGetParameterID Y
SMIGetRootObjectCount Y
SMIGetRootObjectID Y
SMIGetRootObjectIDs Y
SMIGetServiceDetails Y
SMIGetServiceID Y
SMIGetSizeOfType Y
SMIGetStructureDetails N
SMIGetSubObjectCount Y
SMIGetSubObjectID Y
SMIGetSubObjectIDs Y
SMIGetTypeSize N
SMIInitialise Y
SMIInvokeCallback Y
SMIInvokeService Y
SMIIsValidBaseOrUserTypeID N
SMIIsValidCallbackID Y
SMIIsValidDataID Y
SMIIsValidObjectID Y
SMIIsValidParameterID Y
Table 17.1: SMP 1.4 Compliance Matrix
c Dutch Space BV 305
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
SMIIsValidServiceID Y
SMIIsValidTypeID Y
SMIPublishCallback Y
SMIPublishData Y
SMIPublishObject Y
SMIPublishParameter Y
SMIPublishService Y
SMIPublishSubObject Y
SMIRegisterArrayType N
SMIRegisterStructureElement N
SMISetDataValue Y
SMITransferData Y
Table 17.1: SMP 1.4 Compliance Matrix
306
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
17.6.1 SMIExtSetObjectDescription
17.6.1.1 Functional description
Attach a textual description to an object or sub-object.
Parameter Description
c Dutch Space BV 307
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
17.6.2 SMIExtSetDataDescription
17.6.2.1 Functional description
Attach a textual description to a data item.
Parameter Description
308
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
17.6.3 SMIExtSetDataUnit
17.6.3.1 Functional description
Attach a textual unit specification to a data item.
Parameter Description
c Dutch Space BV 309
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
17.6.4 SMIExtSetServiceDescription
17.6.4.1 Functional description
Attach a textual description to a service.
Parameter Description
310
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
#include <esim.h>
#include <smi.h>
class Simple
{
public:
Simple();
bool initialize(const char *name);
bool update(Parameter_t *parameters);
private:
Integer32_t foo;
};
Simple::Simple() :
foo(0)
{
}
The update method cannot be registered directly, as SMP is not C++ aware. We introduce a wrapper
function so we can retrieve the original this pointer and then call the actual update method on the
instance of our class:
Once an instance of the class has been created, we can call the initialize method. It will publish the
object instance to the SMI (Simulation Model Interface) so that it is registered in the simulator environ-
ment. Note that this is done once during the build process of the simulator (in the ModelEditor) and once
during startup of the simulator.
The initialize method may look like this:
c Dutch Space BV 311
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
return true;
}
The call to SMIPublishObject publishes the object instance using the C++ this pointer. It gets regis-
tered under the name that was passed as argument to the initialize method. The result is stored in
object_id. Note that no error checking is performed in this example, but you are strongly encouraged
to do so in your own model source code.
Next, the only data member foo is published to the environment using the SMIPublishData function.
The object_id is passed to tell the environment that foo is a member of our class instance.
The update method is published by means of a call to SMIPublishService. As explained earlier, we
pass this function a pointer to the wrapper function instead of a pointer to the update method itself.
The SMIEnvAddServiceToSchedule adds the update method to the schedule. Note that you can leave
this call out and use the EuroSim schedule editor instead to add the entry point to the schedule.
The next step is to create an instance of our ‘Simple’ class and call the initialize method. We do this
in a separate function that can be called from ordinary ‘C’ source:
extern "C" bool publish_simple(const char *name)
{
Simple *simple = new Simple();
return simple->initialize(name);
}
Next we create an interface header file simple.h:
#ifdef __cplusplus
extern "C" {
#endif
void publish_simple(const char *name);
#ifdef __cplusplus
}
#endif
If you do not already have a file that contains the ManagerPublishInterfaces function, then create a
file called modelmanager.c and add the following lines to it:
#include <smi.h>
#include "simple.h"
void ManagerPublishInterfaces(void)
{
/* initialise the SMI. */
SMIInitialise();
312
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
publish_simple("Simple");
}
Unless you need additional initialization in your model(s), we can suffice with an empty implementation
of ManagerInitialise:
void ManagerInitialise(void)
{
}
Add modelmanager.c and simple.cpp to your model in the ModelEditor and then select the Build All
command in the Tools menu. Make sure that you selected SMP support in the Build Options.
The next step is to run the ScheduleEditor to create a custom schedule or to run the SimulationController
and use the generated schedule. The published variables and entry points can be found under the SMP org
node in the data dictionary.
c Dutch Space BV 313
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
314
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 18
Simulation Model Portability (SMP) is ESA’s standard for simulation interfaces. The purpose of the
standard is to promote portability of models among different simulation environments and operating
systems, and to promote the re-use of simulation models. EuroSim has implemented an interface for this
standard.
SMP2 is the successor of SMP. SMP2 is a totally new standard, adopting state-of-the-art techniques, and
has a much wider scope than its predecessor. The way of working with this standard and its complexity
demand tools for specification, development, integration, and storage of the SMP2 models. EuroSim
incorporates a set of tools to accomplish many of these tasks.
Knowledge of the SMP2 standard is a prerequisite for successfully using the SMP2 tools to create SMP2
models. For an overview of the standard, refer to [SMP05c]. For a comprehensive, formal descrip-
tion of the standard, see [SMP05e] for the SMP2 Meta Model (or Simulation Model Definition Lan-
guage, SMDL), [SMP05b] for the SMP2 Component Model, [SMP05a] for the SMP2 C++ Mapping and
[SMP05d] for the SMP2 Model Development Kit (MDK).
Almost all of the SMP2 version 1.2 standard features are supported. Hard real-time execution is not a
feature of SMP2 and is not supported for SMP2-aware EuroSim simulators.
EuroSim does not include an SMP2 artefact editor. If SMP2 artefacts must be created or edited, the user
should use a specialized SMP2 modelling tool like MOSAIC or ultimately fall back to an XML editor for
editing SMP2 artefacts.
• Model Editor
This tool allows to import SMP2 artefacts, generated C++ code, and even compiled SMP2 libraries.
It provides acces to the underlying SMP2 command line utilities described below and allows auto-
matic building of an SMP2-aware EuroSim simulator. See Chapter 6 for more information on the
Model Editor.
• Schedule Editor
The Schedule Editor allows to import SMP2 schedules. These are converted by the underlying
SMP2 command line utility smp2sched (see below). See Chapter 10 for more information on the
Schedule Editor.
c Dutch Space BV 315
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Apart from the tool and utilities described above, the EuroSim distribution comes with:
• Smp.cat, the standard SMP2 catalogue defining some low-level details inside the Smp namespace.
This file is included for reference by EuroSim when using SMP2 catalogues that refer to elements
inside the Smp namespace (except the predefined types).
• Compiled versions of the SmpCpp and SmpMdk libraries containing the MDK functionality, that
are linked by EuroSim with an SMP2 simulator.
• A compiled version of the Component Model library that allows running of SMP2 models in the
EuroSim run-time environment, linked by EuroSim with an SMP2 simulator.
For the command line tools described, on-line manual pages [MAN11] are available.
316
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 317
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Note, that the user may view and edit the catalogue from the Model Editor (using any SMP2
modelling environment) by double-clicking on the catalogue. See Section 6.2.4 for setting the
SMP2 modelling environment of your choice.
Generate package
The contents of a shared library containing SMP2 types is determined by the implementations
defined in an SMP2 package. In this scenario, no package is available beforehand. For each
SMP2 lib node, automatically generate a package from the catalogue that is attached to it using
the Generate Default Package menu option (see Section 6.4.7). This generated package called
the default package contains an implementation of all types in the catalogue from which it is
generated (except the types that do not require an implementation in SMP2). Optionally, to be
sure, run the validator on the generated package using the Validate SMP2 Artefact menu option
(see Section 6.4.7).
Note, that the user may view and edit the generated package (using any SMP2 modelling envi-
ronment) by double-clicking on the package. See Section 6.2.4 for setting the SMP2 modelling
environment of your choice.
Generate C++ code and Makefile
The next step is to generate code from the package attached to the SMP2 lib node using the
Generate C++ Code menu option (see Section 6.4.7). A hierarchy of org nodes and file nodes
will be attached to the SMP2 lib node. This tree has the same name as the SMP2 lib node and
contains all code generated from the package attached to the SMP2 lib node. The code consists
of a C++ header file (.h) for each type, a C++ implemention file (.cpp) for all types that need
one, and for some types a C++ forward reference header file ( f.h). The C++ code is organised
in a directory hierarchy which reflects the namespace hierarchy of the implemented types as
defined in the attached catalogue. Apart from the type-related C++ code, three C++ files are
generated for management of the types contained in the static and dynamic libraries that are
built from the generated code. Finally, a Makefile is generated that manages the building of the
libraries.
On the file system, the generated files are located in a directory named after the SMP2 lib node
which is generated inside the project directory. The directory hierarchy inside this directory is
identical to the org node attached to the SMP2 lib node.
Add model logic
The generated files can be inspected and edited by double clicking the file node (see Sec-
tion 6.2.4). The user may add logic between the unique markers that indicate that a user im-
plementation is expected at that location (where $uuid$ and $id$ are replaced by an actual
univerally unique identifier (which is the type’s implemention UUID as specified in the pack-
age) and an additional identifier, respectively):
It is strongly recommended not to remove these markers. Code placed between them will be
integrated in a new version of the file if the code is re-generated. Other code added by the user
is lost on code re-generation.
Install shared library
Build the shared library using the menu option Install SMP2 Library (see Section 6.4.7). If
compilation is successfull, the shared library is installed in the central installation directory of
the project. If there are any compilation errors, fix them in the added code and retry.
Note, that if static libraries of other SMP2 lib nodes are required for building the dynamic
library, these are automatically built as well.
318
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Import assembly
Using an SMP2 modelling environment, create an assembly based on the implementations de-
fined in the packages. Copy the assembly file conveniently to the project directory. Add an
assembly file node to the model tree using the Add File Node menu option (see Section 6.4.2,
select SMP2 Assemblies as file type). The assembly is expected to have file extension .ass. Any
number of assemblies can be added. Note, that if multiple interdependent assemblies exist, all
of these must be added to the model tree, or building the simulator will fail.
Optionally, run the validator on the assembly using the Validate SMP2 Artefact menu option
(see Section 6.4.7).
Build simulator
The final step is to build the SMP2-compliant EuroSim simulator using the Build All menu
option.
Note, that during this process, code is automatically generated from the assemblies. This code
takes care of loading the shared libraries, creating instances, and interconnecting them as spec-
ified in the assemblies. (see Section 6.4.6).
From this point on, the scenario is exactly as the one described in Section 18.2.1.1, step Generate C++
code and Makefile and further.
c Dutch Space BV 319
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• The generated code must be located inside a directory with the same name as the package from
which the code was generated. E.g. for a package named Mission.pkg, code must be inside a
directory named Mission.
• A Makefile must be present in the location where it would be generated by EuroSim to allow
import of source code, i.e. inside the top-level directory of the generated files. E.g. for a package
named Mission.pkg, the Makefile should be located inside the Mission directory. The name of
the Makefile must be Makefile.
• The Makefile must produce the same results when used as a Makefile generated by EuroSim.
• The generated code must not incorporate calls to unsupported ComponentModel interfaces. See
the file SMP2COMPLIANCE.txt which is part of the EuroSim distribution.
• The generated code must be equivalent to code that would be generated by EuroSim for the pro-
vided artefacts.
Therefore, in practice this way of importing is limited to code generated by another instance of EuroSim
and for code generated by an external tool that is specifically targeted at EuroSim.
Take care to import all related artefacts, or else elements will be missing from the generated C++ code
and the simulator cannot be compiled.
This import scenario consists of the following steps:
Prepare import
See Section 18.2.1.2, step Prepare import, on how to prepare import of catalogues, packages,
and assemblies. Copy the generated code including the Makefile to the project directory.
Define shared library
See Section 18.2.1.2, step Define shared library.
Import catalogue
See Section 18.2.1.2, step Import catalogue.
Import package
See Section 18.2.1.2, step Import package.
Import generated code and Makefile
Using the menu option Add Generated C++ Code (see Section 6.4.2), attach the tree of gen-
erated code to the SMP2 lib node. You may have to edit the Makefile to make it compliant to
EuroSim. Also, the name of the model file is used in the Makefile if the Makefile is originally
generated by EuroSim. Change it to the actual name of the model file.
At this point, the scenario becomes identical to the first two from the step Install shared library onward.
See Section 18.2.1.1.
320
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
At this point, the scenario becomes identical to the first two from the step Import assembly onward. See
Section 18.2.1.1.
c Dutch Space BV 321
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
322
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Part III
c Dutch Space BV 323
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 19
19.1 Introduction
With EuroSim Mk4.4HIL it is possible to use three different hardware interfaces, the External Interrupt
Interface, the MIL1553 Interface, and the Serial Interface. The External Interrupts interface provides
access to the external interrupt functionality on SGI Origin/Challenge/Onyx L/XL. The MIL1553 interface,
provides a general interface to access a MIL-STD-1553 serial data bus. The Serial interface provides
non-blocking access to the standard RS232/RS422 interface on SGI Origin/Challenge/Onyx L/XL Each
of these interfaces will be described in the following subsections.
Example code from a complete demonstration model, using MIL1553, serial and external interrupts library
calls, is available and installed in $EFOROOT/src/Mil1553Model.
• EuroSim tasks can generate output interrupts to one of the four SGI output connectors;
• A standard EuroSim input connector “EI” will be raised by the scheduler for each incoming input
interrupt. Note that the two input connectors are hardware short-circuited, thus in fact only one
interrupt exists.
• A user can install a user defined handler for incoming input interrupts.
• Input interrupts can be used as the (external) real-time clock of the scheduler, instead of the default
itimer mechanism.
c Dutch Space BV 325
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
For more information on the “EI” input connector, see also Section 10.3.4.2.
100 Hz
Heartbeat
1 2 3
The scheduler raises the “EI” input connector for each inter-
Interrupt rupt, one at a time and with the frequency of the scheduler
occurences
(default 100 Hz).
1
2
3
326
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Quick Extended lm
Power user
Utility
VMIVME-6000 Hardware
The VMIVME-6000 BCU software library (quick, extended and utility) offers all the functionality and
features that are provided by the VMIVME-6000 board. The library is ported to IRIX 6.5 and is (partly)
tested on SGI/Onyx. For more information about this library see [VMI] and [VMI93]. For optimisation
and engineering reasons, a new software module (lm) was developed, and added to the BCU software
library.
The MIL1553 interface is built on the lm interface, and will be used by the normal EuroSim user. It
provides the general interface to a MIL1553 device. The services of the MIL1553 interface are described in
the following subsections.
19.3.1 Scenarios
The MIL1553 interface is based on a “scenario driven” mechanism (called “control blocks” for VMIVME-
6000). The user firstly defines (e.g. in the initialization phase) the input and output buffers (for RT
mode), or defines the message transfers (for BC mode) that are required for the application model. Once
activated, the MIL1553 interface will perform solitarily the specified message transfers (BC mode) and
will send or receive the output/input buffers in reaction of BC write/read transfer actions (RT mode).
c Dutch Space BV 327
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
/*
* This example demonstrates the esimMil153 interface. In this example the
* RT functionality will be demonstrated. The RT 3 that is simulated writes
* incoming data on subaddress 5 to subaddress 10.
*/
#include <esim.h>
#include <esimMil1553.h>
#define MIL1553_BOARDNR 0
#define VME_A16_DEVICE "/hw/vme/1/usrvme/a16n/d16"
#define VME_A24_DEVICE "/hw/vme/1/usrvme/a24n/d16"
/*
* Open the milbus device
*/
if ((mil1553 = esimMil1553Open(MIL1553_BOARDNR, VME_A16_DEVICE,
VME_A24_DEVICE)) == -1) {
esimError("Cannot open Mil0\n");
return 1;
}
/*
* Set the mode of the milbus to RT
*/
if (esimMil1553SetMode(mil1553, MODE_MRTMON) == -1) {
esimError ("Cannot set RT mode\n");
return 1;
}
/*
* Add RT 3 to control block
*/
esimMil1553RtAdd(mil1553, 3);
/*
* Start the RT
*/
esimMil1553Start(mil1553);
/*
* Read incoming data on subaddress 5 and write it to subaddress 10
*/
esimMil1553RtRead(mil1553, 3, 5, buf, 8);
esimMil1553RtWrite(mil1553, 3, 10, buf, 8);
/*
* Stop the RT
328
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
*/
esimMil1553Stop(mil1553);
/*
* Close milbus and exit
*/
esimMil1553Close(mil1553);
return 0;
}
Note that in example given above (and in the remainder of this chapter), use is made of the esimError
function. If the code is running on an external simulator, the equivalent extError is available (see the
extMessage(3) man page).
/*
* This example demonstrates the esimMil153 interface. In this example a
* BC->RT transfer and RT->BC transfer is demonstrated. The BC->RT transfer
* will send 8 words from the BC to RT 3 and subaddress 5.
* The RT->BC transfer will receive 8 words from RT 3 and subaddress 10.
*/
#include <esim.h>
#include <esimMil1553.h>
#define MIL1553_BOARDNR 0
#define VME_A16_DEVICE "/hw/vme/1/usrvme/a16n/d16"
#define VME_A24_DEVICE "/hw/vme/1/usrvme/a24n/d16"
/*
* Open the milbus device
*/
if ((mil1553 = esimMil1553Open(MIL1553_BOARDNR, VME_A16_DEVICE,
VME_A24_DEVICE)) == -1) {
esimError ("Cannot open Mil0\n");
return 1;
}
/*
* Set the mode of the milbus to BC
*/
if (esimMil1553SetMode(mil1553, MODE_BCSIM) == -1) {
esimError ("Cannot set BC mode\n");
return 1;
}
/*
* Add BC->RT transfer of 8 bytes from BC to RT 3 and subaddress 5
*/
esimMil1553BcAdd(mil1553, 3, 5, BC_RT_TRANSFER, 8);
c Dutch Space BV 329
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
/*
* Add RT->BC transfer of 8 bytes from RT 3 and subaddress 10 to BC
*/
esimMil1553BcAdd(mil1553, 3, 10, RT_BC_TRANSFER, 8);
/*
* Initialise and write the data to be send for BC->RT transfer
*/
for (i = 0; i < 8; i++) {
snd[i] = i;
}
esimMil1553BcWrite(mil1553, 3, 5, snd, 8);
/*
* Start the transfers
*/
esimMil1553Start(mil1553);
/*
* Check whether all transfers (=the scenario) have finished.
* This example uses a busy wait. Don’t do that in a RT simulator.
*/
while (esimMil1553Poll(mil1553) == 0);
/*
* Read and print the data of the RT->BC transfer
*/
esimMil1553BcRead(mil1553, 3, 10, rcv, 8);
for (i = 0; i < 8; i++) {
printf("%d\n", rcv[i]);
}
/*
* Close milbus and exit
*/
esimMil1553Close(mil1553);
return 0;
}
/*
* This example demonstrates the non-blocking read and write of the
* esimSerial interface. Two serial devices are opened. From one device
* 10 bytes are read and then sent to the other.
*/
#include <stdio.h>
#include <unistd.h>
330
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
#include <esimSerial.h>
int main(void)
{
int ser1;
int ser2;
unsigned char buf[10];
int buffered = 0;
/*
* Open the input device
*/
if ((ser1 = esimSerialOpen("/dev/ttyd2", buffered)) == -1) {
printf("Cannot open /dev/ttyd2\n");
return 1;
}
/*
* Open the output device
*/
if ((ser2 = esimSerialOpen("/dev/ttyd3", buffered)) == -1) {
printf("Cannot open /dev/ttyd3\n");
return 1;
}
/*
* Read non-blocking data from the input device
*/
while (!esimSerialRead(ser1, buf, 10)) {
printf("Non blocking read demo\n");
sleep(1);
}
/*
* Write the received data
*/
esimSerialWrite(ser2, buf, sizeof(buf));
/*
* Close both devices
*/
esimSerialClose(ser2);
esimSerialClose(ser1);
return 0;
}
• PCI interrupts.
• External Interrupts.
c Dutch Space BV 331
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• POSIX named semaphores; see the manual page of sem open. The semaphores can posted by any
application on the same machine.
• Signals; available are the signal numbers between SIGRTMIN and SIGRTMAX that are not used by
EuroSim internally.
• EuroSim Compatible Devices; these are devices which have device drivers adapted for EuroSim.
These devices provide specific ioctl functions which EuroSim uses to wait for interrupts. See
Section 19.5.3.
Automatic handlers
can be used if the external event handler is connected to exactly one EuroSim input event
(which can have one input connector in every state). Every time an external event arrives the
input connector in the active state is raised. No additional code is required.
User defined handlers
allow more input connectors to be associated to one external event source. It also allows a faster
response to the external event in the interrupt handler or dispatcher code. The user should write
this dispatcher code. This code cannot make use of EuroSim scheduling functions and only part
of the EuroSim services can be used. (See esimEH manual page.)
User code can also be executed in interrupt handlers of VME, PCI or external interrupts. Such an interrupt
handler can be needed to clear the HW interrupt. It also has a very short response time and user code
can be executed while the HW interrupt line is still active. From the interrupt handler the external event
can be forwarded to the dispatcher. Read the esimEH manual page for installation and restrictions on
interrupt handlers.
Note: it is possible to install an external event handler that does not raise any EuroSim event, but only
communicates through global data with model code.
Example of external event handler user code:
#include <inttypes.h>
#include <string.h>
#include "esimEH.h"
#include "esim.h"
#define START_ID 0
#define STOP_ID 1
#define SHUTDOWN_ID 2
#define ERROR_ID 3
enum hw_status {
DO_RESET,
INTERRUPT
};
332
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
(void)user_data;
if (status == DO_RESET) {
hw_reset();
} else {
esimEHForward(context, &status, sizeof(status));
}
return 0;
}
data = hw_data_get();
switch (status) {
case START:
esimEHDispatch(context, START_ID, &data, sizeof(data));
break;
case STOP:
esimEHDispatch(context, STOP_ID, &data, sizeof(data));
break;
case PANIC:
hw_shutdown();
esimEHDispatch(context, SHUTDOWN_ID, &data, sizeof(data));
esimEHDispatch(context, ERROR_ID, &data, sizeof(data));
break;
default:
break;
}
return 0;
}
c Dutch Space BV 333
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
{
(void)name;
(void)id;
(void)arg;
}
334
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
this driver. This IRQ number is used by EuroSim to ensure that the interrupts go only to the CPU where
the event handler is running.
c Dutch Space BV 335
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
336
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 20
20.1 Introduction
With EuroSim the possibility exists to model a telemetry/telecommand link at run time either between
two sub-models within a EuroSim simulator, or between EuroSim and another (external) computer.
The main feature of this library is to simulate the bandwidth and time-delay that characterize a long-range
communication link, such as the TM/TC link between a ground station and a satellite. By default this delay
is disabled and packets are forwarded without any delay. The TM/TC mechanism uses a central server
process running within EuroSim, via which the two terminators (or clients) can communicate. The server
can maintain one or more client-to-client links; links are bidirectional and can be established between
any two internal clients or between an internal and an external client. For the latter, use is made of TCP/IP.
No link can be established between two external clients.
EuroSim has the flexibility to handle any data structure as a packet: “packets” do not have to be compliant
with ECSS PUS [Sec03] standards in order to be sent and received over the TM/TC link. In Figure 20.1 a
schematic of a TM/TC link between an external simulator and a EuroSim simulator is provided.
Thermal
Operator Control
Model
Temperature readings
Display Process Process
data TM TM
TM packets
In the case of an internal TM/TC link, i.e. between two or more sub-models within an EuroSim application,
the link needs to be set up, customized and then used.
In the case of an external TM/TC client, the only difference is first to connect the external client over
TCP/IP to the EuroSim server. Then the setting up and use of the link uses exactly the same routines. The
EuroSim routines are intended to be usable within a heterogeneous environment, and should be suitable
for any UNIX based simulators.
c Dutch Space BV 337
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• LINKDELAYPROC procname: the given function will be called for each time a new package is
put on the link with the call link_write(). Its return value is used as the delay for the given
package. The arguments it gets are the Link identifier for which the delay is requested, and the last
delay returned by this function for this Link;
• LINKBANDWIDTH integer: indicates the number of bytes which can be sent over the link per
second. A negative number indicates ‘Unlimited’ (default) and will pose NO extra delay. When
this value is set to 100, and 200 bytes are sent over, the package will take 2 seconds + the LINKDE-
LAY to arrive at the other side. Note that the package will arrive as a single entity and therefore
will not be visible (and cannot be read) as long as the complete package has not arrived;
• LINKMAXTIME PENDING integer: indicates how many milliseconds data may be overdue in
the queue before it is discarded. When a value less than zero is given, the packages will never be
discarded (default).
The esimLinkIoctl procedure can be called at runtime, so can be used to introduce a variable delay
time, for example in order to mimic an elliptical orbit or to simulate communications with a set of
ground stations where the delay time is a function of the current location of the satellite.
Both TM/TC clients can set their own characteristics so that the upward and downward links can differ
accordingly.
The esimLink manual page or [MAN11] provides more information on creating and customizing TM/TC
links.
3. Send packets;
4. Receive packets;
338
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• clientname: name by which this client is to be known to the EuroSim server, e.g. “TMTC Client”;
• eventHandler: name of procedure in external simulator code which will process events coming
from EuroSim simulator (flags indicating data updates and state changes are received as “events”)
• userdata: pointer to user defined data. This pointer is passed to the eventHandler callback function.
• async flag: flag to indicate that on incoming data the eventHandler callback function is to be called
via a signal handler. If the flag is set to false, the user must call extPoll() whenever data arrives
or periodically.
• prefcon: preferred connection on the EuroSim server; should be used to select between simulators
when more than one is currently active on the server (default of 0 is sufficient if only one simulator
is active)
20.4.2 Create and customize a link between the two TM/TC clients
The next step is to establish a (simulated) TM/TC link between the two “systems”, i.e. either between the
external client and EuroSim, or between two sub-models within a EuroSim application. In both cases,
the link is set up and used in almost the same way.
The link needs to be created on both sides with esimLinkOpen. The function esimLinkOpen will initialize
a link with the supplied name. A point-to-point link is not established until the other side has also called
esimLinkOpen with the same link name. The pointer returned by esimLinkOpen(e.g. tmtcLink in the
following example) is used as an identifier for the link in all future calls, e.g. read, write, close.
An external client needs to call esimLinkConnect() to connect the link to the simulator.
Various options can be set using esimLinkIoctl(see Section 20.2). In the first example here, the link for
the ground station is set up and customized to “lose” packets if they arrive after a certain time delay:
#include <esimLink.h>
The following lines from the SpaceStation model give an example of setting up the link and using
esimLinkIoctl to set the default delay for packets being transmitted:
#include "esimLink.h"
#include "esim.h"
void tmtcInit(void)
{
....
c Dutch Space BV 339
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The packet is then available for the “other” client to read after a certain time delay, the length of the delay
being dependent on the characteristics defined by esimLinkIoctl.
340
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
&DataFieldHeaderFlag,
&ApplicationProcessId,
&SegmentationFlags,
&SourceSequenceCount,
&PacketLength);
....
}
#define REQ_FREQUENCY 10
c Dutch Space BV 341
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
extDisconnect(sim);
esimLinkShutdown();
342
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 21
21.1 Introduction
With EuroSim the possibility exists to share simulation data at run time between EuroSim and another
(external) simulator. This is achieved by linking external simulator (local) variables to (a subset of) the
EuroSim data dictionary variables. During the simulation, EuroSim tools ensure that the values in the two
data dictionaries are “mirrored” (the update frequency being a user definable parameter). In Figure 21.1 a
schematic of the connection and associated functions for handling the data dictionary values is provided.
Simulate
Something DataDict DataDict
datadict
values
Process Receive Transmit
value(s) dict view dict view
ethernet
The two simulators need to be connected via a TCP/IP link. The EuroSim extSimAccess routines are
intended to be usable within a heterogeneous environment, and should be suitable for any UNIX based
simulators.
In addition to the specified data dictionary values, the external simulator also receives the simulation
time, (elapsed) wall clock time and simulation state from EuroSim.
• The EuroSim application decides which data dictionary items are to be visible to an external sim-
ulator, and whether with read and/or write access (defined in an exports file).
c Dutch Space BV 343
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• The external simulator application decides which data dictionary items are to be used from those
made available from EuroSim, and the type of access (defined in a data view).
An example is shown in Figure 21.2. The first box shows all the API items in the EuroSim data dictionary,
i.e. all possible data items which can be shared between the two simulators. The middle box shows that
by listing a subset of these items in a exports file, the EuroSim application can limit the number of
data items which it wants the external simulator to share. In addition, read/write access can be limited.
And finally, the third box for the external client shows how only some of the “public” data variables are
actually referenced by the external simulator for his own internal use.
EuroSim External
Application Model Exports Simulator (Client)
Data Dictionary Interface Data View
/nodeA/varX /nodeA/varX R /nodeA/varX R
/nodeA/varY /nodeA/varY R
/nodeA/varZ /nodeA/varZ R
/nodeB/varM /nodeB/varM R /nodeB/varM R
/nodeB/varN
/nodeC/varR
/nodeC/varS /nodeC/varS W /nodeC/varS W
/nodeC/varT /nodeC/varT W
/nodeC/varU /nodeC/varU W
The dict_node_ref is a reference to a node or individual data item within the data dictionary hierarchy.
Hence /myNode/file.c/stateVariableA is a legal reference which allows a particular variable to be
accessed explicitly, as is /myNode which implicitly allows access to all of the data items under the named
node in the data dictionary hierarchy.
The “viewName” provides a symbolic name for this set of data items, which needs to be referenced later
on when creating a local data view for the external simulator. Each “viewName” has to be unique. It is
generally recommended to make at least two views, one allowing read and one allowing write access.
By choosing the views so that they contain different sets of data, this approach helps to reduce potential
data inconsistencies which could be caused by simultaneous read/writes. Additional views may also be
created for the purposes of data hiding, e.g. defining two views which give read access for nodes /A and
/C, leaving node /B inaccessible to an external simulator.
The accessType indicates the type of access (“R” or “W”) which the external simulator is given to the
specified variables.
344
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
local data views. This is often useful when the external simulator is complex, and there are a significant
number of shared data items. Two particular circumstances where multiple data views are recommended
are:
• Data items need to be read/written at a wide range of frequencies, and therefore it is more efficient
to split data items into views which can be given high and low update frequencies as required.
• The simulator model uses an object-oriented approach, and creating a data view per “object” con-
tinues to support this methodology.
Each local data view is created from (i.e. maps to) a single EuroSim data view (i.e. a single line as defined
in the exports file). However, there can be several local data views mapping to a single EuroSim data
view, for example to provide the possibility to read new values at different frequencies as mentioned
above.
External Simulator
Exports file views
(defining available EuroSim views) 10Hz read data view
21.5 Synchronization
The external simulator access link can also be used to synchronize the client and the simulator with each
other. If either the client or the simulator is slower than the other, the other side waits until the slowest
side is finished. Also if one side stops for some reason, hitting a breakpoint or going to standby state for
instance, the other side is halted as well.
The synchronization mechanism is coupled with the data being exchanged over the link so that data
integrity is also ensured. At the simulator side this is done implicitly, but at the client side the user has to
make sure to call extViewSend() before sending the synchronization token.
The synchronization token should be a unique token for each synchronization point in a simulator. It is
possible to have multiple synchronization points in a simulator, possibly with multiple clients. It is the
responsibility to make sure that the numbers are unique. If the same token number is used by multiple
clients the simulator and/or one of the clients will very likely become blocked.
At startup the client shall connect to the simulator before the first synchronization token is sent from the
simulator to the client. Sending synchronization tokens by the simulator is done by broadcasting as it
is not possible to know in the simulator which client is performing synchronization (external simulator
access clients are anonymous at the simulator side). So if the simulator sends the synchronization token
before the client is connected, the token gets lost and the synchronization mechanism at the client side
will have missed one token, resulting in a blocked client.
At the client side there are two functions for synchronization purposes. The function extSyncSend()
sends the synchronization token to the simulator. The function extSyncRecv() waits for the synchro-
nization token from the simulator.
The following example shows how to use the functions in a typical application where the client is two-
way synchronized to the server.
c Dutch Space BV 345
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
At the simulator side there are two functions for synchronization purposes which are the counterparts of
the functions on the client side. They differ from the client side functions by the fact that they do not have
an argument to specify the connection. The function esimExtSyncSend() broadcasts the synchronization
token to all clients. The function esimExtSyncRecv() waits for the synchronization token from the
client.
The following example shows how to use the functions in a typical application where the simulator is
two-way synchronized to a client.
#define SYNC_TOKEN 1234
Please note that this method of synchronization cannot be used in a situation where hard-real-time perfor-
mance is needed. The calls which wait for the synchronization token (extSyncRecv() and esimExtSyncRecv())
may block for a long time if the other side is stopped.
In Figure 21.4 a sequence diagram of the exchange of tokens is shown. Please note that the client as well
as the simulator are always blocked from the point where they wait for the token until the next token is
received. This is the essence of the synchronization mechanism.
client simulator
send sync & send sync &
wait for sync wait for sync
receive sync receive sync
send sync &
send sync &
time
1. Create an .exports file to specify which EuroSim data dictionary (API) items are visible to the
external simulator.
2. Add calls to the external simulator code to link to EuroSim as a client at runtime.
3. Add calls to the external simulator code to make local data view(s) linking EuroSim data items to
local variables.
346
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
/ r_view R
/SPARC w_view W
The first line in the export file specifies that all data items (i.e. from the root of the data dictionary
downwards) are to be available to an external simulator with read only access and under the id of r_view.
A specific node or data item can be referenced individually if required; however the “/” symbol is a useful
shorthand to allow all data items to be referenced in one go.
The second line specifies that all data items under the SPARC node in the data dictionary are to be
available under the id of w_view with write only access for the external simulator. As the SPARC node
has also been included in the “/” specification for r_view, all data items under this note have effectively
been given RW access and care should be taken when accessing their values.
In this example, two separate views are created for the external simulator: one containing data for read-
ing, one containing data for writing. This is recommended to limit potential data inconsistency problems
when allowing simultaneous read/write access.
extInit();
Note that this only needs to be called once in your main() function.
Next, the link is set up with the following call in the external simulator source code:
#include <extSim.h>
c Dutch Space BV 347
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
userdata
Pointer to user defined data. This pointer is passed as a parameter to the eventHandler proce-
dure.
async Flag to indicate signal driven event handling versus polled event handling (see also extPoll).
prefcon Preferred connection on the EuroSim server; should be used to select between simulators when
more than one is currently active on the EuroSim simulation server (default of 0 is sufficient if
only one simulator is active).
A pointer is returned which identifies the simulator, and which you need to reference later on (e.g. when
setting up the local view of the data dictionary). The extClient manual pages or [PMA11] provide more
information on connection and disconnecting a client.
• Use of extViewAdd to add a data item (local name + EuroSim name) to the view.
The extView manual pages or [PMA11] provide more information on data views.
#include "extSim.h"
348
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
{
int ext_verbose = 0;
....
w_view_ext = extViewCreate(sim, "w_view");
....
extViewAdd(w_view_ext, VAR_VERBOSE_FLAG, &ext_verbose, extVarInt);
.....
extViewConnect(w_view_ext, EXT_DICT_WRITE, frequency,
COMPRESS_NONE);
....
}
c Dutch Space BV 349
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
switch (evEventType(command)) {
case evExtSetData:
curses_print(command);
break;
case rtExecuting:
case rtStandby:
.....
curses_state(command);
.....
}
...
}
However the events can be ignored: it is also possible to schedule (local) tasks which access the local
data as and when required, rather than waiting for a data update to trigger processing.
350
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
21.8 Performance
The External Simulator Access protocol is based on TCP/IP. This means that each data packet has some
protocol overhead. When an isolated (peer to peer) Ethernet “network” is used (i.e. two computers
connected by means of an Ethernet cross-over cable), then a theoretical throughput of 10 MByte/s can
be achieved when using quality 100 Mbit/s network adapters and cable.
The above figure can be affected in a negative way by a number of causes:
• Cheap network cards that saturate the CPU at an interrupt rate that allows only a few MByte/s on
a 100 Mbit/s network,
• Operating system,
• Driver implementation,
The latter point needs some explanation. On most systems, the default transmit and receive buffer size
for TCP/IP sockets is only 16384 bytes. On Linux, you can use the sysctl(8) command to increase buffer
sizes.
21.9.2 Windows
When using the Cygwin environment, you can use the mingw gcc compiler and the external simulator
access libraries as provided in the lib subdirectory of the directory where EuroSim is installed. If you
prefer to use the Microsoft development tools, then you can use the DLL’s. To link your client application
with the DLL’s, you must first create import libraries from the .def files in the lib subdirectory, for
example:
lib /DEF:c:/eurosim/lib/libes.def
lib /DEF:c:/eurosim/lib/libesClient.def
The above commands create libes.lib and libesClient.lib, which you can use to link your client
application with. Make sure that the DLL’s can be found on the PATH before you execute your client
application.
c Dutch Space BV 351
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
352
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 22
22.1 Introduction
The purpose of the Simulator Integration Support library is to support the integration of several indepen-
dent models into one simulator without wanting to do the integration explicitly in (model) source code.
In other words: the Simulator Integration Support library provides the “glue” between models.
22.2 Files
Two file types1 have been introduced for this purpose:
Model Description files can be created and edited with the Model Description Editor, see Chapter 7.
Parameter Exchange files can be created and edited with the Parameter Exchange Editor, see Chapter 8.
The use of these files will be described in the following sub-sections by means of a use case example.
Listing 22.1: The C source code for the modelA file node
#include <math.h>
static double x;
static double y;
void calc_sin(void)
{
y = sin(x);
}
1
The file extensions are provided in Appendix F.
c Dutch Space BV 353
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Listing 22.2: The C source code for the modelB file node
static double counter;
void update_counter(void)
{
counter = counter + 0.1;
}
The complete source code, including the other files discussed in this section, can be found in the src
subdirectory of the directory where EuroSim is installed.
ModelA takes variable x as input to the sin function and stores the result in variable y. The entry point
for the update of modelA is calc_sin.
ModelB takes variable counter as input, increments it and writes the result back to the same variable.
The entry point for the update of modelB is update_counter.
When we want to use modelB to update the input variable of modelA, we would need to modify the
source code of modelB to perform its update on variable x instead of using variable counter. We would
also need to change modelA to remove the static keyword from variable x so that it can be accessed
from modelB (global scope). When using the Simulator Integration Support library, we do not have to
modify the source of the sub models as will be explained in the following sub-sections.
Figure 22.1 shows a screen shot of what the Model Editor looks like with the two sub-models modelA
and modelB. The sub-models have been parsed and check marks are placed in front of the entry points
and variables that have to be available in the data dictionary.
354
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
model source code file. Each model variable that is described as a variable in the Model Description file
will be available for exchange with other variable(s).
It is possible to add one or more Model Description file nodes to a model using the EuroSim Model
Editor, see Section 6.2.4.4. When you select the Edit command on a Model Description file node in the
Model Editor, the Model Description Editor will be started.
After specifying which variables from the example models should be available for model to model ex-
changes, the Model Description Editor looks like Figure 22.2. We have created two model nodes ModelA
and ModelB that contain references to the entry points in the respective models. Since this is a very
simple example, the screen shot shows an almost one to one copy of the original model tree in the Model
Editor. Notice that the counter variable in the Model Description file has been duplicated to serve as an
input variable as well as an output variable for ModelB.
22.3.2.1 Datapool
Once you have finished editing a Model Description file, select the Tools:Build All menu command in the
Model Editor, which generates the so called “datapool” (see also Section 7.2). The datapool contains the
variables described in the Model Description file(s). It also contains automatically generated entry points
to exchange the data between model variables and datapool variables. The variables in the datapool are
always of the same type as the ones they refer to in the model files. During the build process, the variables
and entry points in the datapool are merged into the data dictionary, see Section 22.5.
c Dutch Space BV 355
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
22.3.3.1 Why are Parameter Exchange files not part of the model?
This is done for flexibility. It allows the model developer to put together several sub-models into one
simulator executable and describe the model variables by means of one or more Model Description files.
The simulator developer could then create two Parameter Exchange files and reference these from two
Schedule files. The first variant of the Parameter Exchange may for example update the input variables
of one of the models with variables in the datapool that are updated by an external simulator (see Chap-
ter 21). The second variant may update the input variables of one of the models with variables in the
datapool that are updated by an internal model. In that way the test controller can easily switch between
the two configurations, simply by selecting the appropriate Schedule file. The reason for having the
Parameter Exchange file(s) referenced by the Schedule file is that the entry points are generated “on the
fly” and you need the entry points when you edit the Schedule.
• One or more Model Description files (added to the model file as file nodes),
• One or more Parameter Exchange files (optionally added to the Project Manager).
We are now at a point were we can create the schedule file for the simulator. For our use case example a
screen shot of the Schedule Editor looks like Figure 22.4.
356
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 357
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• /paramexchg/Model A to Model B
This entry point copies the updated counter output variable in the datapool to the counter input variable
and the x input variable (step 7 in Figure 22.7). After this parameter exchange the schedule starts again
at step 1. This time model A uses the updated x variable to perform its model update.
Notice that entry points that are generated for parameter exchanges are placed in a special node in the data
dictionary called “paramexchg”. The name of the entry point is the same as the name of the parameter
exchange group node in the Parameter Exchange file. The parameter exchange entry point copies the
values of the specified variable(s) from the source to the destination.
The names of the generated entry points to update the datapool and model variables receive the names of
the input and output group nodes as specified by the Model Description file:
Name of entry point := set_nodename_variables
In order to generate the parameter exchange entry points, you must use the File:Parameter Exchange
files command in the schedule editor to specify which parameter exchange file(s) should be used by the
simulator. As soon as you add a parameter exchange file, the Schedule Editor will automatically add
the appropriate entry points to the internal data dictionary (it will not change the data dictionary file on
disk), so that the entry points are available in the task and non-rt task dialogs. At run-time, i.e. when the
simulator reads the schedule file, the referenced parameter exchange files are read and the entry points
are also generated, but this time they will point to internal data structures that describe which datapool
variables to copy.
358
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
when the Model Description file has been defined, the build process creates the datapool from the Model
Description file(s) and merges its variables and entry points with the stage 1 data dictionary in order to
create the final data dictionary. The final data dictionary will be used by the simulator and other EuroSim
tools (such as the Schedule Editor).
c Dutch Space BV 359
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
360
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 23
23.1 Introduction
The error injection library allows users to introduce errors in the transfer of data items from and to
the datapool. It is therefore closely linked to the Simulator Integration Support library described in
Chapter 22.
Error injection is enabled in the Model Editor in the support tab of the Build Options dialog box (see
Figure 6.5).
int res;
c Dutch Space BV 361
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
if (!*enable) {
return input;
}
if (*counter == 0) {
return input;
}
(*counter)--;
switch (input.type) {
case ESIM_ERROR_INJECTION_BOOLEAN:
value = input.val_b;
break;
case ESIM_ERROR_INJECTION_INTEGER:
value = input.val_i;
break;
case ESIM_ERROR_INJECTION_UNSIGNED_INTEGER:
value = input.val_u;
break;
case ESIM_ERROR_INJECTION_DOUBLE:
value = input.val_d;
break;
default:
assert(0);
}
prev_value = *history;
*history = value;
output.type = input.type;
switch (input.type) {
case ESIM_ERROR_INJECTION_BOOLEAN:
output.val_b = value;
break;
case ESIM_ERROR_INJECTION_INTEGER:
output.val_i = value;
break;
case ESIM_ERROR_INJECTION_UNSIGNED_INTEGER:
output.val_u = value;
break;
case ESIM_ERROR_INJECTION_DOUBLE:
output.val_d = value;
break;
}
return output;
}
value.type = ESIM_ERROR_INJECTION_BOOLEAN;
value.val_b = false;
enable_id = esimErrInjPublishParameter(pub,
"enable",
"enable error injection",
362
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
NULL,
value,
false);
if (enable_id == -1) return -1;
value.type = ESIM_ERROR_INJECTION_INTEGER;
value.val_i = -10;
offset_id = esimErrInjPublishParameter(pub,
"offset",
"offset to add to output value",
"m",
value,
false);
if (offset_id == -1) return -1;
value.type = ESIM_ERROR_INJECTION_UNSIGNED_INTEGER;
value.val_u = 20;
counter_id = esimErrInjPublishParameter(pub,
"counter",
"number of times to repeat error",
NULL,
value,
false);
if (counter_id == -1) return -1;
value.type = ESIM_ERROR_INJECTION_DOUBLE;
value.val_d = 0.123e2;
history_id = esimErrInjPublishParameter(pub,
"history",
"history of variable",
NULL,
value,
true);
if (history_id == -1) return -1;
esimErrInjPublishFunction(pub, error_injection_function);
esimErrInjSetPostFix("_test_1_2_3_4");
return 0;
}
The error injection function is called error_injection_function. The function retrieves first pointers
to the error injection parameters. The pointers allow the user to modify the error injection parameter
values. This example shows four parameters, one of each data type.
The input value of the error injection function is modified to perform the error injection. The result is
returned. The type of the result variable must always be identical to the type of the input variable.
The error injection publication function must be called userErrInjPublish. The function is called at
build time and at run time. At build time the publication is used in the process to generate the data
dictionary. At run time it is used to pass the error injection function pointer and to retrieve the parameter
id’s. The parameter id’s are needed to retrieve the pointers to the error injection parameters in the error
injection function.
More information can be found in the esimErrInj(3) manual page.
c Dutch Space BV 363
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
dimensions as the array variable. The array elements of the error variable affect the corresponding
elements of the original array variable.
364
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 24
24.1 Introduction
The EuroSim COM interface allows Windows scripting clients, such as Visual Basic for Applications
(VBA) supported by MS-Excel, to launch and/or connect to an EuroSim simulator and control this sim-
ulator from your client application.
24.2 Installation
24.2.1 VBA
When you plan to use this interface only with VBA, then you only need to install the esimcom.dll
(the actual component) and esimcom.tlb (the type library). If you have an installation of EuroSim for
Windows NT/XP, then these files have already been copied for you. If you want to use your own client
applications on a PC that does not have EuroSim installed, then you can manually install the COM
interface:
• Copy the esimcom.dll and esimcom.tlb files from the EuroSim bin subdirectory to an appropriate
directory (this can be the system directory, usually C:\windows\system32).
• Copy the files pthreadGC.dll and oncrpc.dll to the system directory, if they are not installed on the
target system yet (you can find these files in the system directory of a system that has EuroSim for
Windows NT/XP installed.
• Open a command shell and go to the directory where you just copied the two files.
regsvr32 esimcom.dll
24.2.2 C++
When you plan to develop C++ clients, then you need the esimcom.h (the header file) and the esim-
com if.c files in your development environment. Copy those files from the EuroSim include directory
into an appropriate directory and make sure you add an include path to the esimcom.h file. The esim-
cim if.c file should be compiled and linked in with the other files of your client program.
If you get errors at compile time about MIDL versions, you may need to use the esimcom vc6.h header
file instead of esimcom.h.
c Dutch Space BV 365
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• Copy the files from the src/com/testsim directory into your project directory.
• Double click the Counter.model file in the project manager and build (F8 key) the simulator with
the Model Editor.
• Double click the Counter.sim file in the project manager and run the simulator by clicking the
‘Init’ button of the Simulation Controller. If all went well, you should see some messages in the
log window of the Simulation Controller indicating that the simulation is running.
• Stop the simulation by clicking the ‘Stop’ button of the Simulation Controller.
At this point we have a working simulator, which we can use to test the MS Excel based client application.
366
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Instead of ”C:\mysims\Counter” for the working directory, you should fill in the path that you used
when creating the simulator project, i.e. the directory where the Counter.sim and Counter.model files are
located.
In a similar way add the ‘Go’ button with the following code:
c Dutch Space BV 367
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The client is ready for a first test. Leave design mode (the left-most button on the Control Toolbox
toolbar), click the ‘Init’ button and wait for the text “Launch successful’ to appear. You can also verify
that the simulator is running by executing the efoList utility from the command line, see Section 13.7.1.
Click the ‘Stop’ button in the Excel sheet to stop the simulator.
The Windows Application Event Log may give you a clue in case you encounter problems.
368
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
/Counter readview R
/Counter writeview W
This means that all variables in the /Counter node — the Counter.c file — are available for reading when
a view is created with the name “readview” and they can be written when using a view that was created
with the name “writeview”. The following paragraphs describe how to create views in the MS Excel
based client application.
Go to the VB editor and double click ‘Module1’ in the VBAProject tree. Add the following lines to the
declarations:
That is all the code needed to have EuroSim copy the value of simulator variable ‘dCounter’ to the client
variable ‘dCounter’. The updates will occur at a frequency of 10 Hz.
Now we want to display the value of ‘dCounter’ in a cell of the sheet. We could add a button that invokes
some code that copies the value of ‘dCounter’ into a cell, but there is a more sophisticated means to
achieve this, which is described in the next paragraphs.
If the client application wants to keep track of changes in simulator variables, it could simply poll.
However, if this is done from VBA code in, for example, an Excel spreadsheet, the complete Excel
application would not be responsive to user input while polling. To solve this problem, the EuroSim
COM interface provides an event callback mechanism.
c Dutch Space BV 369
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Note that the client application has to implement an interface that the EuroSim component makes calls
on. However, the EuroSim component specifies this interface in the type library. Since the component
is the source of the calls on this outgoing interface, this interface is called a source interface. The client
is called the sink for calls on this interface. The next paragraphs describe how to set-up a sink, or event
handler, in VBA.
This will declare an object named Simulator as an instance of the EuroSim.SimAccess class. The
WithEvents statement tells VB that it receives events.
At the top of the code window, there are two drop down edit boxes. In the one on the left, select
Simulator from the list. Since there is only one method, Changed, the VB editor automatically creates
a subroutine called ‘Simulator Changed’. Add the following line to this new subroutine:
The above line of code writes the value of ‘dCounter’ to cell A6 on the sheet, each time the interface
notifies our client that something has changed in the external simulator. Your VB editor should look
similar to Figure 24.6.
We also need an instance of the event class: select ‘Module1’ and add the following line
370
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
The last step is to install the sink. Go to the CommandButton1 Click subroutine and add the following
line
Then add the following code to the CommandButton4 Click (CreateView button) subroutine:
The above code creates a relation between the local variable ‘newCounter’ and the simulator variable
‘dCounter’, which we monitor using the readview.
Excel Worksheet and Workbook level events are contained by the Worksheet and Workbook objects,
respectively. However, there is no similar object to contain the Excel Application level events. Therefore
you must use a Class Module to create an object that can accept and handle Application level events.
Open the VB Editor, and choose Class Module from the Insert menu to create a new Class Module.
Select the class module and insert the following statement as a global declaration:
c Dutch Space BV 371
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
This will declare a variable named App as an instance of the Application class. The WithEvents statement
tells Excel to send Application events to this object.
At the top of the code window, there are two drop down edit boxes. In the one on the left, select App, and
in the one on the right, select the SheetChange. The VB editor will automatically insert the Private
Sub and End Sub statements into the module. Add the following code to the app SheetChange event
handler:
On Error Resume Next
Application.EnableEvents = False
If Target.Address = "$B$6" Then
newCounter = Target.Value
WriteView.Send
If Err <> 0 Then
MsgBox Err.Description
End If
End If
Application.EnableEvents = True
Each time cell B6 is changed, i.e. the user types a value, its value is copied to the variable called
newCounter. This value is sent to the simulator variable ‘dCounter’ using the Send method on the
WriteView object.
Press F4 to display the Properties window, and change the name of the class module to EventClass,
see Figure 24.7.
372
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
The MS Excel based client application is ready for another test. Leave design mode, launch the simulator,
create the views and type a numeric value in cell B6. After pressing the Enter key, the application event
handler will be called, which will send the value of cell B6 to the simulator.
c Dutch Space BV 373
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
374
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 25
25.1 Introduction
This document describes how to setup and use the EuroSim Web Interface. The two main components
of the web interface are
• the server
• the monitor
The server is the central component of the system. It communicates with client-side software (typically
web browsers), with the monitor application, and with simulators (via the monitor).
The server communicates with the clients using the HTTPS protocol (HTTP over SSL). The server uses the
EuroSim protocol for communication with the simulators. Instead of letting the server connect directly to
the simulator, the monitor sets up connections to the simulator and the server, after which it does nothing
more than forward data between the two.
The monitor is installed on the same network as the simulators it has to watch. The server can request
the monitor to scan its local network for simulators, and request a connection to a simulator.
How to use these applications is explained in more detail in the following chapters.
25.2 Monitor
This chapter explains how to use the monitor application.
c Dutch Space BV 375
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
By pressing the Connect button, the user initiates a connection to the server. This can be a direct
connection, or via a proxy. The state of the connection is displayed on the bottom of the window. When
the connection succeeds, the status message changes to ‘Connected’.
On successful connection, the caption of the connect button changes to Disconnect. Pressing the button
in this state closes the connection.
The Settings button brings up a configuration dialog, where the monitor settings can be adjusted. This is
explained in more detail in the next section.
The listview below the buttons displays the simulator connections that are currently open.
25.2.2 Settings
The settings dialog has two tabs where several important configuration parameters can be adjusted.
The ‘Server hostname’ is where the server can be found. This can be in the form of a hostname (for exam-
ple ‘www.dutchspace.nl’, or an IP address in so called ‘dotted decimal notation’, as shown in Figure 25.3
.
The ‘Server port’ is the port number of the server. This is usually 443, the standard port for HTTPS (which
is the protocol used by the server).
Next up are the proxy settings. If web access requires a proxy at the location where the monitor is
installed, check the ‘Use proxy’ checkbox. This enables the ‘Proxy hostname’ and ‘Proxy port’ fields,
which have the same meaning for the proxy as the ‘Server hostname’ and ‘Server port’ have for the
server. The standard port for proxies is 8080.
The ‘Certificate file’ is the file that contains the certificates for ‘Certificate Authorities’. On Linux sys-
tems, this typically is ‘/usr/share/ssl/cert.pem’. See Section 25.4 for a more detailed explanation of
certificates.
The EuroSim baseport is normally 4850. This value gets added to the ‘prefcon’ value for simulator
connections, to give the actual TCP port number.
The ‘Monitor login’ and ‘Monitor password’ are necessary to establish the connection to the server.
Without a valid username and password it is not possible to use the web interface.
The ‘Monitor name’ is the name that appears in the monitor list that is sent to the client.
The ‘Startlist file’ is the path and filename to the file that describes the known simulators that can be
started by the EuroSim Web Interface via this monitor.
376
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
<?xml version="1.0"?>
<startlist>
<simulation>
<id>Demo1</id>
<name>Atos Origin Nederland Demo 1</name>
<simfile>/home/nl27111/demo1/demo1.sim</simfile>
<host>nwgesim002.nl.int.atosorigin.com</host>
</simulation>
<simulation>
<id>Demo2</id>
<name>Atos Origin Demo 2</name>
<simfile>/home/nl27111/demo2/demo2.sim</simfile>
c Dutch Space BV 377
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
<host>nwgesim002.nl.int.atosorigin.com</host>
</simulation>
</startlist>
The file always has one startlist element, with one or more simulation elements. Every simulation has
four child elements: id, name, simfile and host.
Note: The id field of a simulation has to be one word, without spaces.
25.3 Server
This chapter explains how to use the server application.
25.3.1 Startup
Starting the server can be done in 2 ways: via the command line, or via the internet daemon ‘xinetd’
(which is the preferred way).
service esimweb
{
type = UNLISTED
id = esimweb
socket_type = stream
user = root
server = /usr/local/esimweb/server
wait = yes
protocol = tcp
port = 443
disable = no
}
25.3.1.3 Settings
Like the monitor, the configuration of the server is stored in a file in $HOME/.qt/esimwebrc. The table
below lists the settings that can be adjusted in the file:
DefaultPage
The page that should be opened when the user does not request a specific page. Default is
‘index.html’.
DocumentRoot
The root of the directory tree that contains the files that the user can browse.
378
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
ListenPort
The tcp/ip port number that the server should listen on. This only has effect if the server is
started with the ‘—test’ option, otherwise it uses file descriptor 0. which it assumes to be
initialized by xinetd to the file descriptor on which to accept a new connection.
PathToCertificate
The path to the servers certificate file.
PathToPrivateKey
The path to the servers private key file.
25.3.2 Authentication
The authentication information for clients and monitors is kept in a file called ‘auth.xml’ in the same
directory as the server executable. It contains all valid user / password combinations.
Access control is divided into 2 ‘realms’ (this term is used in the HTTP basic authorization scheme): one
for clients, and one for monitors. The name of the client realm is “EuroSim Web Interface Client”, and
the name for the monitor realm is “EuroSim Web Interface Monitor”. These names are hardcoded in the
server, and should match exactly.
Below is an example of such an authentication file:
<authinfo>
<realm name="EuroSim Web Interface Client">
<user login="eurosim" password="hard2guess"/>
<user login="johndoe" password="2hard4u"/>
</realm>
<realm name="EuroSim Web Interface Monitor">
<user login="demo" password="xyz123"/>
</realm>
</authinfo>
This file would give access to 2 clients: one with username ‘eurosim’ and password ‘hard2guess’, and one
with username ‘johndoe’ and password ‘2hard4u’. Access is also granted for a monitor with username
‘demo’ and password ‘xyz123’.
25.4 Certificates
This chapter will try to explain the basics of certificates.
c Dutch Space BV 379
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
380
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
When your input is accepted, you will be taken to the monitor list. Otherwise, the login dialog will
keep asking you for you credentials. Pressing Cancel will stop this, resulting in a ‘401 Unauthorized’
message.
This shows a list of all monitors that are currently connected to the server. To retreive the sessionlist/s-
tartlist of a monitor, select a row and click ‘Ok’.
c Dutch Space BV 381
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
It shows a list of all sessions that are currently running on the monitors local network and a list of
simulators that can be started. Each running session is represented on a row in the upper table that
contains its hostname, prefcon number and the name and path of the simulator executable. The lower
table contains a short name and the name and path for sessions that can be started.
Join or start a session by selecting the row and pressing the Ok button.
382
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
against another variable) and plotted on a graph. Besides monitoring variables you can also have Action
Buttons to execute MDL scripts or to enable/disable recorders or stimuli.
c Dutch Space BV 383
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
25.6 Reference
This chapter provides a reference to the methods of the server interface, and a description of the XML
formats that are used.
384
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
To request the session list for a monitor with id localhost:0, from a server at address hostname, use the
following:
https://hostname/esim?method=getSessionList&monitorId=localhost:0
c Dutch Space BV 385
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Example:
To delete a view ‘DemoView’ on the simulator with id ‘sim:0’ on monitor ‘localhost:0’, use the following
URL:
https://hostname/esim?method=delView&monitorId=localhost:0&simId=sim:0&viewId=DemoView
386
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
<!ELEMENT id (#PCDATA)>
<!ELEMENT monitor (id, name)>
<!ELEMENT monitorlist (monitor*)>
<!ELEMENT name (#PCDATA)>
Example:
<?xml version="1.0"?>
<monitorlist>
<monitor>
<id>127.0.0.1:36506</id>
<name>Demo monitor {\@} atosorigin.com</name>
</monitor>
</monitorlist>
Example:
<?xml version="1.0"?>
<sessionlist monitorid="127.0.0.1:36506" monitorname="Demo monitor @ foobar.co
<session simid="demo.foobar.com:0">
<hostname>demo.foobar.com</hostname>
<prefcon>0</prefcon>
<simulator>/home/demo/foo/ESS.Linux/ESS.exe</simulator>
</session>
<session simid="demo.example.com:0">
<hostname>demo.example.com</hostname>
<prefcon>0</prefcon>
<simulator>/home/test/bar/xyz.Linux/xyz.exe</simulator>
</session>
</sessionlist>
c Dutch Space BV 387
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
25.6.2.3 Sessioninfo
The session info structure contains session parameters (like the dictionary path, working directory, etc)
and a list of available variables.
Format:
<!ELEMENT description (#PCDATA)>
<!ELEMENT dict (#PCDATA)>
<!ELEMENT exports EMPTY>
<!ELEMENT gid (#PCDATA)>
<!ELEMENT hostname (#PCDATA)>
<!ELEMENT initconds (item)>
<!ELEMENT item (#PCDATA)>
<!ELEMENT max (#PCDATA)>
<!ELEMENT min (#PCDATA)>
<!ELEMENT model (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT pid (#PCDATA)>
<!ELEMENT prefcon (#PCDATA)>
<!ELEMENT recorderdir (#PCDATA)>
<!ELEMENT scenarios (item+)>
<!ELEMENT schedpath (#PCDATA)>
<!ELEMENT sessioninfo (hostname, simpath, workdir, simulator, schedpath,
dict, model, recorderdir, exports, initconds?, scenarios?, prefcon, uid,
gid, pid, variables)>
<!ATTLIST sessioninfo
simid CDATA #REQUIRED
monitorid CDATA #REQUIRED
>
<!ELEMENT simpath (#PCDATA)>
<!ELEMENT simulator (#PCDATA)>
<!ELEMENT type (#PCDATA)>
<!ELEMENT uid (#PCDATA)>
<!ELEMENT unit (#PCDATA)>
<!ELEMENT var (name, type, unit, min, max, description)>
<!ELEMENT variables (var+)>
<!ELEMENT workdir (#PCDATA)>
Example:
<?xml version="1.0"?>
<sessioninfo simid="demo.foobar.com:0" monitorid="127.0.0.1:36506">
<hostname>nwgesim002.nl.int.atosorigin.com</hostname>
<simpath>/home/demo/foo/ESS.sim</simpath>
<workdir>/home/demo/foo</workdir>
<simulator>/home/demo/foo/ESS.Linux/ESS.exe</simulator>
<schedpath>/home/demo/foo/ESS.sched</schedpath>
<dict>/home/demo/foo/ESS.Linux/ESS.dict</dict>
<model>/home/demo/foo/ESS.model</model>
<recorderdir>/home/demo/foo/2005-02-18/12:09:37</recorderdir>
<exports/>
<initconds>
<item>/home/demo/foo/ESS.init</item>
</initconds>
<scenarios>
388
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
<item>/home/demo/foo/Prof.mdl</item>
<item>/home/demo/foo/Etc.mdl</item>
<item>/home/demo/foo/Fault.mdl</item>
<item>/home/demo/foo/Rec.mdl</item>
</scenarios>
<prefcon>0</prefcon>
<uid>1005</uid>
<gid>1005</gid>
<pid>14686</pid>
<variables>
<var>
<name>speed</name>
<type>int</type>
<unit>m/s</unit>
<min>0</min>
<max>100</max>
<description>The speed of the object</description>
</var>
<var>
<name>acceleration</name>
<type>int</type>
<unit>m/s2</unit>
<min>-10</min>
<max>10</max>
<description>The acceleration of the object</description>
</var>
</variables>
</sessioninfo>
Example:
<?xml version="1.0"?>
<viewlist>
<view monitorid="127.0.0.1:36506" simid="demo.example.com:0">
c Dutch Space BV 389
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
<name>DemoView</name>
<simstate>Executing</simstate>
<simtime>6.90288e+06</simtime>
<runtime>6.90307e+06</runtime>
<variables>
<var>
<name>ball{\_}{\_}height</name>
<value>123.456</value>
</var>
<var>
<name>ball{\_}{\_}velocity</name>
<value>3.1415</value>
</var>
</variables>
</view>
</viewlist>
25.6.2.5 Errors
Errors can occur for a number of reasons, for example because a specified id (monitorId, viewId, simId)
is unknown, or because an addVariable command is issued for a variable that is already present in the
view. Errors simply contain a message about what went wrong.
Format:
Example:
<?xml version="1.0"?>
<error>
<message>An unknown error occurred</message>
</error>
390
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 26
26.1 Introduction
The purpose of the Java interface is to allow EuroSim users to program simulation models in Java. The
steps required for integration of Java models into EuroSim are described in the Section 26.2. The java
data types supported by EuroSim are listed in Section 26.3.
The Java models are executed by the Java Virtual Machine from Sun. There are a couple of limitations
that the user must be aware of.
1. The garbage collector may start at any time and may result in unpredictable execution times of
Java models.
2. When a Java entry point is executed, the state of the variables as present in the data dictionary is
copied to the Java model, then the Java method is called, followed by a copy of the data from the
Java model to the data dictionary. The copying may be quite expensive in terms of execution time
if the entry point is from an object that has many sub-objects. The entire tree will be traversed and
copied twice.
In the EuroSim installation directory you can find a directory Java with a Java example project, in the
src directory.
This is a very simple test simulator which shows you a working example. In EuroSim just
make a new project and add the model and use the Model Editor to open it.
class main
{
@eurosim(description="Model Instance 1")
public model m1 = new model(1, 2, "one");
c Dutch Space BV 391
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
In the example above, note the absence of the “main” method, the class itself assumes the task of the
absent “main” method. Also note the import nl.eurosim.model.*; statement at the beginning of the
example. This statement imports a number of classes associated with the EuroSim Java interface. These
classes are necessary when using eurosim annotations or calling EuroSim run-time methods discussed
next. It is not necessary to instantiate these classes, or any other class that does not contain an entry point
method, in the main class. Access them in the normal way.
Because of the way Java is supported by EuroSim, it is not possible to see any member variables or
entry point methods in the Model Editor. This makes it impossible to add descriptions or give units
to these methods and variables like the way it is done with the other supported languages. Using the
eurosim annotation, however, it is possible to do the same job in the model code. Information in
the annotation is not shown in the Model Editor, but does show up in the EuroSim data dictionary.
Member variables and entry point methods may be annotated with an eurosim annotation, for example:
@eurosim(description="Calculates distance",unit="[m]"). A variable can have the following
annotation fields:
• ignore: Boolean flag, if true, the variable or entry point is not published in the data dictionary.
An entry point method, however, can only have the description and ignore annotation. It also must
not have any arguments, but must have the void return type.
Published data and entry points are placed under the JAVA org node in the EuroSim data dictionary.
class model
{
@eurosim(description="some variable", unit="m", min="0", max="10")
public int var = 2;
@eurosim(description="another variable")
public double other = 3.1415;
There are a number of EuroSim run-time methods you can use in your Java model. They are listed in
EuroSim Manual pages and in Section D.1.4. As all of these methods are static, it is not necessary to
make an instance of the appropriate class. Just use the class name itself. For example: if you would like
to get the simulator time, you would call the esimGetSimtime() method and use the class that gives this
method, i.e., EsimRuntime. Your code would look like this:
392
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
import nl.eurosim.model.*;
class example
{
void someMethod()
{
// Get the simulator time
double time = EsimRuntime.esimGetSimtime();
}
}
The publication mechanism uses reflection to determine all the fields and methods of the classes. It
stores the extra information given by the annotations in the data dictionary. The default initial value is
automatically determined.
Java source files shall be stored in a hierarchical directory structure reflecting the package hierarchy in
the same directory as where the model file referring to these files is stored.
When the model is ready to be build the user has to enable the Java capability support. This is done by
selecting the “EuroSim Java integration library” option on the Support tab of the Build Options dialog in
the Model Editor.
It is possible to add class-paths in the usual manner in the Build Options dialog box. Each element must
be separated by a colon. You can specify directories with class files or jar files, however, when referring
to a jar file the complete name of the jar file should be given, not just the directory the jar file is in.
After this the user just has to run the Build All command to compile the model source into a runnable
simulator.
c Dutch Space BV 393
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
EuroSim also supports List<>’s of objects and arrays of object. Objects inside other objects are pub-
lished as sub-objects in a hierarchical fashion.
Arrays and Lists are published as hierarchies with the individual elements as leaves. Each leaf element is
published under the array node with the same name as the parent but with a post-fix in the form index.
It is possible to rename array and list elements to a user defined name by implementing the Renamable
interface.
The Renamable interface class defines one method: public String getEsimId(). The example below
demonstrates the use:
Listing 26.4: Example of using the Renamable interface to rename an instance of an object
import nl.eurosim.model.*;
@eurosim(ignore=true)
String name;
int value;
1
java.lang.String may contain a Unicode string. EuroSim supports only ASCII (UTF-8) type strings.
394
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 27
27.1 Introduction
The purpose of the C++ interface is to allow EuroSim users to create hard real-time simulators using
models in C++ with the same capabilities as the classic C style API. While the classic API achieves this
via scanning the model code and defining API headers, the C++ API follows the approach of providing
a publication interface to the model developer. This means that the model developer has to write code
to publish variables and methods to EuroSim. This publication code can be located in an additional
Eurosim specific model method and thus kept separate from the model functionality. The publication
code can easily be generated from UML models.
The C++ API has been developed such that its usage does not require much programming effort or
specialized knowledge. Template techniques in the API automatically detect and handle basic types and
arrays thereof. User defined classes are handled in a recursive approach, after which the publication of
the object is called to add its children. The end result of the publication is then a tree that represents
the object hierarchy in the models. To support the recursive approach, the C++ API provides EuroSim
vector, list and map containers.
In the EuroSim installation src directory you can find a directory Satellite++ with an example project.
This is a very simple test simulator which shows you a working example. In EuroSim just make a new
project and add the model and use the Model Editor to open it. The code is generated from a UML
model using the Enterprise Architect modelling tool with C++ codegenerators enhanced for EuroSim.
The Enterprise Architect database is added to the sample code as well.
For standalone development of models using the EuroSim C++ API, stubs are provided in the etc di-
rectory of the EuroSim distribution. These stubs are provided in source code. Since the eurosim C++
API is built on top of the C api, the esim++ stubs.cpp source code requires the EuroSim C stubs as well
(esim stubs.c).
The steps required for integration of C++ models into EuroSim are described in the Section 27.2. The
EuroSim C++ API is described in detail in Section 27.3. The data types supported by the EuroSim C++
API are listed in Section 27.4. The generation of C++ API compliant code from UML tools is described
in Section 27.5. The usage of eclipse in combination with the C++ API is elaborated in Section 27.6.
c Dutch Space BV 395
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
When the EuroSim C++ support capability is switched on, the users model software is required to imple-
ment a bootstrap function called esimCppSetup in which the model software is to create all objects and
publish them to EuroSim:
bool Esim::esimCppSetup()
Providing a return value of false will indicate to EuroSim that the publication process has failed and
aborts the simulator before the scheduler starts.
Generally it is found that the C++ model code contains some OO factory pattern, which defines one
object that creates all other objects and can be seen as the root of the object hierarchy. The esimCppSetup
function is the appropriate time and location to create such factory object and initiate its functionality.
The allocation of memory for objects is automatically rerouted by EuroSim to its real-time memory
allocator (esimMalloc), such that new and delete operators can be used safely without endangering the
real-time performance.
When all objects are created, the models must be published in EuroSim’s dictionary. The preferred
approach is to use the recursive mechanism, in which case for every model that is to be published directly
under the /CPP root node, the following function should be called:
The details on arguments are explained in Section 27.3. The result is a reflection of the object hierarchy
in the dictionary. Figure 27.2 illustrates the CPP node.
396
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
This function will publish the information on object under the name /CPP/.../objectname in the
dictionary with the <optional description> in the EuroSim dictionary.
Every object that is to be published, either directly from a publish call in the esimCppSetup method, or
as a result of the recursive mechanism, is required to provide an esimPublish() method:
bool esimPublish()
When performing Esim::publish(x, "x") on an object x, the publication mechanism adds object
"x" to the dictionary and subsequently calls x.esimPublish().
The esimPublish method of the model should contain the publication code of each attribute and method
that the model wishes to publish in the EuroSim dictionary.
Through EuroSim tooling (GUIs), the user of the simulation can monitor, execute or manipulate the
published items.
Listing 27.1: Example of source code organization using the C++ API
#include <esim++.h>
class Example
{
Private:
Float aFloatAttribute;
Int anIntAttributeArray[10];
void someMethod();
Public:
virtual esimPublish();
}
Bool esimPublish() {
result=true; //to return the status of publication to higher levels,
ultimately EuroSim itself
result=result&&Esim::publish(aFloatAttribute,"aFloatAttribute’,"
Description of a float");
c Dutch Space BV 397
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
result=result&&Esim::publish(anIntAttributeArray,"anIntAttArray","An
integer array publish");
result=result&&Esim::publish(&Example::someMethod,"someMethod","
publishing a method");
result=result&&Esim::setUnit("aFloatAttribute","kg");
result=result&&Esim::setMin("aFloatAttribute",0.01);
result=result&&Esim::setMax("aFloatAttribute",0.99);
result=result&&Esim::setParameter("aFloatAttribute",0.99);
result=result&&Esim::setAccess("aFloatAttribute",Esim::Access::
RW_ACCESS/RO_ACCESS/WO_ACCESS);
void esimCppSetup() {
Example* expl=new Example();
Esim::publish(*expl,"example","publishing my example directly under
the /CPP root");
}
Following is a complete description of the EuroSim C++ API in relation to the C API functionality:
398
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
EVENT FUNCTIONS:
int eventRaise(const char *eventname, const void *data, int size);
int eventRaiseTimed(const char *eventname, const void *data,
int size, const struct timespec *t, int use_simtime);
int eventCancelTimed(const char *eventname);
int eventCount(const char *eventname);
int eventData(void *data, int *size);
int eventCount(const char *eventname);
METRICS FUNCTIONS
bool setLoadMeasureInterval(int processor, double interval);
bool getProcessorLoad(int processor, double *avg_load,
double *max_load);
void getHeapUsage(int *tot_size, int *max_used, int *current_use);
All the C++ API functions above wrap the EuroSim C API functions, and thus have the same arguments,
effect and results as defined for the C API. To publish objects, attributes and methods however, the C++
API contains in addition a publication interface. This interface is also defined in the Esim name space
and has as prototype:
c Dutch Space BV 399
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Where:
item defines the object, attribute or method that is to be published.
"dictionary name" defines the name that should be used in the dictionary to identify the
published item, which in most cases will be the object, attribute or method name,
<"description"> defines an optional description that will be visible in the GUIs, e.g. in
monitors in the SimulationController to aid the user in working with the simulation.
Note that the same method can thus be applied for every item that is to be published, being either an
object, an attribute of an object or a method of an object, or a static method. For example:
The only exception where EuroSim needs additional information from the user is for enumerated types.
These types are not natively handled by EuroSim and are difficult for EuroSim to discern from a class.
The user can cast the variable to the appropriate type in the publish call, or let EuroSim handle that by
calling Esim::publish_enum(attribute,"attribute",<"description">). The ad-
vantage of the latter is that EuroSim will check what base type the compiler selected for this enumerated
type.
The dictionary name will in most cases be just the name of the object, variable or method to be published.
However, this can be a relative or absolute path. A relative path is written as a command line directory
navigation, e.g. ”../../myobject/myitem” will publish the item ”myitem” not as a child of the current
object but as a child of the object myobject that exists two levels up in the hierarchy. An absolute path
starts with /CPP, the root node in the dictionary for all models software that uses the C++ API. (See
Section 27.3 for a description of the recursion mechanism).
The optional description <"description"> in the method definition is only used to provide extra
information to the user of the simulation in which the model is applied. If the optional description
argument is left out, an empty string is applied. As shown in the example the description can also be
set later on, after an item is published. A special case of that is setting the description of an object from
within its own publication routine. When publishing a derived class by calling the publish routine of its
base class, the desciption can then reflect information about the dervied class.
The publication always starts from the current scope, which is the object that contains the esimPublish
call. There are three functions available to the user to change the scope:
Esim::getScope(buffer) sets the provided argument buffer to the current scope (the caller thus
has to provide the memory). Esim::setScope("my new scope") changes the current scope to
the relative or absolute path argument. Esim::cmpScope("my own scope") matches the argu-
ment with the current scope. All three routines return true in case of success.
When adding models to EuroSim via the classic C API approach, the EuroSim ModelEditor supports
the user in adding minima, maxima and unit definitions to variables in the dictionary. In the approach
it also supports definition of the access a simulation user has to attributes. With the C++ API, this
information can be added from the model software. The Esim namespace contains the following methods
to accomplish the same features for published C++ variables (attributes):
400
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• bool Esim::setDescription("description");
Where:
• setUnit, setMin, setMax setParameter= have the same meaning as in the classic C API,
• setAccess can be used to manipulate the variable node icon to show that the variable is a state,
input or output variable. In C++ member variables are normally state variables, and thus the de-
fault value is allmost always correct. Changing the icon to Read Only or Write Only may only have
applicability when you want to show that a class is reading or writing public attributes of another
class. The owning class would be publishing the variable as state variable, the using class for in-
stance as Read Only. The values of the accesmode are Esim::RO_ACCESS, Esim::WO_ACCESS and E
• setDescription is added to support setting the description of a dict variable separately from
the publication. The special version with only a description as argument sets the description of the
current object and is very usefull to show derived class information for objects in vectors, lists and
maps
The C++ API provides a number of configuration functions to activate debug features and memory
optimization features that are built into the C++API.
The switchPublish functions and the switchPurgeObject function are related to memory consumption.
The switchPublish routines switch the publication of a category of dictionary items on or off. The
PurgeObject function removes an object that has no attributes in the dictionary directly after completion
of publishing object. Objects without attributes are never visible in the EuroSim, and thus may as well
me removed from the dictionary to reduce memory consumption. Be carefull though when using relative
paths, as when removed you cannot add attributes in a later stage. These functions only need to be used
in extreme cases of many objects and severe memory limitations. The default value is therefore OFF.
c Dutch Space BV 401
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The switchCycleDetection function can be used to activate the cycle detection feature of the C++ API.
Especially when generating the code from UML, associations lead to objects publishing eachother. The
Cycle detection looks for repeating patterns in the path and generates an error message if one is found.
In such cases one of the publish calls must be removed. The default value of the cycle detection feature
is OFF.
The C++ API provides a built int schedule feature that has no counterpart in other APIs and is specifically
usefull in the context of Object Orientation. The following function allows the model developer to add
an entrypoint to a task in the schedule:
This function is best called directly after the publication of a method, here assumed to be under the name
”entrypoint”. When a simulator starts, it reads in the provided schedule file. When the addEntryToTask
method is encountered it then adds the entrypoint ”entrypoint” in the dictionary to the task ”taskname” in
the schedule. In object oriented code multiple instances are created and thus multiple times the entrypoint
”entrypoint” is published (under a different parent object) in the dictionary. In the normal approach the
entrypoint must be added the same amount of time as there are objects to a task using the ScheduleEditor.
Using the addEntryToTask this is now done automatically from the code, avoiding discrepancies between
code and schedule. The decisions on how the code is scheduled of the processors in time is still defined
using the tasks and task properties in the schedule editor, but the schedule may contain only or mostly
empty tasks. Note that the timing statistics and timebar feature of EuroSim will still collect and contain
the timing statistics of all entrypoints. The Simulation Controller however will not show entrypoints in
the schedule tab, and no eurosim schedule breakpoint can be defined on entrypoints. (But the symbolic
debugger can be used to set a breakpoint on any function).
In addition, the C++ API also provides a number of container types. These containers support the re-
cursive publication mechanism and allocate memory for their internal administration before publication;
402
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
hence the maximum size must be provided at compilation time. Following container types and for each
type a number of methods are provided.
Esim::Vector<Element, Size>
• void clear(); Resets the administration of the Vector (contained objects are not destroyed
by clear)
• size_t size() const; Returns the number of elements added to the vector.
• template <class Functor> void foreach( Functor&); Iterates through all the
elements in the vector and call for each element the user defined functor with the element as
argument
• Type& front; : Provides a reference to the element at the front of the vector.
• Element& back(); : Provides a reference to the element at the back of the vector.
• Element& operator[] (int index); : Provide a reference to the element at the speci-
fied index in the vector
Esim::List<Element,Size>
• void clear(); Resets the administration of the Vector (contained objects are not de-
stroyed by clear)
• template <class Functor> void foreach( Functor&); Iterates through all the
elements in the vector and call for each element the user defined functor with the element as
argument .
• Element& front; Provides a reference to the element at the front of the list.
c Dutch Space BV 403
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• Element& operator[] (int rank); Provide a reference to the element that is at the
position rank in the ordered list.
• void clear(); Resets the administration of the Vector (contained objects are not de-
stroyed by clear)
• template <class Functor> void foreach( Functor&); iterate through all the
elements in the vector and call for each element the user defined functor with the element as
argument .
• Element* find( const Key& ); Return a pointer to the element that has the provided
key, or NULL otherwise.
• bool remove(const Key&); Remove the element with the provided Key from the map.
• Element& front; Provide a reference to the element at the front of the map.
• Element& back() ; Provide a reference to the element at the back of the map.
In general the methods of the container types have the same meaning as their counterparts in the C++
standard template library, with the exception of the remove method and the foreach methods. The remove
method only removes the element from the container, it does not deallocate memory. The foreach meth-
ods replaces the iterator mechanism of the standard template library. It iterates through all the elements
in a container, with for each element executing the functor with a reference to an element as argument.
This provides an easy interface without the need for inheritance. The functor is used by reference and
can be used to collect data as it iterates through the elements. Following example shows the use of the
foreach and functor feature:
Class ListFunctor {
Private:
MyAttr attr;
Public:
bool operator()(MyClass* p) {
attr+=p->aMyClassmethod();
}
Esim::List<MyClass*,10> myClassList;
ListFunctor f;
myClassList.foreach(f);
404
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
These container types are provided via the include file esim++tl.h. Note that this current template library
is efficient and effective for use in EuroSim, but not in line with the C++ standard template library in
terms of its use of iterators and functionality. The aim is to add an additional container library that is
consistent, which will then be contained in esim++stl.h in the future if required.
EuroSim currently provides support for C++ code generation from Enterprise Architect through exten-
sions to its code generation templates. These template extensions are stored in the Enterprise Architect
database Satellite++.eap that is part of the Satellite++ example that is included in the delivered Eu-
roSim installation under /src. The code generation template extension also generate doxygen compliant
C++ comment lines, such that when doxygen is used on the generated code, it produces detailed design
documentation with information dervied from your UML models. This has been applied successfully
in projects by the EuroSim consortium. Support for other tools is foreseen in future versions through
generation of publish code from XMI, the UML storage format.
The template extensions add the esimPublish call automatically to every class, in the header as well as the
implementation. In the latter, the esimPublish function automatically contains the publication code for
every attribute, as well as for the methods that are compliant with the EuroSim signature (void method
(void)) and are stereotyped with ”EuroSim”. Following is an example of a class definition in Enterprise
Architect and the generated C++ code.
c Dutch Space BV 405
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Listing 27.3: Example extract of code generated from Enterprise Architect with EuroSim code generator
#include "Satellite.h"
#include <esim++.h>
#include <esim++tl.h>
/**
***************************************************************************
* Constructor for Satelite object, passing the name of the space object to
the SpaceObject constructor
*
* @param const char* name @todo: Add parameter description
* @return Description of return value
* @pre Pre conditions (optional)
* @post Post conditions (optional)
* @rule Broken rule number (if applicable)
*/
Satellite::Satellite(const char* name){
mThruster=new Thruster(*this);
mRadar=new Radar(*this);
}
/**
***************************************************************************
* @todo: Add description
*
* @return void
* @pre Pre conditions (optional)
* @post Post conditions (optional)
* @rule Broken rule number (if applicable)
* /
void Satellite::initialise(){
SpaceObject::initialise();
mLowerAltitudeLimit=210;
mUpperAltitudeLimit=280;
mThruster->initialise();
mRadar->initialise();
return;
}
/**
***************************************************************************
* @todo: Add description
*
* @return void
* @pre Pre conditions (optional)
* @post Post conditions (optional)
* @rule Broken rule number (if applicable)
* /
void Satellite::execute(){
SpaceObject::execute();
406
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
mThruster->execute();
mRadar->execute();
if (mAltitude>mUpperAltitudeLimit)
mThruster->setThrusterState(Thruster::OFF);
if (mAltitude<mLowerAltitudeLimit)
mThruster->setThrusterState(Thruster::ON);
return;
}
/**
***************************************************************************
* EuroSim Publish Function implementation
* This code is automatically generated by Enterprise Architect
*
* @rule N/A
* @pre N/A
* @post If succesful the publish of all operations and attributes to
EuroSim has succeeded
* @param char* aPath Path of the object in the EuroSim dictionary tree
* @return Success (true) or failure (false) of method call
*/
bool Satellite::esimPublish () {
bool result=true;
return result;
}
Note that the @todo remarks are automatically generated by the code generator when there was no de-
scription found in the UML model. Otherwise it puts the text found in the UML model in the appropriate
place in the code. The @todo automatically show up in the documentation generated by doxygen.
The generated code from Enterprise Architect requires additional manual effort to become compilable.
Following tips will help speed up the process from UML to working source code:
1) In associations, define the type of the associated variables, e.g a ChannelList. And then write the
typedefs outside Enterprise Architect, e.g.
c Dutch Space BV 407
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
In the Satellite++ example this has advice has not been followed for practical reasons, and since it is a
small example it works well. However in large projects it is best to define to many details in the UML
model. It is a lot of work and results in a maintenance problem. This may be overcome with a roundtrip
approach where generated code is read into Enterprise Architect. The EUroSim code generators have
not been created with such concept in mind and may not be suited to such approach.
2) When code has been generated, the first action should be to go through all the header files and check
their includes. Typically the code generator includes headers where a forward declaration of a class is
sufficient as the class defined in the header only has pointers or references to types. To many includes
usually lead to problems at some point and should be avoided from the start. In addition to forward
declarations, classes may use the EuroSim provided template types (Vector, List, Map). When used,
either esim++tl.h must be included or a forward declation must be made (which is always preferable).
3) The code generator creates the code on a class scope basis. It is not unlikely that publication of the
associations in the model lead to cycles in the publication process. In addition some other code problems
may occur due to the limited scope of the code generation. It is therefore adviced to initially switch the
debug features on: Esim::switchCycleDetection(Esim::ON), Esim::switchNullPointerWarning(Es
These should be switched on at the beginning of the esimCppSetup function to give them the scope of
the whole publication process.
4) The code generator can not create initializers with constructors, e.g. Classname::Classname(int value ): att
These must be added manually.
408
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
6) When entrypoints are to be added to the schedule that follow from C++ model code, two approaches
can be used. Either use the traditional approach and add them to tasks in the ScheduleEditor, or use
the more object oriented solution and use Esim::addEntryToTask directly after publishing the entrypoint.
Both approaches can be used within the same schedule.
The model software can be written, compiled and linked into a library from eclipse, providing the en-
gineer with the benefits of software development from within eclipse. The ModelEditor is only used to
define the build options for EuroSim. In those build options you must specify the linking of your library.
In addition it must contain one source file that defines the esimCppSetup function, which usually only
contains the switch calls to configure the C++ API and a function call to the model software where the
creation and publication of objects is further handled.
Write a Makefile which takes care of compiling your code and linking it into the library that you specified
in the EuroSim Model Editor. When in your make process your libraries are linked, it must be followed
by the following two actions:
This will have the same effect as pushing the Build All button in EuroSim. You can also clean up what
EuroSim generated with make -f modelname.make clean. In eclipse you can now configure
that when you active the build process it invokes your makefile.
With this approach the ModelEditor will not be needed anymore after defining build options and inte-
grating the C++ setup code. The Schedule Editor will still be needed to define the schedule and the
Simulation Controller to define and execute simulations.
c Dutch Space BV 409
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
410
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 28
28.1 Introduction
The Transport Sample Protocol (TSP) provides a standard interface for data distribution between a provider
(EuroSim in this case) and several consumers on different hosts.
The TSP protocol is based on TCP/IP. It allows a client to register to a TSP provider for synchronous (or
asynchronous) sample delivery. The client can subscribe to a list of variables at various frequencies.
More information can be found on the TSP home page.
1. The sampling happens in the ACTIONMGR task (or ACTIONMGR 0 task in case you have multiple
action managers). This means that the basic frequency is equal to the frequency of the ACTIONMGR
task.
(a) a small number of fixed variables (the simulation time and wallclock time currently)
(b) a flattened data dictionary. As it is not possible to publish complex types, all data structures
and arrays of structures are currently expanded to their individual elements. The convention
used is the same as used to specify variables in recorders, monitors, etc. I.e. using slashes
as separators (e.g. /modela/file.c/struct.var). Some TSP clients cannot handle slashes,
such as the tspfs (TSP filesystem).
4. The following features are not supported: async sample reading and writing:
(TSP consumer request async sample read() and
TSP consumer request async sample write()).
c Dutch Space BV 411
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
28.5 Troubleshooting
28.5.1 TSP provider fails to start up
The RPC program number for the TSP provider remains registered when the simulator gets killed or has
crashed. If this happens too often the registration fails and the provider refuses to start up. A command
line tool tsp rpc cleanup will remove all registrations of all TSP providers.
412
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Chapter 29
Embedded Simulators
29.1 Introduction
Embedded Simulators are simulators that execute in a limited operating environment as often is the
case in embedded systems. EuroSim embedded simulators therefore do not assume or rely on user
input, network connectivity and/or file IO. They can be tailored in size and capabilities. This makes the
EuroSim embedded simulator suitable for embedding within a stand-alone target device.
EuroSim embedded simulators are specific to a target environment and therefore are an add-on option
to EuroSim. They are created on customer demand for a specific target environment, as it requires
a tailoring of the delivered EuroSim kernel to the specific target of the customer. Please contact the
EuroSim consortium to check the availability of Embedded EuroSim for your target environment.
• The developer first uses the standard EuroSim to develop his models, supported by the complete
set of tools and features of standard EuroSim. This step ends with a running EuroSim simulator
on the host
• The next step is then to setup an automated build process involving some EuroSim configuration
code generation and cross compilation of your model software for the target environment.
• The final step is to link your cross compiled model and simulation configuration software together
with the delivered embedded eurosim library and any other target environment libraries into a
target image.
When the model software has been programmed within the limitations of embedded EuroSim and any
special restrictions that follow from the chosen operating environment, the aforementioned steps provide
an easy automated transition from host to target. The developers can operate as long as possible in the
EuroSim based development environment, reducing the need for the often expensive target hardware
and software licenses, as well as limiting the use of the complex cross development solutions. A single
(make) command transforms the EuroSim simulator on the host to a EuroSim simulator on the target.
The embedded concept and features are first discussed in section 29.2. The build procedures are then
explained in section 29.3 followed by a listing of Embedded Simulator specific API functions 29.4. An
Example is shown in section 29.5. Finally the specifics of the currently available and proven embedded
kernels are listed in section 29.6.
29.2 Architecture
This section describes the differences between the standard EuroSim and Embedded EuroSim Archi-
tecture. The standard EuroSim simulator consists of a composition of building blocks (libraries) that
c Dutch Space BV 413
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
each fill in specific functionalities in the EuroSim core. Figure 29.1 shows a schematic of the basic
composition.
In this figure each layer defines a type of functionality, which typically is implemented via multiple
libraries. The arrows show the dependencies between the libraries:
• The upper layer in figure 29.1 provides network connection services. This layer is normally not
available in embedded simulators.
• Recorders, Script and ActionManager may be present, but quite often the scripting is only needed
in the more flexible development and test environment provided by standard EuroSim and is best
left out of the execution environment to save resources.
• The Scheduler and Dictionary implement the basic layer of real-time model execution and should
always be present.
Note that figure 29.1 does not show add on libraries as the SMP and CPP interfaces. These can also be
included if desired. The integration and tuning of libraries in a EuroSim embedded library must be built
in by the EuroSim consortium.
A EuroSim embedded simulation application consist of a EuroSim Embedded simulator library, linked
together with model software, a EuroSim configuration (schedule, dictionary), as well as customer pro-
vided code to handle EuroSims output. This is visualized in figure 29.2:
The ModelSoftware is the same as the model software on a standard EuroSim solution (provided that the
source code does not violate limitation posed by the target platform). The Simulator configuration files,
such as schedule and dictionary, are converted in the application build process to source code and linked
to the simulator. This locks the configuration into the simulator and eliminates the need for a file system.
The Application IO arranges the link between the embedded simulator and the embedded environment
of the simulator. Normally, the EuroSim event connection transports messages from the simulator to
the Simulation Controller journal window. Because the normal client/server interface is not available,
414
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
and the target environment unknown to the EuroSim consortium, the simulator developer must provide a
handler to route and process the output of EuroSim simulators to available IO capabilities.
The Embedded Simulator provides the following interface to hook this report interface to EuroSims
output channel:
void esimEmbeddedInstallOutputCallback(
esimEmbeddedOutputCallback callback);
Embedded EuroSim maintains an internal queue of messages. Once the users reporter function is in-
stalled it will start flushing the content of the queue and call the reporter function for each message
encounters. Messages generated early on in the startup process before the user installed the handler will
therefore still be forwarded to the user’s reporter function.
Following is a complete description of the EuroSim C++ API in relation to the C API functionality:
The first two lines have the same effect as pressing the Build All button in the Model Editor. This
guarantees that all simulator products have been build. The esim_embed_files script then embeds
the EuroSim simulator configuration files (dictionary, schedule and config) in the embedded simulator
by convertsing them to source code. This source code should be compiled and linked the same way as
your model code. The COMPILE, ARCHIVE, and LINK steps are indicative for the steps needed. How
compilation and linking is achieved is highly specific of the chosen target environment.
c Dutch Space BV 415
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
A more detailed specification for your complete Makefile can be provided when you order Embedded
EuroSim for a specific kernel. When an embedded kernel is provided, the EuroSim consortium will
provide the detailed knowledge and examples.
This function returns the average load (0-100%) of the main cycle period, the average load (0-100%)
of the main cycle period and the maximum load (0-100%)of the basic cycle period. The input ’state’
specifies the Eurosim state for which the statistics are requested (see esim.h) Both average and peak
values are measured from the start of the system (scheduler).
void esimEmbeddedPrintTaskStats(void);
This function starts outputing the system statistics to the output channel that was installed using the func-
tion esimEmbeddedInstallOutputCallback(). Statistics have the same format as is normally outputed to
the console at the termination of EuroSim i.e. Processor loads per EuroSim State and Task and entrypoint
execution statistics
This function can be used to align the wallclock time of the simulator to an external wallclock time. The
alignment requires two timestamps, taken on the same processor as the simulator is running on.These
timestamps must be taken in Unix timespec format (Unix epoch). The first argument passed to the func-
tion is the timestamp of the external wallclock. The second argument contains the time at which the
timestamp of the external wallclock was taken. With these two arguments, esimEmbeddedSetWallclock-
Timets can calculate the time that the wallclock should get at the time that the esimEmbeddedWallclock-
Timets is called. The function that sets the internal simulator wallclock to that value.
bool esimEmbeddedSetWallclockPending();
This function can be used to check if an alignment of the wallclock time is pending. In such case the
wallclock time will change as soon as no task is active, hence when requesting the time one does not
know whether it is pre or post alignment. When an alignment is pending the function result is true;
The following is an example of a typical Eurosim Embedded configuration file. It may contain variables
that are generic to the embedded library (e.g. heap size) but also specific to a particular embedded target
like Integrity178B for example (e.g.partion idle time).
# Config file
heap_size = 80000000;
partition_idle_time = 0.0066666;
In this example the embedded satellite simulator arranges its IO to the outside world via a shared memory
solution. A shared memory segment is allocated by the simulator and configured with FIFO queues:
416
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• A message queue is created and attached to the EuroSim embedded simulator report interface.
Using this channel the Satellite controller can receive events from the simulator.
• An input data queue is created to receive commands from the satellite controller.
• An output data queue is the channel to provide the Satellite controller with data.
The controller application can now send commands and receive messages from the embedded simulator
application. Figure 29.3 describes the architecture of this solution.
Note: The SatteliteEmb example with the shared memory code is provided as example code. It may
be used as a starting point in your application. No guarantees can be offered though by the consortium
that it will work out of the box. Especially embedded applications are notoriously dependent on specific
environments.
The application code in the example directory shows how the Embedded Simulator initialization func-
tions are used, where the shared memory is created and is configured by the simulator. The Satellite
controller application opens the shared memory, attaches to the queues and starts listening to messages
and data and controlling the satellite in the model software.
The Makefile for this application shows the generation of EuroSim configuration and the linking with
the libraries and objects.
c Dutch Space BV 417
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
system that processes can not affect each other assured the mission critical safety aspects of the system.
Note that the embedded simulator utilizes non safety critical versions of the GreenHills Integrity libraries
(safe as it can not affect other applications).
With respect to EuroSim API interface (esim.h. esim++.h, esim++tl.h the following restrictions apply:
int esimGetRecordingState(void);
void esimAbortNow(void);
bool esimIsResetting(void);
418
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
int Esim::getRecordingState(void);
void Esim::abortNow(void);
bool Esim::isResetting(void);
Fully supported.
The Integrity 178B environment is very restrictive, which should be taken into account when writing
models. Please see the Integrity 178B documentation on these restrictions.
The EuroSim library reroutes all dynamic heap space memory allocations (malloc/free/new/delete) to
the EuroSim real-time memory allocator which manages its own application specific heapspace. This
bypasses the Integrity 178B restriction where the free and delete have no implementation. The Integrity
178B approach is tailored to 178B safe applications. Using the EuroSim memory allocators allows more
freedom in the usage of dynamic memory. With the protection of a VAS in place by Integrity178B,
dynamic memory usage may then be allowed when the EuroSim embedded kernel itself is not to be used
for mission critical software.
The EuroSim real-time memory allocator claims all its heap space at the startup of the library. That
amount is locked in with the provided EuroSim Embedded simulator library and hence the customer
should define the total amount of heap space for his embedded EuroSim application.
c Dutch Space BV 419
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
420
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Part IV
Appendices
c Dutch Space BV 421
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix A
Abbreviations
c Dutch Space BV 423
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Mk Mark
MMI Man-Machine Interface
NIVR Netherlands Agency for Aerospace Programs
NLR National Aerospace Laboratory NLR
org Organization
OSF Open Software Foundation
PCI Peripheral Component Interconnect
POSIX Portable Operating System Interface
RCS Revision Control System
RPC Remote Procedure Call
SGI Silicon Graphics Incorporated
SMDL Simulation Model Definition Language
SMI Simulation Model Interface
SMP Simulation Model Portability
SMP2 Simulation Model Portability 2
SPR Software Problem Report
SUM Software User Manual
TSP Transport Sample Protocol
URL Uniform Resource Locator
UTC Coordinated Universal Time
WINNT Windows NT
VME VERSAmodule Eurocard
XML Extensible Markup Language
424
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix B
Definitions
Action From a user’s perspective, an action is part of his scenario, and defines both the required re-
sponse to be taken when an event occurs, plus the required event. An action can be one of
stimulus, recorder, monitor, intervention, and event. EuroSim provides specific editors for de-
fault recorders and stimuli, and a generic action editor for all other actions and customized
recorders, stimuli and monitors. Monitor actions are obsolescent and are replaced with MMI
definitions.
Application definition file
Format of files created by LynX; contain initialization and run-time information for a Vega
application. Files have a .adf extension.
Data dictionary
A list of public data variables and parameters extracted from model code, i.e. those which are
accessible to the user for (optionally) updating, monitoring and recording. The list is augmented
with descriptive information (such as units, default values, ranges).
Data View
A subset of the data items in the EuroSim data dictionary. Used to define data items which are
to be read/written by an external simulator at run time, and therefore provides a mechanism for
sharing data between two independent simulators.
Entry point
A function or procedure in the model code (for which some restrictions apply) which can be
used to create tasks in the Schedule Editor.
Event A discrete occurrence during a simulation run, which (can) cause a change in the behavior of
the system being simulated, for example a component failure.
Execution state
The state of a simulator. Certain user requests are only valid in certain states.
External simulator
A simulator which is not running under EuroSim.
Facility management
The means of providing maintenance support and project and user management during the
simulation life cycle.
Flight format
Binary format used for input and output by the MultiGen and ModelGen database modelling
tools. It is a comprehensive format that can represent nearly all imaging concepts. Files in
Flight format are structured as a linear sequence of records and have a .flt extension.
Hardware-in-the-loop
A piece of equipment which forms part of the real-world system, which is given a real-time
interface to the simulation loop.
c Dutch Space BV 425
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Initial condition
Consistent set of model state values, to put the model into a particular state at the beginning
of a simulation run. In EuroSim, the initial condition can be created with the Initial Condition
Editor, or it can be a snapshot of values from previous simulation run.
Journal Information resulting from a particular simulation run(excluding sampled data values), e.g. log
of executed event s, error/warning messages, and marks.
Man-in-the-loop
A person taking on the role of an operator within the real-world application, who is provided
with a real-time interface to the simulation loop.
Mark A pointer or reference mark made by a user during a simulation run, to provide an easy means
of returning to a point of interest during test analysis.
Simulation Definition
Complete definition of a particular test for a particular model and schedule, specifying the initial
conditions, stimuli and variables which are to be recorded. For on-line evaluation, variables can
also be viewed on screen by specifying monitors.
MMI Definition
Defines the contents of a tab page in the Simulation Controller used for interacting with the
simulator. Normally this tab page contains one or more monitors.
Model A set of components (sub-models and data files) which together define the data and behavioral
characteristics of a specific real-world system, or part thereof. See Simulator.
Observer
The user who (optionally) attends asimulation run and who may select variables for viewing,
and mark interesting observations, but who is not able to affect the execution outcome in any
way.
Operational modes
EuroSim provides different modes of use which are available to one or more users; for exam-
ple, the Model Developer uses EuroSim for simulator development, the Test Analyst uses it for
analysis of test results. Particular user activities are only available during particular modes, for
example application model s can only be updated during simulator development. EuroSim is
able to support two or more modes simultaneously. See simulator development, test prepara-
tion, test execution, and test analysis.
Phase A time offset between completion of one task and activation of another task which is dependent
on that completion, defined as a quantity of wall-clock time.
Real-time
During real-time execution or interfacing, the time-lining of the activities appears to be that
which would be seen in an equivalent situation in the real-world. This is achieved through
guaranteed periodicity of processing and response time within fixed deadlines.
Schedule
A set of attributed tasks, timers, scheduling events and their respective dependencies. The
overall behavior of a schedule is deterministic, whereas that of a single task need not be. A
schedule is executed by the scheduler. The scheduler has four states: Initializing, Standby,
Executing and Exiting. Every state has its own schedule. The same task may appear in one or
more state schedules.
Simulation
The process of using models that behave or operate like a given system when provided a set of
controlled inputs.
Simulation program
The computer program, built out of simulator software, used for the simulation.
426
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Simulation run
Execution of a simulator according to specified simulation definition.
Simulator
A hardware device or simulation program or combination of both with which simulation can be
performed. A simulator together with a simulation definition can be used to start a simulation
run.
Simulator development
Mode of operation, where the Model Developer can create and/or update models and simulator
definitions, and generate simulators. See Operational Modes.
Simulator software
Model-dependent software combined with model-independent software for the performance
and control of real time and non-real time simulation.
State The current phase in the execution of the simulation. EuroSim states are: initialization, standby,
executing and exit.
Stimuli A set of data which are input to the model during a simulation run, which represent data from
an interfacing system or sub-system which would normally be present in the real-world; they
can be used during replays of simulation runs, to provide copies of the original operator inputs.
Sub-model
A component of a model, which defines (in source code) an element or set of elements within
the real-world application. The parts of a sub-model visible to other “users” are the set of
accessible state data items (which are listed as part of the model data dictionary) and a set of
operations which can be called by other sub-models or listed within a task within the schedule.
System services
A set of services offered by EuroSim which can be called directly from model code, for example
in order to request information on the current simulation (e.g. simulated time, execution state),
or to communicate with HIL devices.
Task A unit within a model schedule consisting of an ordered list of one or more entry points. Task
execution starts with the first entry point listed, and suspends (always) after the last entry point
listed has been executed. It is possible for tasks to be executed in parallel in a multi-processor
environment.
Test analysis
Mode of operation, where the Test Analyst can mathematically analyze test results, replay vi-
sual images and export data for external use. See Operational modes.
Test Conductor
The user who operates the simulator as a tool to perform a simulation run.
Test execution
Mode of operation, where the Test Conductor has interactive control of a simulation run, and
may initiate on-line events. The Test Conductor and (optionally) an Observer may also monitor
data dictionary item values and create marks. See Operational modes.
Test preparation
Mode of operation, where the Test Conductor can create and/or update simulation definitions,
and an Observer can identify data dictionary items for monitoring. See Operational modes.
Test results
All information resulting from a particular simulation run, i.e. the journal and the recorded
data dictionary item values.
c Dutch Space BV 427
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
428
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix C
Scheduler Errors
cycle There is a cycle in the schedule (i.e. following the flows you can come back where you started).
Break the cycle by removing a flow or task.
critical
Timing problem. The scheduler can not guarantee that the task can be completed in the available
time. Modify timing of item or items connected to item concerned.
c Dutch Space BV 429
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
W This message is a warning. It indicates a potential problem, which does not yet prevent the
system proceeding.
S This message should not occur (it stems from a file generated by EuroSim itself). Submit an
SPR for this message.
Each message is accompanied by a short description and recovery suggestions if recovery by the user is
possible.
E: at line nnn, number of real time processors must be within the range [1...p]
The schedule definition file requests a number of real time processors which is larger than
physically available. Correct the definition file by choosing a processor in the reported range,
or restart with real time privileges off (no super-user authorities). This latter will result in non
real-time execution mode, in which any number of ‘real time’ processors may be emulated.
E: at line nnn, basic frequency must be within the range (0...f]
A scheduler clock frequency beyond the system-imposed limit has been requested in the sched-
ule definition file. Choose a clock frequency which falls within the reported range.
ES: at line nnn, task sss has not been defined in the current state
In each EuroSim state, tasks must be declared before use in the schedule definition file; appar-
ently this is not the case for the reported task. Add (or move) the declaration of the task.
ES: at line nnn, store sss has not been defined in the current state
In each EuroSim state, stores must be declared before use in the schedule definition file; appar-
ently this is not the case for the reported store. Add (or move) the declaration of the store.
ES: at line nnn, inputconnector sss has not been defined in the current state
In each EuroSim state, input connectors must be declared before use in the schedule defini-
tion file; apparently this is not the case for the reported input connector. Add (or move) the
declaration of the input connector.
ES: at line nnn, outputconnector sss has not been defined in the current state
In each EuroSim state, output connectors must be declared before use in the schedule defini-
tion file; apparently this is not the case for the reported output connector. Add (or move) the
declaration of the output connector.
ES: at line nnn, this processor number falls outside the defined range of real time
processors
In the schedule definition file, a task has been allocated to a processor which is not in the range
of real time processors which has been requested in the same file. Lower the processor number
of the indicated task such that it falls in the range requested at the RT_PROCESSORS request.
430
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 431
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
W: An output event raised by connector sss was lost due to insufficient buffer
space. Raise the total capacity of this output connector in this state (currently
nnn) and rerun the simulation
Self explanatory.
W: pending state buffer overflow; state transition request ignored
A very rapid sequence of state transition requests has caused an overflow of an internal buffer.
Slow down with changing states by modifying schedule.
W: hard real time error at uptime=nnn msec: periodic tasks were still active when
they should have completed; basic cycle has been extended
An overload condition has been detected, in which execution of a periodic task took longer
than its allowed execution time (unless otherwise specified, this allowed time is equal to its
activation period). The system responds to this situation by slowing down the real time.
Increase number of real time processors used (if possible), or decide if the effective schedule is
not optimal. A schedule is not optimal if processors are unused for longer time spans1 where this
could have been avoided by a ‘smarter’ activation order of previously executed tasks. In these
cases, scheduling can be influenced by processor allocation, use of task offsets and -priorities,
and by adding dependencies between tasks.
W: illegal state transition from sss to sss (ignored)
An unallowed EuroSim state transition has been requested. It is ignored. Check the state
transition diagram for legal transitions.
W: real time mode transition refused: this machine is non real-time
A transition of RT_SCHD’s mode to mode ‘real time’ has been requested in a simulation which
runs with insufficient authorities, or which runs on a machine without real- time capabilities.
The mode transition is ignored. Re-run with super user authorities, and use a multiprocessor
platform.
W: frequency change refused: this simulation is in real time execution mode
A request has been given to change the clock frequency to a rate different from the rate on which
the current schedule is based (200 Hz default). This request is refused in real time simulation
mode. Make a mode transition to mode ‘non real-time’.
W: frequency change refused: the requested frequency (nn Hz) is larger than the
bound imposed by the system (nn Hz)
A request has been given to change the clock frequency to a rate higher than a system-imposed
bound. This has been ignored. Choose a lower rate.
W: itemname hard real time error for itemtype (itemdetails): previous firing not
completed; basic cycle has been extended
The specified item has generated a hard real time error.
• They are raised at system initialization, when the message mechanism has not yet been initialized.
These errors usually result in a text like ‘error: description’.
• They cannot be caught (e.g. bus errors, access violations). These errors usually result in a core
dump.
1
‘Longer’ here is relative to the time granularity of the simulation, so it might apply to one or more milliseconds.
432
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• They are on the level of code assertions, in libraries which do not ‘know’ the message mechanism.
These errors usually result in a text like ‘Assertion failed’.
All errors of these kinds are reported through standard error, i.e. they are displayed on the console or the
window in which EuroSim was started. In most cases, they indicate a problem in RT_SCHD and should be
reported through an SPR. The second category of errors may also be caused by errors in the user code.
c Dutch Space BV 433
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
434
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix D
EuroSim services
This appendix describes all services and their interface description available for simulation models that
want to use the EuroSim services.
These services can be used both from C as well as Fortran programs. In the latter case the function calls
are all in lower or upper case (depending on your programming style). Below a short description of the
available functions is given. For more information, refer to the esim(3C) man page.
D.1 Synopsis
D.1.1 Usage in C
#include <esim.h>
double esimGetWallclocktime(void)
struct timespec esimGetWallclocktimets(void)
double esimGetHighResWallclocktime(void)
c Dutch Space BV 435
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
int use_simtime)
struct timespec esimGetMainCycleTime(void)
struct timespec esimGetMainCycleBoundarySimtime(void)
struct timespec esimGetMainCycleBoundaryWallclocktime(void)
436
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 437
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
438
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Do not forget to check the ‘Gnat Ada runtime libraries’ option in the Model:Options window of the
Model Editor (see Figure 6.4).
c Dutch Space BV 439
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
440
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Do not forget to check the ‘EuroSim Java integration library’ option in the Model:Options window of the
Model Editor (see Figure 6.4).
The Java model interface currently does not cover the full range of run-time functions. This will be
improved in future releases.
c Dutch Space BV 441
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
...
native public static double esimGetSimtime();
native public static int esimSetSimtime(double simtime);
native public static double esimGetWallclocktime();
...
}
442
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
...
native public static int esimSetSpeed(double speed);
native public static double esimGetSpeed();
native public static int esimGetRealtime();
native public static int esimSetRealtime(int on);
...
}
c Dutch Space BV 443
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
precision is equal to that period. If the simulator has real-time errors the simulation time will be slower
than the wall clock. The simulation time is set to zero (0) on arriving in initializing state.
esimGetWallclocktime() returns the wallclock time in seconds. The basic resolution is equal to the
resolution of the high-res time described next, but is truncated to milliseconds. The wallclock time is set
to zero when the first model task is scheduled, and runs real-time which means that is independent from
the simulation time.
esimGetWallclocktimets() returns the wallclock time in a timespec structure. It replaces the obsoles-
cent esimGetWallclocktimeUTC().
esimGetHighResWallclocktime() returns the “same” time as esimGetWallclocktime() but in mil-
liseconds and with a higher resolution. This high resolution is 21 ns on high-end platforms such as a
Challenge and Onyx. On low end platforms this resolution is as good as what can be achieved by the
gettimeofday(3) call.
esimGetSimtimets() returns the simulation time in a timespec structure. It replaces the obsolescent
esimGetSimtimeUTC().
esimGetSimtimeYMDHMSs() returns the simulation time in an array of 7 integers containing: year, month,
day, hour, minute, second and nanoseconds.
esimSetSimtime() sets the requested simulation time simtime in seconds. This can only be done in the
standby state. If calling esimSetSimtime in any other state is attempted or simtime is less than zero, no
simulation time is set and (-1) is returned. On success zero (0) is returned.
esimSetSimtimets() sets the simulation time using a timespec structure. It replaces the obsolescent
esimSetSimtimeUTC().
esimSetSimtimeYMDHMSs() sets the simulation time using an array of 7 integers containing: year, month,
day, hour, minute, second and nanoseconds.
esimGetState() returns the current simulator state. The state can be any of the following values:
esimUnconfiguredState, esimInitialisingState, esimExecutingState,
esimStandbyState or esimStoppingState.
esimSetState() sets the simulator state to the indicated value state. state can be any of the following
values: esimUnconfiguredState, esimInitialisingState, esimExecutingState,
esimStandbyState or esimStoppingState. If state is not reachable from the current state 0 is returned;
on a successful state transition 1. is returned.
esimSetStateTimed() sets the simulator state to the indicated value state at the specified time t. The
possible values of state are listed in the previous paragraph. If the flag use simtime is set to 1 (true),
the specified time is interpreted as simulation time. If the flag is set to 0 (false), the specified time
is interpreted as the wallclock time. The transition time uses a struct timespec where the number of
seconds is relative to January 1, 1970. On success this function returns 0, otherwise -1.
esimGetMainCycleTime() returns the main cycle time of the schedule. The result can be used to com-
pute valid state transition times for use in the function
esimSetStateTimed().
esimGetMainCycleBoundarySimtime() returns the simulation time of the last state transition. This
boundary time can be used to compute valid state transition times for use in the function esimSetStateTimed()
when the value of use simtime is true.
esimGetMainCycleBoundaryWallclocktime() returns the wallclock time of the last state transition.
This boundary time can be used to compute valid state transition times for use in the function esimSetStateTimed()
when the value of use simtime is false.
esimGetTaskname() returns the name of your current task.
esimGetTaskrate() returns the frequency (in Hz) of your current task.
444
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
esimDisableTask() disables the task ‘taskname’ defined with the Schedule Editor. It will be skipped
(not executed) by the EuroSim runtime until a call is made to esimEnableTask.
esimEnableTask() enables the task ‘taskname’ defined with the Schedule Editor. It will be execut-
ed/scheduled according to the schedule made with the Schedule Editor.
esimEntrypointFrequency() stores the frequency (in Hz) of the entry point with the name ‘entrypoint’
in the argument ‘freq’ in the state ‘state’. If the entry point appears multiple times in the schedule the
function returns -1. If the entry point does not appear in the schedule in the given state, the frequency is
0.
esimEventRaise() raises the event eventname for triggering tasks defined with the Schedule Editor.
User defined data can be passed in data and size. On success this function returns 0, otherwise -1.
esimEventRaiseTimed() raises the event eventname for triggering tasks defined with the schedule editor
at the specified time t. User defined data can be passed in data and size. If the flag use simtime is set to
1 (true), the specified time is interpreted as simulation time. If the flag is set to 0 (false), the specified
time is interpreted as the wallclock time. The transition time uses a struct timespec where the number of
seconds is relative to January 1, 1970. On success this function returns 0, otherwise -1.
esimEventData() gets the data passed with the event. This function can only be used in the task con-
nected to the input connector. Beware that the size argument is both input and output. It specifies the size
of the buffer pointed to by the data pointer, and is set by esimEventData to the actual number of bytes
written in that buffer.
esimEventTime() gets the timestamps of detection of the occurrence of the external event (e.g. interrupt)
and the timestamp of injection of the event into the scheduler as a EuroSim event. This function can only
be used in the task connected to the input connector.
esimEventCount() returns the number of times that event eventname has been raised or -1 if no such
event is defined.
esimGetRealtime() returns the current operational state of the EuroSim real-time Scheduler. If 1 is
returned, hard real-time execution is in progress, whereas a return of 0 indicates that your model is not
executing in real-time mode.
esimSetRealtime() sets the current operational state of the EuroSim real-time Scheduler. Hard real
time execution can only be set if the scheduler was launched in hard real time mode. 1 is returned on
success. 0 is returned on failure.
esimGetSpeed() returns the current speed of EuroSim Scheduler. e.g. 1.0 means (hard or soft) real time.
0.1 means slowdown by a factor 10. -1 means as fast as possible.
esimSetSpeed() sets the current speed of EuroSim Scheduler. e.g. 1.0 means (hard or soft) real time.
0.1 means slowdown by a factor 10. -1 means as fast as possible. The speed can only be changed if the
scheduler is running non real-time. If speed is not a feasible speed 0 is returned; on a successful setting
of the speed 1 is returned.
esimGetRecordingState() returns the current state of the EuroSim real-time data Recorder. If true is
returned, data is logged to disk, whereas a return of false indicates that recording is switched off.
esimSetRecordingState() sets the state of the Recorder to on. If on is true data will subsequently
be written to disk, if on is false data recording will be suspended. Return value is either true or false,
depending on success or not.
The functions esimReport, esimMessage, esimWarning, esimError and esimFatal can be used to send
messages from the EuroSim model code to the test-conductor interface. The esimReport function allows
the caller to specify the severity of the message. The other functions have implicit severities. The possible
severity levels are:
c Dutch Space BV 445
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
It is possible to define your own severity levels. The function esimReportAddSeverity creates a new
severity with the name sev name. The return value of the function is the new severity that can be used in
calls to esimReport().
In the C interface routines the message consists of a format string format and its optional arguments. (see
printf(3)). In the Fortran interface routines the message consists of a single string argument message.
esimRecOpen() opens a user-defined recorder file. The file is opened for writing. If the path is relative,
the file is created in the recorder directory. The flags parameter contains configuration and/or option
flags. It shall be set to 0 if no options are selected. The recorder handle is returned. On error NULL is
returned.
esimRecWriteRaw() writes the size bytes of data in ptr to the recorder file indicated by the recorder
handle rec. On error -1 is returned, on success 0.
esimRecWriteHeader() writes the recorder file header to disk. The simulation time is automatically
included as the first field of each recording. After calling this function no more fields can be added to the
recorder. Only calls to esimRecWriteRecord() and esimRecClose() are allowed. rec is the recorder
file handle. On error -1 is returned, on success 0.
esimRecWriteRecord() samples all the variables that are in the recording referenced by rec and writes
it to disk. On error -1 is returned, on success 0.
esimRectypeFieldAdd(), where type can be Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64,
Float or Double, is used to add a data field to the recorder of the specified type. rec is the recorder file
handle. name is the symbolic name of the field. address is the address pointing to the variable to be
recorded. On error -1 is returned, on success 0.
esimRectypeArrayFieldAdd(), where type can be Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64,
Uint64, Float or Double, is used to add an array data field to the recorder of the specified type. rec
is the recorder file handle. name is the symbolic name of the field. n elem is the number of elements
in the array. address is the address pointing to the variable to be recorded. On error -1 is returned, on
success 0.
esimRecClose() closes the user-defined recorder file indicated by recorder handle rec. On error -1 is
returned, on success 0.
esimThreadCreate() creates a new non-real-time thread in the address space of the simulator. The
thread starts the routine start routine with argument arg. The name of the thread is given in name. This
function should only be called from a non real-time task. Usage from a real-time task will result in a
warning message and no further action taken.
esimThreadKill() sends signal signal to thread thread.
esimThreadExit() ends the current thread with exit code exit val.
esimgetProcessor() returns the number of the logical processor that executes the esimGetProcessor
call. Only when running real-time, the logical number matches the physical processor number. In
non real-time simulations the logical number would remain constant, whereas the actual execution may
switch physical numbers to optimize load balancing. When the processor setting in the schedule is ANY
processor, the returned number can fluctuate as the logical processor may change depending on which
processor is first ready to execute the calling task.
esimVersion() returns a string indicating the current version of EuroSim that you are running.
esimInstallErrorHandler() installs a user-defined error handler callback of the form:
446
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
This callback function is called when an error occurs that may need intervention in user code.
Passing a NULL pointer will de-install the user error handler. No stack of user error handlers is main-
tained. This means that the last call to esimInstallErrorHandler defines which handler will be called.
The possible values for scope are:
• esimDeadlineError when the user defined error handler is called with this scope then the objectid
is the name of a task in the simulator schedule that has exceeded its deadline by a factor of ten.
This allows a model developer to take action (f.i. force a core dump) when part of a model is
ill-behaved (never ending loops or simply a calculation that takes too long and causes real-time
errors). If no error handler is installed, the default action is to disable the offending task and enter
the stand-by state. Note that deadline checking is only performed when the simulator is running in
real-time mode.
esimAbortNow() immediately starts termination and cleanup of the simulator. This is useful when an
error condition is found (f.i. at initialisation time) and no more entry points should be scheduled for
execution.
esimIsResetting() returns true when the reset procedure is in progress and false when it is not. The
reset procedure starts in standby state and progresses through exiting, unconfigured, initializing and back
into standby state. This function allows you to distinguish between for example a user initiated state
transitions to exiting state to stop the simulator and the state transitions performed in the reset procedure.
esimGetHeapUsage() returns the real-time heap size, the maximum heap size used since startup and the
current use (all reported in bytes)
esimSetLoadMeasureInterval() sets the measurement interval (msec) over which the processor load
percentages will be measured. The interval must be equal to or be a multiple of the basic cycle period. If
not it will be truncated to the nearest multiple.
The start of a measurement interval is synchronized to a multiple of its period with respect to the start of
the simulation (t=0). Synchronisation is delayed until the end of the running measurement interval. If no
interval was set by a previous call to this function then synchronisation is started immediately.
Specifying a measurement interval equal to the major cycle time allows acurate load measurements of
the major cycle to be made using the function esimGetProcessorLoad()
c Dutch Space BV 447
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
esimGetProcessorLoad() reads the maximum load and the average load of the specified processor (0-
100%). The maximum is defined as the maximum percentage of time a processor was executing model
tasks during a measurement interval (set by esimSetLoadMeasurementInterval()). The returned load
values are only accurate when i the simulator is running real time. Processing time of Eurosim itself
and possible event handlers is not included. The maximum is reset each time the processor load is read
(using this function). The average load is calculated over the number of measurement intervals that
passed since the last call to this function. I.e. if the time interval is set to the main cycle period (by
esimSetLoadMeasurementInterval) and this function is called every fourth main cycle, then the average
load is calculated over the loads of the last four (completed) main cycle periods. Calling this function
every main cycle will return the processor load over the last completed main cycle.
Note that under normal circumstances the above options will be passed to the simulator by the EuroSim
daemon.
Example of a debugging session, running the simulator from the command line using gdb. Note that you
448
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
$ gdb mysimulator.Linux/mysimulator.exe
c Dutch Space BV 449
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
450
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix E
The Mission Definition Language MDL is a simple yet versatile language for simulation scripting. It
allows users to write simulator control scripts in a “C-type”, or—alternatively—in a limited “free-text”
language. The language has all the facilities one can expect of a programming language, including if-
statements, for-loops, global and local variables. Besides that, the user has full access to the variables in
the EuroSim data dictionary. Direct simulation control commands can also be used in the language.
This appendix first starts with a primer in MDL, followed by a number of sections providing detailed
information on the various language elements. A description of the built-in functions and a concise
formal definition of the MDL language can be found in the last two sections of this appendix.
Note that the majority of MDL scripts in EuroSim will/can be made via the GUIs, for which the user
doesn’t need to know much about the MDL language. So this appendix is primarily intended for EuroSim
users who want to do ‘advanced’ things, not supported via the predefined GUIs. Throughout this section,
it is assumed that the reader has programming experience.
1. Action name.
3. Action body.
Each action in the MDL script is represented by an icon on the Simulation Controller’s tree or icon view.
The four parts of each action can be edited via the Simulation Controller (Section 11.14).
A simple example which prints a message 10 seconds into the simulation:
#
# action name and attributes
action "Primer" ["description",bitmap="script_stub",show+active+Executing
, 50 50, 1]
#
# action body
{
print "Hello at t=10"
}
#
# action condition
when (time() == 10)
c Dutch Space BV 451
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• Manipulate the appearance of the action on the Simulation Controller tree or icon view.
The action status can either be active or nonactive. Furthermore, one can specify in which of the four
simulation states the action has to be evaluated when active: Initializing, Executing, StandBy or
Stopping.
EuroSim maintains for each of these states a list of active actions. The action conditions of these actions
are checked each time the ACTION_MGR is activated (in that state and normally at the end of each simula-
tion step2 ). The action body is executed by EuroSim when the action condition evaluates true. When the
action has no condition part, this never happens; these actions can only be activated manually (by double
clicking the action icon on the Simulation Controller scenario tab page).
The MDL script is executed in the real-time part of EuroSim. In order to safeguard the real-time execution
of a EuroSim simulator, error conditions within MDL actions are handled in the following way:
2. An error message of this event is reported to the Test Controller and the journal log.
3. The specific action is deactivated so the action will not be executed again.
• Errors in action condition frequency specification (e.g. frequency higher than the ACTION_MGR
frequency).
• Observers (which have “read only” access) trying to change the data dictionary variables from
actions, apply stimuli or raise events.
An MDL action body consists of statements separated by newlines or by a semicolon. The latter may—
however—only be used to separate multiple statements on a single line. MDL is case sensitive. Everything
following a ‘#’ sign until end-of-line is considered comment.
MDL is a powerful languages, but remember that it is an interpreted language, running in the real-time part
of the simulator. Hence keep your scripts as simple and small as possible. Don’t write large loops and
keep computation to a minimum. If you have to do serious programming and/or computation, consider
adding an extra sub-model and associated tasks to you model.
1
Initial, as this can change during the simulation.
2
See Section 10.3.5 for scheduling of the ACTION_MGR.
452
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Variables which are explicitly declared as one of the above are called ‘static’ variables. Static variables
are, in the absence of an initializer, always initialize at zero or the empty string. Variables need not be
declared in MDL. Undeclared variables are created automatically the first time they are used as a left hand
value in an assignment. These variables are called ‘automatic’ variables.
The scope of variables is that of the enclosing action body (or function; see below). By prepending the
action or function name, the static variables from other actions and functions can be accessed. Static
variables retain their values in between different action or function invocations. Automatic variables are
recreated each time their scope is entered and disappear when that scope is left.
Automatic type conversions are applied when needed between all the basic types.
Constants can be given either in decimal, octal or hexadecimal form, as in ‘C’. Constants are of type int,
except when the constant contains a decimal dot or is given in scientific notation (e.g. 3e-9), in which
case they’re of type float. A string constant consists of a number of characters between double quotes.
Some examples with MDL variables and constants:
action "action1"
{
int a_variable # a static variable of type int
b_variable = "100" # an automatic variable of type string
a_variable = b_variable # type conversion from string to int
}
action "two_externals"
{
float f = action1:a_variable
print f # prints: "100.0000"
print action1:a_variable # prints: "100"
print "action 2":a_variable # prints: "hello world"
}
action "externals_from_another_file"
{
print "common_actions.mdl":action1:b_variable
print "common_actions.mdl":"action 2":c_variable
}
action "showtime"
{
# NB: No UTC selected
datetime t = 5.900
3
int and float are implemented as C doubles; check the documentation of your platform to see the valid range for that
type.
c Dutch Space BV 453
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
action "showtimeUTC"
{
# NB: UTC selection in model options
datetime t = 2001-02-24 16:10:05.900
print "time = ",t + 15.2 # prints: "time = 2001-02-24 16:10:21.1000"
}
Arrays of basic types can be constructed using square brackets. Arrays must have fixed dimensions and
type (no automatic arrays). Assignments are between basic types only.
action "sum"
{
int a[10]
for (i = 0; i < 10; i = i + 1) a[i] = i
print ""
print "# forloop test2, expect loopcount=", N
for (i = 1; i < 10 * N; i = i + 1) {
j = j + 1
if (i == N) break;
}
print "loopcount=", j
}
# free-style syntax
action "looptest5"
4
See Section E.6 for a complete list of reserved, but unused words.
454
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
action_begin
N = 3000
k = 0
print ""
print "# forloop test5, expect loopcount=", N
print "loopcount=", k
action_end
E.4 Functions
MDL has an extensive set of built-in functions for simulation support: see Section E.6. It also supports
user defined functions. Functions return simple values and can be used freely in MDL expressions.
User functions can be defined and used within the action body. Function arguments and return values
must be basic types and behave like automatic variables. Within the function body the complete MDL
syntax can be used (e.g. to define local variables or other functions).
The type of the function arguments and the type returned by the function may vary from invocation to
invocation, as is shown in next example.
action "my_action"
{
int i
float x
error = 0
function sqr(n)
{
return n * n
}
for (i = 0; i < 5; i = i + 1) {
# sqr with int
if (sqr(i) != i * i) error = error + 1
}
c Dutch Space BV 455
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
action "accel"
{
object:speedup()
print "speed=", object:current() # prints: "speed=20.0"
}
Warning: because all MDL variables have static storage, recursive function calls may have unexpected
results.
An example of the latter is the print command, already shown in many of the previous examples. It
prints the given expression on the Simulation Controller’s message pane and in the simulation log.
MDL provides access to variables in the simulation model via the model’s data dictionary. Array elements
are selected using square (C) or round (Fortran) brackets. More dimensional array indexing follows the
conventions of the sub-model language. Members of user defined type variables in C sub-models are
selected using a dot:
action "position"
{
# print three elements of an array in a Fortran style loop
N = 3
for i is 1 to N loop begin
print "position(", i, "): ", :source.f:position(i)
end
}
action "clear"
{
# clear all elements of an 2-dim. array in a C style loop
for (i = 0; i < 10; i = i + 1)
for (j = 0; j < 10; j = j + 1)
:source.c:matrix[i][j] = 0
function f()
{
x += 1.0
456
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
return x
}
n++;
record "file1" n, f(), :A:B:C:source1.c:work1:local1
record "file3" :A:E:C:source2.c:work4:localUdt
record "file2" :A:E:C:source2.c:work4:localUdt[0].count
}
when (freq(100))
Note that also MDL variables can be recorded; this can be used e.g. for recording a derived variable
(derived from one or more data dictionary variables).
From within MDL, the user has full control over the simulator by means of functions like go, freeze,
stop, etc. (see Table E.5) Also, from one action, one can activate other actions but also tasks and entry
points within the model.
Functions return a value, whereas commands do not. Functions can be used in expressions. The MDL
built-in functions all take numerical (or no) arguments. Required arguments are indicated as follows:
Arguments may be functions themselves. Non-numerical arguments are automatically converted to nu-
merical.
Function Description
atan(x) Compute arc tangent of x and return it. Return value will be between −π/2 and π/2.
cos(x) Compute cosine of x and return it. x is in radians.
exp(x) Compute the x‘th power of e and return it. e is the base of natural logarithms.
fabs(x) Compute the absolute value of x and return it.
log(x) Compute the natural logarithm of x and return it. If x is less than or equal to 0, a run
time error results.
sin(x) Compute the sine of x and return it. x is in radians.
sqrt(x) Compute the square root of x and return it. If x is less than 0, a run time error results.
tan(x) Compute the tangent of x and return it. x is in radians.
acos(x) Compute the arc cosine of x and return it. Return value will be between 0 and π. If x is
not between -1 and 1, a run time error results.
Table E.2: Mathematical functions.
c Dutch Space BV 457
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Function Description
asin(x) Compute the arc sine of x and return it. Return value will be between −π/2 and π/2.
If x is not between -1 and 1, a run time error results.
ceil(x) Rounds up x to the next highest integer and return it.
cosh(x) Compute the hyperbolic cosine of x and return it.
floor(x) Rounds down x to the next lowest integer and return it.
log10(x) Compute the (base 10) logarithm of x and return it. If x is less or equal than 0, a run
time error results.
sinh(x) Compute the hyperbolic sine of x and return it.
tanh(x) Compute the hyperbolic tangent of x and return it.
Table E.2: Mathematical functions.
1
frac(x) 1
sin(x)
0 0
-1 -1
-2 -1 0 1 2 -4 -3 -2 -1 0 1 2 3 4
2
fabs(x) 3
floor(x) 3
ceil(x)
2 2
1
1 1
0 0
0
-1 -1
-1 -2 -2
-3 -3
-2 -3 -2 -1 0 1 2 3 -3 -2 -1 0 1 2 3
-2 -1 0 1 2
Function Description
doublet(x) Compute the doublet of x and return it. If x is between 0 and 1 return 1, if x is
between 0 and -1 return -1, else return 0.
ramp(x) Compute the ramp of x and return it. If x is less than zero return zero, if x is greater
than 1 return 1, else return x.
jigsaw(x) Compute the jigsaw of x and return it. If x is less than 0 return 0, if x is greater than
1 return 0, else return x.
step(x) Compute the step of x and return it. If x is less than 0 return 0, if x is greater than 0
return 1.
frac(x) Compute the frac of x and return it. Frac is the remainder of x from its nearest
integer value.
Table E.3: Signal processing functions.
458
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
1
doublet(x) 1
jigsaw(x)
0 0
-1 -1
-2 -1 0 1 2 -2 -1 0 1 2
1
step(x) 1
ramp(x)
0 0
-1 -1
-2 -1 0 1 2 -2 -1 0 1 2
By combining (or modulating) the various functions in expressions, many types of signals and if-type
functions can be constructed. For example:
• x*step(-x)+x*x*step(x) results in a line for x less than zero and a parabola for x greater than
zero.
Function Description
duration() Return the elapsed simulation time (in seconds) that the action has
been continuously (i.e. at each activation of the ACTION_MGR)
executed. Elapsed time is reset to zero when the action is not
executed. This function can be used to have an action run for a
certain period of time.
eventcount(x) Return number of times event x has been raised in the schedule.
Returns -1, if the event name is unknown.
format(x,...) Return formatted string, using printf like format specification.
E.g. str = format("Hex value=%4x", :model:var)
freq(x, y) Use this function to have an action executed at a given frequency
with a given offset. The offset argument is optional and defaults to
0 (i.e. no offset). It returns 1 if desired frequency x (in Hertz) is met
by internal basic frequency and with the given offset y (in ms), else
freq returns 0. The basic frequency is the frequency with which
ACTION_MGR is scheduled. Depending on the scheduling table used,
this frequency may differ from the scheduler basic frequency. If the
basic frequency is not an exact multiple of the desired frequency x
the desired frequency will be approximated in the long run. When
parsing an action with a freq function, the ACTION_MGR will issue a
warning if this is the case (provided x is a constant).
Table E.4: Auxiliary functions.
c Dutch Space BV 459
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Function Description
The last table explains the MDL commands. The commands take numerical or string arguments. Contrary
to functions, the command arguments are not to be given between parenthesis and commands do not
return a value. Hence they cannot be used in expressions.
Command Description
deactivate action | deactivate an action or disable a task. Actions from other MDL
task files may also be used. The action name must be prepended with
the MDL file name (basename only). Actions and tasks must be
specified as strings:
Table E.5: Input/Output and Control commands (do not return values)
460
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Command Description
exec action | execute action or model entry point or model task from within
entrypoint | task another action. Actions from other MDL files may also be used.
The action name must be prepended with the MDL file name
(basename only). Action, entry points and tasks must be
specified as strings:
pause (or freeze) request change simulator state from ‘executing’ to ‘standby’.
print expression list5 Evaluate the expressions in the expression list and print them on
the message pane and journal file.
Table E.5: Input/Output and Control commands (do not return values)
5
An expression list is a comma-separated list of expressions.
c Dutch Space BV 461
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Command Description
raise event raise an input event as defined in the EuroSim schedule, e.g.:
raise "HARDWARE_FAILURE"
record [per switch] Record one sample of a given set of variables to an optionally
[filename] dictlist6 named file. The simulation time is recorded implicitly and need
(or registrate, not be specified. The optional per switch argument specifies the
datalog) time (in seconds or hours) in case a recorder file should
periodically switch. The filename argument is optional. It can be
used for “named” recording. If filename is not specified, the
action’s name suffixed by .rec will be used as file name. In case
of a periodic switch the filename becomes filename-00n (with
switch counter n).
reinit ["soft" | "hard"] Reload the data dictionary with the values from a snapshot file.
filename (or If the “hard” option is given the simulation time will be set to the
initialise, init) value defined in the snapshot file. The “soft” option is the
default. When this option is used (or no option) the simulation
time in the snapshot file is ignored. After the loading of the file
has finished the scheduler event SNAPSHOT_END is raised so that a
task can be triggered to use the values to reinitialize external
hardware for instance.
run (or go) Request change simulator state from ‘standby’ to ‘executing’
schedspeed expression Set the scheduler speed to result of expression.
schedspeed("AFAP") sets the scheduler in ‘as fast as possible’
mode. This function only has effect if the scheduler is in
non-realtime mode.
set realtime Change the real-time mode to result of expression.
expression
set time expression Change the simulation time to result of expression.
snapshot [filename] Make a snapshot of the current data dictionary and save it to a
file. Default file name is snapshot-n.snap, n=0, 1, 2, ...
stimuli ["soft" | "hard" Stimulate the specified set of data dictionary variables with the
| "cyclic"] filename next record of values contained in filename. If the “hard” option
dictlist is given, the next record in the stimuli file will be applied when
the given timestamp (value in first column in the stimuli file)
matches the simulation time. In the default case “soft” the
timestamps are ignored. With the “cyclic” option the stimulation
is applied periodically, ignoring the timestamps.
stop request change simulator state to ‘stopping’
Table E.5: Input/Output and Control commands (do not return values)
462
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
’:’ indicates the start of the definition of the item listed before the colon. ’|’ indicates an alternative and
’;’ terminates the definition. So A: B|C|D; means that ’A’ can be ’B’, ’C’ or ’D’.
Bold words are literal strings.
string is a placeholder for an actual string, i.e. a sequence of characters, delimited by double quotes.
Example: "this is a string"
identifier is a placeholder for an actual identifier of a variable or function. Identifiers consist of a
sequence of letters, digits and the underscore and dollar character.
Examples: var1, _var2 and block$var3
external-identifier is a placeholder for an actual identifier of a variable or function coming
from another MDL action. It consists of the name of an action followed by an identifier of a variable
or function separated by a colon. The name of an action may contain spaces and therefore it is possible
to enclose the name of the action in double quotes. If there are no spaces in the name of the action the
double quotes are not needed.
Examples: action1:var1 and "action two":var2
dictpath is a placeholder for a data dictionary path name. A data dictionary path consists of a list of
orgnodes followed by an identifier separated by colons.
Example: :system-A:subsystem-B:source.c:variable_d
{Decimal} is a decimal number.
{Octadecimal} is an octal number. It starts with a 0 and consists of one or more numbers in the range
0-7.
{Hexadecimal} is a hexadecimal number. It starts with 0x and consists of one or more numbers in
the range 0-9 and letters in the range A-F or a-f.
{FloatingPoint} is a floating point number. It can have a decimal point and/or an exponent.
{Time} is a time specification. It has the following format: YYYY-MM-DD hh:mm:ss optionally fol-
lowed with a decimal point followed by fractions of a second. YYYY is the year in four decimal digits.
MM is the month of the year in the range of 1 to 12. DD is the day of the month in the range of 1 to 31.
hh is the hour of the day in the range of 0 to 23. mm is the minute of the hour in the range of 0 to 59. ss
are the seconds of the minute in the range of 0 to 59. You can specify sub-second precisions by adding a
fraction to the seconds.
Example: 2003-06-05 10:11:12.131415
#grammar:
MDL
/* MDL action scripts */
: MDLscript tEOF
| MDLfuncs Cont MDLscript tEOF
| tEOF
;
MDLscript
: Action
| MDLscript Action
;
MDLfuncs
: FunctionDeclaration
| MDLfuncs Term FunctionDeclaration
;
Action
: action string
/* CONTINUED */
Attributes Cont
/* CONTINUED */
ActionBody
Cont
/* CONTINUED */
ActionCondition
c Dutch Space BV 463
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
ActionBody
: CompoundStatement
| action begin Cont StatementList Cont action end
| action begin Cont action end
| { Cont }
| begin Cont end
| action begin Cont StatementList tEOF
| { Cont StatementList tEOF
| begin Cont StatementList tEOF
;
Attributes
: /* no attributes */
| [ AttributeList ]
;
ActionCondition
: /* no condition */
| When ( Cont PossibleCondition ) Term
;
When
: when
;
PossibleCondition
: /* nothing */
| Condition Cont
;
Condition
: Expr
;
/*
* ActionAttribute are used to manipulate:
* - appearance of Action in Action Sheet (GUI)
* - initial status of action, when condition is specified
*
*/
AttributeList
: ActionAttribute
| AttributeList , ActionAttribute
;
ActionAttribute
: ActionStateAttribute /* state attributes */
| PixelCoord PixelCoord /* x y position on action Sheet */
| {Integer} /* icon # on action Sheet */
| bitmap is string /* bitmap */
| bitmap = string /* bitmap */
| index is {Integer} /* index */
| index = {Integer} /* index */
| folder is string /* folder */
| folder = string /* folder */
| actionmgr is {Integer}
| actionmgr = {Integer}
/* action mgr nr */
| type is string
| type = string
| string /* description field */
;
ActionStateAttribute
: identifier
| ActionStateAttribute || identifier
| ActionStateAttribute or identifier
| ActionStateAttribute + identifier
| ActionStateAttribute plus identifier
;
CompoundStatement
: { Cont StatementList Cont }
| begin Cont StatementList Cont end
464
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
StatementList
: Statement
| StatementList Statement
;
Statement
: DeclarationList
| for ( Assignment ; Condition ; Assignment
) Cont Statement
| for Assignment to Expr loop Cont Statement
| while ( Condition ) Cont Statement
| do Statement while ( Condition ) Term
| do CompoundStatement while ( Condition ) Term
| continue Term
| break Term
| return Term
| return Expr Term
| Assignment Term
| BuiltInCommand Term
| FunctionCall Term
| ; Term
| IfStatement
| CompoundStatement Term
;
IfStatement
: if ( Condition ) Cont ThenStatement ElseStatement
| if ( Condition ) Cont ThenStatement
;
ThenStatement
: Statement
;
ElseStatement
: else Cont Statement
;
Assignment
: Lvalue is Cont Expr
| Lvalue = Cont Expr
| set Lvalue to Expr
| set Lvalue Expr
| ComplexAssignment
;
ComplexAssignment
: Lvalue += Expr
| Lvalue -= Expr
| Lvalue *= Expr
| Lvalue /= Expr
| Lvalue %= Expr
;
Lvalue
: Variable
;
Expr
: MdlExpr
| Variable
;
Argument
: MdlExpr
| Variable
;
MdlExpr
: Constant
| FunctionCall
| ( Expr )
| Expr + Expr
| Expr plus Expr
c Dutch Space BV 465
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
| Expr - Expr
| Expr minus Expr
| Expr / Expr
| Expr * Expr
| Expr times Expr
| Expr % Expr
| - Expr
| minus Expr
| Expr ˆ Expr
| Expr pow Expr
/* conditions */
| Expr == Expr
| Expr equals Expr
| Expr != Expr
| Expr not equals Expr
| Expr >= Expr
| Expr greater equal Expr
| Expr <= Expr
| Expr less equal Expr
| Expr > Expr
| Expr greater than Expr
| Expr < Expr
| Expr less than Expr
| Expr && Expr
| Expr and Expr
| Expr || Expr
| Expr or Expr
| Expr & Expr
| Expr | Expr
| Expr << Expr
| Expr >> Expr
| ! Expr
| not Expr
;
FunctionCall
: BuiltInFunction
| UserFunction
| ExternalFunction
;
UserFunction
: identifier ( )
| identifier ( ExprList )
;
ExternalFunction
: external-identifier ( )
| external-identifier ( ExprList )
;
BuiltInFunction
: wallclock boundary ( )
| realtime ( )
| time ( )
| duration ( )
| simstate ( )
| wallclock ( )
| main cycle ( )
| simtime boundary ( )
| disable entrypoint ( Expr )
| atan ( Expr )
| cos ( Expr )
| exp ( Expr )
| fabs ( Expr )
| log ( Expr )
| sin ( Expr )
| sqrt ( Expr )
| tan ( Expr )
| acos ( Expr )
| asin ( Expr )
| ceil ( Expr )
| cosh ( Expr )
| floor ( Expr )
| log10 ( Expr )
| sinh ( Expr )
466
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
| tanh ( Expr )
| doublet ( Expr )
| ramp ( Expr )
| jigsaw ( Expr )
| step ( Expr )
| frac ( Expr )
| catch ( Expr )
| eventcount ( Expr )
| getenv ( Expr )
| enable entrypoint ( Expr )
| format ( ExprList )
| freq ( ExprList )
| changed ( Expr )
;
BuiltInCommand
: activate Expr
| deactivate Expr
| exec Expr
| raise Expr
| set time Expr
| set realtime Expr
| schedspeed Expr
| print ExprList
| monitor string ExprList /* string contains options (obsolescent) */
| monitor ExprList /* no display options (obsolescent) */
| stimuli string ArgumentList /* first arg is file name */
| stimulate string ArgumentList /* first arg is file name */
| stimuli string string ArgumentList
| stimulate string string ArgumentList
| record string string ArgumentList
| datalog string string ArgumentList
| registrate string string ArgumentList
| record string ArgumentList
| datalog string ArgumentList
| registrate string ArgumentList
| record ArgumentList
| datalog ArgumentList
| registrate ArgumentList
| initialise Expr
| reinit Expr
| init Expr
| initialise string Expr
| reinit string Expr
| init string Expr
| AtomicAction
;
AtomicAction
: run
| go
| pause
| freeze
| stop
| abort
| snapshot Expr
| snapshot
| mark Expr
| mark
| health
;
ArgumentList
/* list of generic (may contain complex types expressions */
: Argument
| ArgumentList , Cont Argument
;
IdentList
: identifier
| IdentList , identifier
c Dutch Space BV 467
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Constant
: string
| {Integer}
| {FloatingPoint}
| {Time}
| zero
| off
| on
;
PixelCoord
: {Integer}
| + {Integer}
| plus {Integer}
| - {Integer}
| minus {Integer}
;
Variable
: identifier
| identifier ArraySelector
| ExternalVar
| DictVar
;
ExternalVar
: external-identifier
| external-identifier ArraySelector
;
DictVar
: DictPath
| DictPath DictSelectorList /* ctype selectors */
| DictPath ( ArgumentList ) /* fortran array */
;
DictPath
: dictpath
;
DictSelectorList
: DictSelector
| DictSelectorList DictSelector
;
DictSelector
: RecSelector
| ArraySelector
;
RecSelector
: .identifier
| RecSelector .identifier
;
DeclarationList
: Type identifier Term
| Type identifier is Expr Term
| Type identifier = Expr Term
| Type identifier ArraySelector Term
| FunctionDeclaration Term
;
FunctionDeclaration
: function identifier ( IdentList ) Cont
CompoundStatement
| function identifier ( ) Cont
CompoundStatement
;
ArraySelector
: [ Expr ]
| ArraySelector [ Expr ]
;
468
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Type
: int
| float
| string
| datetime
;
Cont
: /* nothing */
| tNEWLINE
;
Term
: tNEWLINE
| ;
;
#tokens:
tAND ASSIGN: &= (reserved)
tCASE: case (reserved)
tDEC OP: -- (reserved)
tDEFAULT: default (reserved)
tEOF: end-of-file
tINC OP: ++ (reserved)
tNEWLINE: newline character
tOR ASSIGN: |= (reserved)
tSWITCH: switch (reserved)
tUSED OP: used | ? (reserved)
tXOR ASSIGN: ˆ= (reserved)
c Dutch Space BV 469
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
470
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix F
In this appendix an overview is given of the various files which are used and created by EuroSim. Also,
for a number of files, their format is given.
c Dutch Space BV 471
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The tr, rec, timings, EsimJournal.txt and EsimJournal.xml files are stored in directories represent-
ing the date and time of the simulation. The exe and dict files are created in a temporary directory that is
made up of the basename of the model file and extension of the operating system (f.i. MyModel.Linux).
All other files are in user-specified directories.
472
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Please note that a personal configuration file overrides any system-wide settings, so it is best only to
include those settings that are actually changed.
The EuroSim configuration file is divided into two sections, the first section contains key-value pairs, the
second section contains file type settings. Comment-lines are started with the # character.
F.2.1 Keys
Keys are defined with the format:
c Dutch Space BV 473
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
description
short description of the file type
extensions
the file extensions for the file type (comma separated)
editor cmd
the command used to edit the file
viewer cmd
the command used for read-only access to the file
The <ID-string> is mandatory, the other settings are optional. As an example follows an entry for the
Simulation Defintion file type:
(Note: On the Windows NT/XP platform, the EuroSim utility “open.exe” can be specified as an edi-
tor/viewer command to call the default editor defined under Windows NT/XP.)
[Mission: <missionname.mdl>]
[Record size: <number of bytes>]
[Dict: <dictname.dict>]
[SimTime: <simtime_varname>]
[TimeFormat: relative/UTC]
Number of variables: <number>
{<variable_path> <type> {<variable_path_dimension>}}
Following these definitions is a set of lines, one for each input timepoint, stating the stimuli data to be
inserted, or register data generated-, for each of the variables. The order of the values of the variables is
the same as the definitions given for the variables.
The files all contain binary data for the <variable_value> records of the variable values. The headers
of the files are in ASCII. In Figure F.1 (part of) the syntax definition is shown. When the file is generated
by the record command, the first variable/column in the file will always be the simulation time vari-
able1 . Each invocation of the record command results in one record of variable values (see example in
Figure F.2).
1
The variable for the simulation time can be specified by an environment variable.
474
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Mission: Demo48hr.mdl
Record size: 20
Dict: Demo48hr.dict
SimTime: /simulation_time
TimeFormat: relative
Number of variables: 3
/simulation_time: double
/BouncingBall/ballF77.f/balf77/ballvar$height: float
/BouncingBall/ballC.c/ballC/Velocity: double
The naming conventions for EuroSim recorder files are the following:
• for the files read and processed by the stimulation process any file name can be specified with the
MDL stimulate command.
• for the files generated by the recording process a filename can be specified in the MDL record
command2 , or
• for the files generated by the record command, when no file name is specified in the MDL record
command, a file name is generated3 with the name rec-X-1.rec.
Filename Variable
SateliteDecayTest.rec /simulation_time
SateliteDecayTest.rec /Altitude/altitude
SateliteDecayTest.rec /Thruster/thrusterOnOff
SateliteDecayTest.rec /Altitude/decaySpeed
c Dutch Space BV 475
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Where path is the path to the data dictionary which should be exported, id is the name under which this
path should be exported, mode is the operation that can be performed (R, W or RW) and users is a list of
clients that may request access.
The given path that is exported means that every subtree or variable that is located underneath that path
may be requested in a view. A simple way therefore to export every variable is to export the /. The id
under which the path is exported is the name which the external simulator must use in his access request.
The access mode RW is not yet implemented. However, it is possible to add separate read and write export
lines.
When no users are specified the export operation is valid for all users. For more information, see also the
exports(4) man page of EuroSim, and chapter Chapter 21.
Example exports file:
#
# Example file
#
/space/station/era era R
/space/stars stars RW
/space/rockets/ariane esarocket W
alias path
where alias is the alias name of the variable indicated by the data dictionary element path. An alias
name must start with an alphabetic character and may be followed by zero or more alphanumeric char-
acters or underscores.
White space is used as a separator and is not significant otherwise.
#
# Example alias file
#
XCAD1002 /SPARC/ControlStatus
XZCY2945 /SPARC/setpoints
a /SPARC/setpoints[2]
b_2 /SPARC/setpoints[3][3]
#keyword = value
476
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
comment
the comment that was passed when the file was written. May be omitted.
format either ASCII or binary. When omitted the file is interpreted as being ASCII.
simtime the simulation time at the time the snapshot was taken.
dict the EuroSim data dictionary file from which this file was written. The path to the data dictionary
is relative to the place where it can be found. May be omitted.
reference
an optional version control reference for the state of the model this file’s data dictionary was
generated from.
Any other keywords can be generated by dictdump, or by the user, but they are not interpreted. Every
initial condition or snapshot file written by EuroSim also contains a comment line indicating the type of
snapshot or initial condition file written. It is either:
or
which indicates whether it is a partial snapshot (or initial condition) file or a complete snapshot containing
all the variables in the data dictionary.
When the format of the file is binary there is at least one mandatory empty line following the header.
The data section of a binary file contains records for each data dictionary symbol as follows:
where the symbols are fully qualified data dictionary paths and the values for the symbols are of course
in ’binary’ form (no formatting).
When the format of the file is ASCII the records of the data section look like:
Again the symbols are fully qualified data dictionary paths, the values for the symbols are formatted.
The records may extend several lines but the carriage return ’\n’ is then escaped with a \ backslash, so
in there is in principle one record per line. Values of arrays and structures (possibly nested) are grouped
using curly braces { and }, identical to the syntax of the C language to initialize those values.
The following example shows a typical layout of a full (ASCII) initial condition file:
c Dutch Space BV 477
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
dictpath = replacement
where dictpath is the data dictionary path to a variable or to a sub-tree node in the hierarchy contain-
ing variables. In the case that the dictpath points to a variable, the replacement may not be empty.
The replacement string is used to replace the beginning of the dictpath with something else or even
nothing.
A typical use case is to map the entire alias sub-tree and replace the /alias/ prefix with nothing so that all
the aliases are shown as short names.
White space is used as a separator and is not significant otherwise.
#
# Example TSP map file
#
/SPARC/ControlStatus=XCAD1002
/SPARC/setpoints=XZCY2945
/alias/=
keyword value;
where value is either a number or a text between double quotes. To embed a double quote in the text
you have to prefix it with a backslash. To embed a backslash in the text you also have to prefix it with a
backslash. Examples:
foo 1;
bar "text example";
escape "quote \" backslash \\";
nested_keyword {
key1 value1;
key2 value2;
}
478
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
defaultTab
the name of the tab page shown on top <date>/<time>subdirectories in the resultsPath
directory and store the result files there. If 0, then do not create these subdirectories.
model start a nested section for a model file. See below for valid keywords.
schedule
start a nested section for a schedule file. See below for valid keywords.
export start a nested section for an exports file. See below for valid keywords.
alias start a nested section for an alias file. See below for valid keywords.
mdl start a nested section for a scenario file. See below for valid keywords. This keyword can be
used more than once.
mmi start a nested section for an mmi file. See below for valid keywords. This keyword can be used
more than once.
usr start a nested section for an usr file. See below for valid keywords. This keyword can be used
more than once.
ic start a nested section for an initial condition file. See below for valid keywords. This keyword
can be used more than once.
message tab
start a nested section for a message tab. See below for valid keywords. This keyword can be
used more than once.
Valid keywords for the model, schedule, export, alias and usr nested sections:
caption the caption of the corresponding tab page Valid keywords for the ic nested section:
c Dutch Space BV 479
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Syntax
SIM
/* Simulation Definition file */
: keyvals
| tEOF
;
keyvals
: keyval
| keyvals keyval
;
keyval
: server string ;
| version numeric ;
| model { file_keyvals }
| schedule { file_keyvals }
| export { file_keyvals }
| alias { file_keyvals }
| usr { file_keyvals }
| ic { ic_keyvals }
| mdl { mdl_keyvals }
| mmi { mmi_keyvals }
| message_tab { message_tab keyvals }
;
file_keyvals
: file_keyval
| file_keyvals file_keyval
;
file_keyval
: path string ;
| required string ;
;
ic_keyvals
: ic_keyval
| ic_keyvals ic_keyval
;
ic_keyval
: path string ;
| required string ;
| active numeric ;
;
mdl_keyvals
: mdl_keyval
| mdl_keyvals mdl_keyval
;
mdl_keyval
480
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
: path string ;
| caption string ;
| required string ;
| active numeric ;
| iconView numeric ;
;
mmi_keyvals
: mmi_keyval
| mmi_keyvals mmi_keyval
;
mmi_keyval
: path string ;
| required string ;
| caption string ;
;
message_tab_keyvals
: message_tab_keyval
| message_tab_keyvals message_tab_keyval
;
message_tab_keyval
: name string ;
| message_types string ;
;
monitor start a nested section for a monitor definition. See below for valid keywords. This keyword can
be used more than once.
mdl the scenario file containing the action used by the action button. Use an empty string if not
relevant.
action the action executed or disabled/enabled by the action button. Use an empty string if not relevant.
path The path to the shared object this monitor uses. Can be left out if the monitor is not a plugin.
monitorType
the type of the monitor:
Type Description
history the maximum number of data points that are used for the plot. Use 0 if not relevant.
var start a nested section for a variable definition. See below for valid keywords. This keyword can
be used more than once.
name the variable to monitor. This is the only keyword if the var belongs to a plugin.
showLine
if 1, then draw the line connecting two data points.
lineColor
the color of the line. It is the decimal representation of the hexadecimal RGB value 0xR-
RGGBB.
Value Description
0 No symbol
1 Ellipse
2 Rectangle
3 Diamond
5 Down triangle
6 Up triangle
7 Left triangle
8 Right triangle
9 Cross
10 X-Cross
Table F.3: Available Symbols
482
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
symbolColor
the color of the symbol. It is the decimal representation of the hexadecimal RGB value 0xR-
RGGBB.
readOnly
if 1, then this variable is read only.
Syntax
MMI
/* Man-Machine Interface file */
: keyvals
| tEOF
;
keyvals
: keyval
| keyvals keyval
;
keyval
: monitor { monitor_keyvals }
| version numeric ;
;
monitor_keyvals
: monitor_keyval
| monitor_keyvals monitor_keyval
;
monitor_keyval
: var { var_keyvals }
| name string ;
| mdl string ;
| action string ;
| path string;
| propertiesPath string;
| monitorType numeric ;
| history numeric ;
| left numeric ;
| top numeric ;
| width numeric ;
| height numeric ;
| manualScalingX numeric ;
| xMin numeric ;
| xMax numeric ;
| manualScalingY numeric ;
| yMin numeric ;
| yMax numeric ;
;
var_keyvals
: var_keyval
| var_keyvals var_keyval
;
c Dutch Space BV 483
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
var_keyval
: name string ;
| showLine numeric ;
| lineColor numeric ;
| symbol numeric ;
| symbolColor numeric ;
| readOnly numeric ;
;
def the specification of the program and its arguments. Note that the sequence %h is replaced with
the hostname of the running simulator and the sequence %c is replaced with the preferred con-
nection number.
Syntax
USR
/* User Program Definition file */
: keyvals
| tEOF
;
keyvals
: keyval
| keyvals keyval
;
keyval
: def string ;
;
484
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix G
This appendix contains the lay-out of the API headers, as they are generated by EuroSim for C and Fortran
model code. As EuroSim does not generate API headers for Ada-95 model code, the information in this
appendix can be used to create API headers for Ada-95 model code by hand.
The API header is contained in a comment block at the top of the source code
(i.e. between /* */ in C, on lines starting with C in Fortran and on lines starting with -- in Ada-95). In
Ada-95 and Fortran, make sure that if the original source code started with a comment block, that there
is an empty line between the API header and the source code comments.
Each API header consists of the following four keywords (see Section 2.5 for more information):
• ’Global_State_Variables
• ’Global_Input_Variables
• ’Global_Output_Variables
• ’Entry_Point
The first three keywords are used to describe the variables in the source code, and the last keyword is
used to describe the entry points. The first keyword is used once per source file, the last three once per
entry point.
Each keyword is preceded by a straight quote.
• UNIT="text"
This defines text as the unit of the variable. The string text can be any string.
• DESCRIPTION="text"
• PARAMETER or RO
c Dutch Space BV 485
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
No additional information. It defines a variable as ‘parameter’, meaning that EuroSim should not allow
the value of the variable to be changed during a simulation (only during initialization).
• INIT="value"
This defines value as the initial value for the variable. value should be in the correct syntax for the
associated variable.
• MIN="value"
• MAX="value"
These two define the minimum and maximum values of the variable. value should be in the correct
syntax for the associated variable.
486
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
G.5.2 Functions to publish data variables and entry points in a data dictionary
dictPublish(DICT *dict, const char *name, const void *address) sets the address of the vari-
able specified by name in the data dictionary specified by dict to address. This function can be called
from C or Ada.
dictpublish_(DICT *dict, const char *name, const void *address, int namelen) is the For-
tran wrapper for dictPublish. It has an extra parameter with the length of the name parameter. This is
required by the calling convention of Fortran functions.
dictPubEntry(DICT *dict, const char *name, EntryPtr address) sets the function address of
the entry point specified by name in the runtime data dictionary to address. This function can be called
from C or Ada.
dictpubentry_(DICT *dict, const char *name, EntryPtr address, int namelen) is the Fortran
wrapper for dictPubEntry. It has an extra parameter with the length of the name parameter. This is re-
quired by the calling convention of Fortran. functions.
The prototypes for these functions can be found in DictPublish.h.
/*
’Entry_Point Thruster:
DESCRIPTION="The thruster brings the satellite to"
" the correct altitude."
’Global_Input_Variables
int lowerAltitudeLimit:
UNIT="km"
DESCRIPTION="Below this limit, the thruster must"
" be turned on."
INIT="210"
MIN="0"
MAX="1000",
int sateliteAscentSpeed:
UNIT="km/h"
DESCRIPTION="The ascent speed of the satellite."
INIT="10"
MIN="1"
MAX="200",
int thrusterOnOff:
UNIT="On/Off"
DESCRIPTION="Indicates whether the thruster is"
" on or off."
INIT="1"
MIN="0"
MAX="1",
int upperAltitudeLimit:
UNIT="km"
DESCRIPTION="The upper limit at which the thrust"
"er is to be switched of."
INIT="280"
MIN="0"
MAX="1000"
’Global_Output_Variables
c Dutch Space BV 487
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
int thrusterOnOff:
UNIT="On/Off"
DESCRIPTION="Indicates whether the thruster is"
" on or off."
INIT="1"
MIN="0"
MAX="1"
*/
Note that there is no restriction on line length for the API headers, but that the API Editor generates no
lines longer than 80 characters. This is done to ensure good readability on most terminals.
Also note that variables which act both as input as well as output variables are defined twice in the API
header.
---------------------------------------------------------
--
-- Name: ball.adb
-- Type: Ada-95 implementation.
--
-- Author: John Graat (NLR).
-- Date: 19961125
-- Changes: none
--
--
-- Purpose: Model for the Simulation of a Bouncing Ball.
--
-- The Bouncing Ball describes a ball that is thrown
-- straight-up from the ground with an initial velocity
-- or dropped from an initial height.
-- In the absence of friction, the ball should reach
-- exactly the same maximum height time and time again.
-- The ball is described as a mass point.
--
-- Parameters: GRAVITY Gravitation constant [m/s2]
--
-- State: Height Height of the ball above the ground [m].
-- Velocity Velocity of the ball [m/s].
--
-- Additional: DeltaT Time Step for the Model.
-- LoadLoop Loop counter to increase computation time.
-- Duration Duration of the Ball Model.
--
-- Remark: The mass of the ball has mplicitly been set to 1 [kg].
--
-- API Header required for the correct Data Dictionary:
--
-- ’Entry_Point ball.Ball:
-- DESCRIPTION="Computation of one time step of the ball"
-- "."
-- ’Global_Input_Variables
-- Long_Float ball.deltat:
-- UNIT="s"
-- DESCRIPTION="Time step for the Ball Sub-Model."
-- MIN="0"
-- MAX="1",
-- Long_Float ball.height:
-- UNIT="m"
488
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
with integr;
with esim;
use esim;
procedure Ball is
-- Local Variables of the Bouncing Ball
State, Dot : Integr.Vector;
Rate, Fine : Long_Float;
Loopcnt : Integer;
Start, Stop : Long_Float;
begin
-- Get the Start time from the Wall Clock.
Start := esimGetWallclocktime;
c Dutch Space BV 489
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
State(2) := -State(2);
end if;
Height := State(1);
Velocity := State(2);
end loop;
Loopcnt := 0;
-- Get Stop time from the Wall Clock and calculate Duration.
Stop := esimGetWallclocktime;
Duration := Stop - Start;
end Ball;
end Ball;
490
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix H
• Entry points should have no calling arguments/parameters (functions not used as entry points do
not have this restriction). When calling arguments or parameters are needed they should be defined
through one of two methods (of which the first one is recommended):
• If the entry point is used in the real-time domain it is not allowed to use any operating system call
(open, printf, etc...). This is because operating system calls do not have deterministic execution
times. Calls which are allowed are the services provided by EuroSim. See Appendix D for details
on the EuroSim services.
• The entry point must not create a deadlock (i.e. waiting on a resource not available for some
(undefined) time).
• No names should be used which conflict with one of the internal EuroSim functions. Refer to the
file $EFOROOT/etc/reserved-words.txt for the complete list of reserved words.
• Only variables with a memory address that is fixed at load time can be used as API variables1 .
The operation must not make use of a locking mechanism (semaphores) to establish mutual exclusion of
a common defined variable. This should be done using an asynchronous store (see Section 10.3).
During real-time simulation, the size of the system stack cannot change. Therefore, care should be taken
with model code which allocates large data structures on the stack.
When combining programming languages in one model (e.g. C and Fortran), there are a number of
rules to keep in consideration with respect to variable and function naming. Refer to the programming
language documentation for more information. For an example, see Section 4.6.
H.2 C limitations
Unnamed structures, unions and bitfields cannot be used as API variables.
1
There is one exception: static variables declared within a C function have a load time fixed address but are not accessible
by EuroSim. No implementation of such access is possible without violating the rule that EuroSim should not modify source
code files.
c Dutch Space BV 491
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
H.4.1 Compilation
The GNAT compiler allows only one compilation unit per file. The gnatchop utility can be used to split
the files. A body should be contained in a .adb file, and specifications should be in .ads files. If the
package name example is given in a with clause, the compiler will look for example.ads. Filenames
are mapped to lowercase, so the file Example.ads will not be found.
H.4.2 Variables
Only variables which have a fixed address (as specified by the Ada-95 ‘Address’ attribute) can be used
as global variables within EuroSim. Variables that are to be used as globals must be made visible to the
generated publish procedure. Therefore they must be put in a subprogram or package specification, so
that they can be accessed by means of the with clause.
When two packages define a variable with the same name, the names should be fully qualified in the
data dictionary (i.e. with the package name), otherwise the connection between variables and their
compilation subunits would be lost.
If Ada-95 code is mixed with C and/or Fortran code, the model developer has to get the bindings of vari-
able and entry names correct themselves. An entity name that appears in a library package is accessible
from C as package__name (two underscores). If the entity appears outside a package, its name will be
prefixed with _ada_.
H.4.4 Types
Generic packages cannot have API headers, because each instantiation would also have to instantiate a
new API header. The API header has no support for generic types. If an instantiation of a generic package
is made, the user has to perform the necessary parameter substitution himself.
User defined types are not supported by EuroSim.
492
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
H.4.5 Tasks
Since the EuroSim environment supplies its own task mechanism, the Ada-95 task and exception mech-
anism and associated commands (e.g. select, delay) should not be used.
c Dutch Space BV 493
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
494
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix I
I.1 Introduction
The EsimRTI is a HLA interface for EuroSim. The EsimRTI is a real-time layer on top of the RTI that
provides the RTI-services to an application in a real-time manner with a ‘C’ application programmer’s
interface.
EuroSim models that can use the EsimRTI must be composed from C source files. It is possible to include
Fortran 77 source files in the EuroSim model but the EsimRTI API must be called from the C source files.
To use the stand-alone versions of the EsimRTI libraries compile your source code with the preferred
preprocessor defines and link with the appropriate EsimRTI library. The relevant preprocessor defines
are ESIMRTI_STANDALONE (mandatory) and ESIMRTI_MULTI_THREADED (optional).
The relevant include files are located in $EFOROOT/include/RTI.
The libraries are located in $EFOROOT/lib32/esim.
The functions esimMalloc and esimFree are replaced with malloc and free for the EsimRTI usage with-
out EuroSim. The functions esimMessage, esimWarning, esimError, esimFatal, esimReport and esim-
SetState are replaced with appropriate printf statements EsimRTI usage without EuroSim.
I.1.3 Running
To execute a EuroSim model or to run a program that uses the EsimRTI, the rtiexec (which can be found
in $RTI HOME/bin/IRIX-6.5-n32/) should be started somewhere on the network. IP-multicasts should
be able to reach this rtiexec-host. The appropriate fed-file should be present in the $RTI CONFIG directory.
1
Not supported in the Linux and Windows NT/XP version.
c Dutch Space BV 495
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• The size of the executable (including the libraries) can be determined with the following command:
size -4 executable
• The pagesize of the machine can be determined with the following command:
sysconf PAGESIZE
• Calculate the minimum value for the maxlkmem limit executable size (in bytes) / page size. Note
that the maxlkmem should not exceed half the amount of physical memory available. The amount
of physical memory available can be determined with the hinv command.
• The user root can change the maxlkmem user setting with the following command sequence:
systune -i
I.1.4.2 Example
The steps to determine the amount of memory used by a EuroSim model described in the previous section
are applied to the executables of the flywheel example (introduced elsewhere in this appendix).
• On the O200 that was used to developed the EsimRTI sysconf PAGESIZE reports:
496
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• On the O200 that was used to develope the EsimRTI the hinv command reports the amount of
physical memory available (bold in the following output):
.../esim-projects/flywheelengine$ hinv
4 225 MHZ IP27 Processors
CPU: MIPS R10000 Processor Chip Revision: 3.4
FPU: MIPS R10010 Floating Point Chip Revision: 0.0
Main memory size: 512 Mbytes
Instruction cache size: 32 Kbytes
Data cache size: 32 Kbytes
Secondary unified instruction/data cache size: 2 Mbytes
Integral SCSI controller 3: Version QL1040B (rev. 2), single ended
Disk drive: unit 1 on SCSI controller 3
Integral SCSI controller 2: Version QL1040B (rev. 2), single ended
WORM: unit 5 on SCSI controller 2
Integral SCSI controller 1: Version QL1040B (rev. 2), single ended
CDROM: unit 6 on SCSI controller 1
Integral SCSI controller 0: Version QL1040B (rev. 2), single ended
Disk drive: unit 1 on SCSI controller 0
Integral SCSI controller 4: Version QL1040B (rev. 2), single ended
IOC3 serial port: tty1
IOC3 serial port: tty2
IOC3 serial port: tty3
IOC3 serial port: tty4
IOC3 parallel port: plp1
IOC3 parallel port: plp2
Integral Fast Ethernet: ef0, version 1, module 1, slot io1, pci 2
Fast Ethernet: ef1, version 1, module 2, slot MotherBoard, pci 2
Origin 200 base I/O, module 2 slot 2
Origin PCI XIO board, module 1 slot 7: Revision 4
Origin 200 base I/O, module 1 slot 1
IOC3 external interrupts: 1
IOC3 external interrupts: 2
PCI card, bus 0, slot 5, Vendor 0x12e2, Device 0x4013
• A sufficient value for the maxlkmem setting would be 4000 for the above mentioned executables.
This value would represent lock 65.5 MB of memory (4000 * 16384). On the O200 this represents
13% of the available physical memory.
• To change the setting for maxlkmem use systune -i (requires root privileges):
# systune -i
Updates will be made to running system and /unix.install
systune-> quit
c Dutch Space BV 497
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• In the Direct mode (EsimRTImodeDirect) any call into the RTI is directly processed by the RTI.
Federate ambassador callbacks are executed when the EsimRTI is ticked.
The synchronous RTI calls are not available in buffered mode (an overview is presented elsewhere in this
document).
• The amount of time the RTI uses to process a call is not predictable.
• Although the RTI throws an exception when an application attempts to access the RTI concurrently
(RTI calls can be made from multiple tasks executed in parallel) special precautions are required
to prevent concurrent access to the RTI (and to ensure the call is processed).
• The perception the application has of the internal state of the RTI does not necessarily always
match to the actual internal state of the RTI, for short periods the two may differ. This wrong
perception can lead to inconsistencies in the delivery of messages to the application.
• The reason is of course that a call into the RTI is not processed directly by the RTI, and conversely,
messages delivered by the RTI are not received directly by the application. Methods stored in
the Federate callback buffer may conflict with the perception of the application of the internal
state of the RTI, for instance: Suppose the application just divested the ownership of an object
unconditionally (which means that from now on the federate no longer has any update responsi-
bility), while the Federate callback buffer holds the request for the update of the attributes of the
very same object. After ticking the EsimRTI, the application will receive the request, and, since
it relies on the internal state of the EsimRTI, does no checking, and sends the updates of the at-
tributes of the object. When the RTI processes this updateAttribute, it will generate the exception
ObjectNotKnown.
• To ensure buffer consistency the operations on the buffer must be mutual exclusive. Mutex locks
and release calls are used to implement this. Locking and releasing the mutex variable takes time
of course.
498
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• Stand-alone single-threaded.
• Stand-alone multi-threaded.
• the functionality of the EsimRTIrtiAmbassadorTick function (the method that has replaced the
RTI::RTIambassador.tick).
In the single-threaded versions of the EsimRTI library ticking the EsimRTI (using esimRTIrtiAmbas-
sadorTick):
• delivers one (in Buffered mode) or more (in Direct mode) RTIambassador call(s) to the RTI;
• delivers one (in Buffered mode) or more (in Direct mode) federateAmbassador callback(s) to the
application;
In the multi-threaded version of the library a thread is created when the EsimRTIrtiAmbassador is cre-
ated. The thread is suspended when created and when the EsimRTI mode is switched to Direct mode.
The thread is resumed when the EsimRTI mode is switched to Buffered mode. The thread takes care of:
Ticking the RTI delivers federateAmbassador callbacks from the RTI to the EsimRTI library and queues
them in a callback buffer. To deliver the queued callbacks the EsimRTI must be ticked using esimRTIr-
tiambassadorTick.
To use the multi-threaded version of the EsimRTI library (for stand-alone applications only) compile the
source code of your application with ESIMRTI_MULTI_THREADED defined (using the -D compiler option)
and link with the right library (libEsimRTImts.a). To compile the source code of your application outside
the EuroSim environment ESIMRTI_STANDALONE must be defined (-DESIMRTISTANDALONE).
• An advantage is that the application developer does not have to worry about the delivery of the
RTI calls to the RTI and the queuing of the federate ambassador callbacks from the RTI for the ap-
plication (although the EsimRTI must be ticked to deliver the queued callbacks to the application).
c Dutch Space BV 499
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• An advantage is that the queued RTI-calls are transferred to the RTI on a regular basis.
• A disadvantage is that with a high the number of RTI calls and/or federate ambassador callbacks
the buffers might overflow because the application developer has little influence on the amount of
processing the thread is allowed.
For these reasons the EuroSim version of the EsimRTI library is single-threaded. The esimRTIrtiAmbas-
sadorTick method transfers the RTI calls (one or more depending on the EsimRTI mode) to the RTI,
ticks the RTI and transfers the queued federate ambassador callbacks to the application (one or more
depending on the EsimRTI mode).
Buffer RTI calls NO: the RTI calls YES NO: the RTI calls YES
are executed are executed
directly directly
Buffer RTI YES YES YES YES
callbacks
Execute the RTI the RTI calls are Tick reads and The RTI calls are esimRTIthread
calls executed directly executes one call executed directly reads and
from the RTI call executes all calls
buffer from the RTI call
buffer
The RTI is ticked tick tick tick esimRTIthread
by:
Buffer the RTI YES YES YES YES
callbacks
Execute the RTI Tick reads and Tick reads and Tick reads and Tick reads and
callbacks executes all executes one executes all executes one
callbacks from callback from the callbacks from callback from the
the RTI callback RTI callback the RTI callback RTI callback
buffer buffer buffer buffer
Table I.1: Overview of the functionality of esimRTIrtiAmbassadorTick function in the available combi-
nations of EsimRTI libraries (single-threaded vs. multi-threaded) and EsimRTI mode of operation (direct
mode vs. buffered mode). In the table tick should be read as esimRTIrtiAmbassadorTick.
The esimRTIrtiAmbassadorTick should be called on a regular basis. The frequency depends on the
number of RTI calls to and RTI callbacks from the federation. The esimRTIrtiAmbassadorTick should
be called from a non-real-time task.
The EsimRTI can be queried for the actual number of pending RTI calls and RTI callbacks with the
following functions:
• esimRTIrtiAmbassadorGetNbufferCalls, and
500
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• esimRTIfederateAmbassadorGetNbufferCallbacks.
RTI::FedTime EsimRTIfedTime
RTI::FedTime& EsimRTIfedTime *
RTI::AttributeHandle EsimRTIattributeHandle
RTI::ParameterHandle EsimRTIparameterHandle
RTI::ObjectHandle EsimRTIobjectHandle
RTI::ObjectClassHandle EsimRTIclassHandle
RTI::InteractionClassHandle EsimRTIinteractionHandle
RTI::FederateHandle EsimRTIfederateHandle
RTI::RTIambassador EsimRTIrtiAmbassadorHandle
RTI::FederateAmbassador EsimRTIfederateAmbassadorHandle
RTI::...HandleSet EsimRTIattributeHandleSet
EsimRTIfederateHandleSet
EsimRTIhandleSet
EsimRTIparameterHandleSet
RTI::...HandleValuePairSet EsimRTIattributeHandleValuePairSet
EsimRTIhandleValuePairSet
EsimRTIparameterHandleValuePairSet
RTI::EventRetractionHandle ErsimRTIeventRetractionHandle
RTI::Boolean EsimRTIboolean
Table I.2: Mapping of RTI types and classes onto equivalent C types.
RTI::AttributeHandleSetFactory.create esimRTIattributeHandleSetNew
delete RTI::AttributeHandleSet esimRTIattributeHandleSetDelete
RTI::AttributeSetFactory.create esimRTIattributeHandleValuePairSetNew
delete RTI::AttributeHandleValuePairSet esimRTIattributeHandleValuePairSetDelete
Table I.3: Mapping of C++ constructors and destructors onto equivalent C functions.
c Dutch Space BV 501
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
RTI::FederateAmbassador.method esimRIfederateAmbassadorMethod
RTI::RTIambassador.method esimRTIrtiAmbassadorMethod
Table I.4: Mapping of Class.methods onto esimRTIclassMethods.
Type Constant
EsimRTIfedTime esimRTIinifiniteTime
EsimRTIfedTime esimRTIepsilonTime
EsimRTIeventRetractionHandle esimRTIzeroRetractionHandle
Table I.5: C constants.
I.3.6 Exceptions
Exceptions thrown by the RTI are caught, and an esimMessage is displayed, providing the user with the
reason of the error, the calling function and the exception name. Also, when appropriate, 0 or NULL is
returned.
The format of the esimMessage is:
502
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
if (esimRTIambassadorHasJoined() == EsimRTIfalse) {
exit();
}
c Dutch Space BV 503
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
504
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
esimRTIfederateAmbassadorTimeAdvanceGrant
esimRTIfederateAmbassadorRequestRetraction
• the other functions are needed during initialization only, which normally occurs in the Direct mode
queryFederateTime esimRTIrtiAmbassadorQueryFederateTime
queryLBTS esimRTIrtiAmbassadorQueryLBTS
queryFederateTime esimRTIrtiAmbassadorQueryFederateTime
queryMinNextEventTime esimRTIrtiAmbassadorQueryMinNextEventTime
queryLookahead esimRTIrtiAmbassadorQueryLookahead
esimRTIrtiAmbassadorQueryTimes
Table I.6: Mapping of RTI query time methods onto C functions.
In the Direct mode the functions call the RTI equivalents directly. In the Buffered mode these functions
return relevant values as they have been copied from the RTI when the EsimRTI tick function is called.
I.3.12.1 Examples that illustrate how functions are mapped onto overloaded methods
and vice versa.
The function call:
esimRTIrtiAmbassadorRegisterObjectInstance (
theClassHandle, NULL)
will invoke the method:
RTI::RTIambassador::registerObjectInstance (
theClassHandle)
c Dutch Space BV 505
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
esimRTIrtiAmbassadorRegisterObjectInstance (
theClassHandle, objectName)
RTI::RTIambassador::registerObjectInstance (
theClassHandle, objectName)
The method:
RTI::FederateAmbassadorassador::removeObjectInstance (
objectHandle, time, tag, retractionHandle)
esimRTIfederateAmbassadorRemoveObjectInstance (
objectHandle, time, tag, retractionHandle)
The method:
RTI::FederateAmbassadorassador::removeObjectInstance (
objectHandle, tag)
esimRTIfederateAmbassadorRemoveObjectInstance (
objectHandle, NULL, tag, esimRTIzeroRetractionHandle)
esimRTIfederateAmbassadorNew I
esimRTIfederateAmbassadorDelete F
esimRTIrtiAmbassadorNew I
esimRTIrtiAmbassadorDelete F1
esimRTIrtiAmbassadorCreateFederationExecution I
esimRTIrtiAmbassadorDestroyFederationExecution F2
esimRTIrtiAmbassadorResignFederationExecution F1
esimRTIrtiAmbassadorJoinFederationExecution I
Table I.7: Overview of functions available in direct mode only.
506
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
esimRTIrtiAmbassadorGetAttributeName I
esimRTIrtiAmbassadorGetAttributeHandle I
esimRTIrtiAmbassadorGetInteractionClassHandle I
esimRTIrtiAmbassadorGetInteractionClassName I
esimRTIrtiAmbassadorGetObjectClass I
esimRTIrtiAmbassadorGetObjectClassHandle I
esimRTIrtiAmbassadorGetObjectClassName I
esimRTIrtiAmbassadorGetObjectInstanceHandle I
esimRTIrtiAmbassadorGetObjectInstanceName I
esimRTIrtiAmbassadorGetOrderingHandle I
esimRTIrtiAmbassadorGetOrderingName I
esimRTIrtiAmbassadorGetParameterHandle I
esimRTIrtiAmbassadorGetParameterName I
esimRTIrtiAmbassadorGetTransportationHandle I
esimRTIrtiAmbassadorGetTransportationName I
Table I.7: Overview of functions available in direct mode only.
C1 In parameter by value.
C2 Out parameter by reference.
C3 Function return by value.
C4 In parameter by const reference. Caller provides memory. Caller may free memory or
overwrite it upon completion of the call. Callee must copy during the call anything it wishes to
save beyond completion of the call. Parameter type must define const accessor methods.
C5 Out parameter by reference. Caller provides reference to object. Callee constructs an instance
on the heap (new) and returns. The caller destroys the instance (delete) at its leisure.
C6 Function return by reference. Callee constructs an instance on the heap (new) and returns a
reference. The caller destroys the instance (delete) at its leisure.
Table I.8: Different ways of passing arguments as defined by the RTI.
1
These methods automatically change the EsimRTI mode to Direct.
2
This method returns EsimRTIfalse if the federation execution was not destroyed (because other federates still have joined
the federation execution). EsimRTItrue is returned if there is an RTI internal error or if the federation execution does not exist.
Exception warning are printed through esimWarning in all cases.
c Dutch Space BV 507
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
I.4.1 EsimRTIobject
I.4.1.1 Structure
typedef struct EsimRTIobject
{
char * className;
EsimRTIclassHandle classHandle;
char * objectName;
EsimRTIobjectHandle objectHandle;
EsimRTIobjectType esimRTIobjectType;
EsimRTIpublishType esimRTIpublishType;
} EsimRTIobject, *EsimRTIobjectRef;
I.4.1.2 Methods
EsimRTIobject *esimRTIobjectNew(
char * theClassName,
EsimRTIclassHandle theClassHandle,
char * theObjectName,
EsimRTIobjectHandle theObjectHandle,
EsimRTIobjectType theObjectType,
EsimRTIpublishType thePublishType);
Allocates memory for a new EsimRTIobject and initializes the fields. The char * arguments are copied
to new allocated memory. The method uses esimMalloc.
EsimRTIobject *dsimRTIobjectDelete(
EsimRTIobject *theObject);
Frees the memory occupied by the given EsimRTIobject (including the char * fields referred to). The
method uses esimFree.
508
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
I.4.2 EsimRTIvariable
I.4.2.1 Structure
typedef struct
{
char * variableName;
EsimRTIhandle variableHandle;
EsimRTIvariableType variableType;
void * variableRef;
unsigned int nArrayEntries;
char * objectName;
EsimRTIobject * pEsimRTIobject;
} EsimRTIvariable, *EsimRTIvariableRef;
Notes:
• The nArrayEntries field is only applicable if the variableType field represents one of the array
types.
• Note that the variable reference in the EsimRTIvariable struct always refers to the actual variable
(contains the address of the variable and not of the buffer with the encoded value).
• The objectName field looks redundant but it is not: the EsimRTIvariable structure can be used to
define a series of variables (e.g. using a const array in the model source code) where the address
of the corresponding EsimRTIobject is not known or complex to retrieve: the objectName can be
used to find the right EsimRTIobject.
I.4.2.2 Methods
EsimRTIvariable *esimRTIvariableNew (
char * theVariableName,
EsimRTIhandle theVariableHandle,
EsimRTIvariableType theVariableType,
void * theVariableRef,
char * theObjectName,
EsimRTIobject * theEsimRTIobject);
EsimRTIvariable *esimRTIvariableArrayNew(
char * theVariableName,
EsimRTIhandle theVariableHandle,
EsimRTIvariableType theVariableType,
void * theVariableRef,
unsigned int theNarrayEntries,
char * theObjectName,
EsimRTIobject * theEsimRTIobject);
Allocates memory for a new EsimRTIvariable and initializes the fields. The char * arguments are copied
to new allocated memory. The method uses esimMalloc. Because the method is used by esimRTIvari-
ableNew the method does not check whether theVariableType is one of the array types.
EsimRTIvariable *esimRTIvariableDelete(
EsimRTIvariable * theVariable);
Frees the memory occupied by the given EsimRTIvariable (including the char * fields referred to). The
method uses esimFree.
c Dutch Space BV 509
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
EsimRTIobjectType class
object
interaction
EsimRTIpublishType subscribe
publish
publish-subscribe
EsimRTIvariableType char - -
short short-string short-array
unsigned-short unsigned-short-string unsigned-short-array
int int-string int-array
unsigned-int unsigned-int-string unsigned-int-array
float float-string float-array
double double-string double-array
string - -
Table I.9: EsimRTIobject and EsimRTIvariable related enumerated types.
Notes:
• The ...-string in the enumerated types represents that the variable is encoded as a string using
appropriate %c, %ld and %lf sprintf and sscanf format specifiers.
• The other enumerated types are encoded as is: as a series of bytes as expected on the current
platform. Note that this is valid for data transfer on single platform type federations only.
• The -array in the enumerated types represents that the array will be encoded as is: as a series of
bytes as expected on the current platform. Note that this is valid use for single platform federations
only. The array dimensions are supposed to be well known (are defined in the SOM of the federate).
510
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Replace: With:
esimRTIhandleValuePairSet... esimRTIattributeHandleValuePairSet... or
esimRTIparameterHandleValuePairSet...
EsimRTIhandle EsimRTIattributeHandle or EsimRTIparameterHandle
EsimRTIhandleValuePairSet EsimRTIattributeHandleValuePairSet or
EsimRTIparameterHandleValuePairSet
Table I.10: Naming conventions for the attribute and parameter encoding and decoding functions and
types listed in the following sections.
The list of encoding and decoding facilities can easily be extended if the need arises.
void esimRTIhandleValuePairSetAddDoubleAsString(
EsimRTIhandle handle,
double number,
EsimRTIhandleValuePairSet * theSet);
void esimRTIhandleValuePairSetAddLong(
EsimRTIhandle handle,
long number,
EsimRTIhandleValuePairSet * theSet);
void esimRTIhandleValuePairSetAddLongAsString(
EsimRTIhandle handle,
long number,
EsimRTIhandleValuePairSet * theSet);
void esimRTIhandleValuePairSetAddString(
EsimRTIhandle handle,
const char * string,
EsimRTIhandleValuePairSet * theSet);
double esimRTIhandleValuePairSetGetDoubleFromString(
unsigned long index,
const EsimRTIhandleValuePairSet * theSet);
long getLongFromHandleValuePairSet(
unsigned long index,
const EsimRTIhandleValuePairSet * theSet);
c Dutch Space BV 511
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
long esimRTIhandleValuePairSetGetLongFromString(
unsigned long index,
const EsimRTIhandleValuePairSet * theSet);
char * esimRTIhandleValuePairSetCopyString(
unsigned long index,
const EsimRTIhandleValuePairSet * theSet);
I.6.1 Classes
The following table shows the classes that are used within the EsimRTI to support the RTI functional-
ity.
I.6.2 Structures
The following tables shows the structures that are used to access the EsimRTI functions equivalent with
the RTI methods.
512
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 513
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
• as one integrated model within EuroSim (flywheelengine.model) using one Simulation Controller.
514
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
This version does not use HLA/RTI for the data communication between engine and flywheel.
• as two models within EuroSim using two Simulation Controllers (the engine.model and the fly-
wheel.model). This version uses the EsimRTI library to exchange data through the RTI between
engine and flywheel.
• as two stand-alone programs (build using Makefile) without EuroSim. This version uses the Esim-
RTI library to exchange data through the RTI between engine and flywheel.
c Dutch Space BV 515
516
RTI API EsimRTI API Remark
iss: 5 rev: 4
sets
- esimRTIfederateAmbassadorGetNbufferCallbacks Returns # pending FederateAmbassador
callbacks
- esimRTIfederateAmbassadorObjectInstanceRegistrationSucceeded
objectInstanceRegistrationSucceeded
c Dutch Space BV
NLR-EFO-SUM-2
RTI API EsimRTI API Remark
c Dutch Space BV
- esimRTIobjectDelete Frees EsiRTIobject
517
iss: 5 rev: 4
518
RTI API EsimRTI API Remark
iss: 5 rev: 4
sets
c Dutch Space BV
NLR-EFO-SUM-2
RTI API EsimRTI API Remark
c Dutch Space BV
RTI::<>HandleValuePairSet.getValueLength esimRTI<>HandleValuePairSetGetValueLength Available for Attribute and Parameter
sets
RTI::FederateAmbassador.attributeOwnershipAcquisitionNotification esimRTIfederateAmbassadorAttributeOwnershipAcquisitionNotification
attributeOwnershipAcquisitionNotification
RTI::FederateAmbassador.attributeOwnershipDivestitureNotification esimRTIfederateAmbassadorAttributeOwnershipDivestitureNotification
attributeOwnershipDivestitureNotification
519
iss: 5 rev: 4
520
RTI API EsimRTI API Remark
iss: 5 rev: 4
RTI::FederateAmbassador.confirmAttributeOwnershipAcquisitionCancellation esimRTIfederateAmbassadorConfirmAttributeOwnershipAcquisitionCancellation
attributeOwnershipAcquisitionCancellation
RTI::FederateAmbassador.requestAttributeOwnershipAssumption esimRTIfederateAmbassadorRequestAttributeOwnershipAssumption
requestAttributeOwnershipAssumption
RTI::FederateAmbassador.requestAttributeOwnershipRelease esimRTIfederateAmbassadorRequestAttributeOwnershipRelease
requestAttributeOwnershipRelease
RTI::FederateAmbassador.requestFederationRestoreSucceeded esimRTIfederateAmbassadorRequestFederationRestoreSucceeded
initiateFederateRestoreSucceeded
c Dutch Space BV
NLR-EFO-SUM-2
RTI API EsimRTI API Remark
RTI::FederateAmbassador.synchronizationPointRegistrationFailed esimRTIfederateAmbassadorSynchronizationPointRegistrationFailed
c Dutch Space BV
synchronizationPointRegistrationFailed
RTI::FederateAmbassador.synchronizationPointRegistrationSucceeded esimRTIfederateAmbassadorSynchronizationPointRegistrationSucceeded
synchronizationPointRegistrationSucceeded
RTI::FederateAmbassador.turnUpdatesOffForObjectInstance esimRTIfederateAmbassadorTurnUpdatesOffForObjectInstance
SUM
turnUpdatesOffForObjectInstance
RTI::FederateAmbassador.turnUpdatesOnForObjectInstance esimRTIfederateAmbassadorTurnUpdatesOnForObjectInstance
turnUpdatesOnForObjectInstance
RTI::RTIambassador.attributeOwnershipAcquisitionIfAvailable esimRTIrtiAmbassadorAttributeOwnershipAcquisitionIfAvailable
attributeOwnershipAquisitionIfAvailable
RTI::RTIambassador.attributeOwnershipReleaseResponse esimRTIrtiAmbassadorAttributeOwnershipReleaseResponse
attributeOwnershipReleaseResponce
521
iss: 5 rev: 4
522
RTI API EsimRTI API Remark
iss: 5 rev: 4
RTI::RTIambassador.cancelAttributeOwnershipAcquisition esimRTIrtiAmbassadorCancelAttributeOwnershipAcquisition
cancelAttributeOwnershipAquisition
RTI::RTIambassador.cancelNegotiatedAttributeOwnershipDivestiture esimRTIrtiAmbassadorCancelNegotiatedAttributeOwnershipDivestiture
cancelAttributeOwnershipDivestiture
RTI::RTIambassador.changeAttributeTransportationType EsimRTIrtiAmbassadorChangeAttributeTransportationType
changeAttributeTransportationType
RTI::RTIambassador.changeInteractionTransportationType EsimRTIrtiAmbassadorChangeInteractionTransportationType
changeInteractionTransportationType
RTI::RTIambassador.disableAttributeRelevanceAdvisorySwitch esimRTIrtiAmbassadorDisableAttributeRelevanceAdvisorySwitch
disableAttributeRelevanceAdvisorySwitch
RTI::RTIambassador.disableClassRelevanceAdvisorySwitch esimRTIrtiAmbassadorDisableClassRelevanceAdvisorySwitch
disableClassRelevanceAdvisorySwitch
RTI::RTIambassador.disableInteractionRelevanceAdvisorySwitch esimRTIrtiAmbassadorDisableInteractionRelevanceAdvisorySwitch
disableInteractionRelevanceAdvisorySwitch
RTI::RTIambassador.disableTimeRegulation esimRTIrtiAmbassadorDisableTimeRegulation disableTimeRegulation
RTI::RTIambassador.enableAttributeRelevanceAdvisorySwitch esimRTIrtiAmbassadorEnableAttributeRelevanceAdvisorySwitch
enableAttributeRelevanceAdvisorySwitch
c Dutch Space BV
NLR-EFO-SUM-2
RTI API EsimRTI API Remark
RTI::RTIambassador.enableClassRelevanceAdvisorySwitch esimRTIrtiAmbassadorEnableClassRelevanceAdvisorySwitch
enableClassRelevanceAdvisorySwitch
RTI::RTIambassador.enableInteractionRelevanceAdvisorySwitch esimRTIrtiAmbassadorEnableInteractionRelevanceAdvisorySwitch
enableInteractionRelevanceAdvisorySwitch
NLR-EFO-SUM-2
c Dutch Space BV
RTI::RTIambassador.enableTimeConstrained esimRTIrtiAmbassadorEnableTimeConstrained enableTimeConstrained
523
iss: 5 rev: 4
524
RTI API EsimRTI API Remark
iss: 5 rev: 4
RTI::RTIambassador.negotiatedAttributeOwnershipDivestiture esimRTIrtiAmbassadorNegotiatedAttributeOwnershipDivestiture
negotiateAttributeOwnershipDivestiture
RTI::RTIambassador.queryLBTS esimRTIrtiAmbassadorQueryLBTSqueryLBTS
RTI::RTIambassador.registerFederationSynchronizationPoint esimRTIrtiAmbassadorRegisterFederationSynchronizationPoint
registerFederationSynchronizationPoint
RTI::RTIambassador.registerObjectInstance esimRTIrtiAmbassadorRegisterObjectInstance registerobjectInstance
c Dutch Space BV
NLR-EFO-SUM-2
RTI API EsimRTI API Remark
RTI::RTIambassador.requestObjectAttributeValueUpdate esimRTIrtiAmbassadorRequestObjectAttributeValueUpdate
requestObjectAttributeValueUpdate
c Dutch Space BV
RTI::RTIambassador.retract esimRTIrtiAmbassadorRetract retract
RTI::RTIambassador.unconditionalAttributeOwnershipDivestiture esimRTIrtiAmbassadorUnconditionalAttributeOwnershipDivestiture
SUM
unconditionalAttributeOwnershipDivestiture
525
iss: 5 rev: 4
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
526
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix J
J.1 Introduction
The run-time interface of EuroSim is the interface which is used to communicate with the running simu-
lator. The Simulation Controller tool and the batch utility use this interface to start a new simulation run
and to control it.
This interface description provides a step by step description of how to start the simulator and what
commands to send to control the simulator once it is running. The order of the chapters is the order of
each step.
In Section J.2 is explained how to start a simulator using the EuroSim daemon and how to connect to the
new simulator. In order to receive autonomous messages from the simulator the client must subscribe to
certain channels. This is explained in Section J.3. The following 4 chapters describe each one channel.
Shutdown and cleanup is described in Section J.8. Finally, Section J.9, gives an overview of the available
manual pages on the subject.
c Dutch Space BV 527
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
u_int initconds_len;
file_def *initconds_val;
} initconds;
struct {
u_int calibrations_len;
file_def *calibrations_val;
} calibrations;
char *exports;
char *alias;
char *tsp_map;
struct {
u_int environment_len;
env_item *environment_val;
} environment;
int prefcon;
int umask;
int flags;
};
struct file_def {
char *path;
char *vers;
};
The file_def structure is used to store the name of the file and an optional version string. Table J.1
describes each member of the session5_def structure.
field description
sim The path and version name of the simulation definition file (.sim). It can be an
absolute or relative path name. If it is a relative path name, it is relative to the path
in work_dir.
work_dir The path name of the current working directory of the simulator. The directory
should exist and be accessible by the EuroSim daemon. Normally this is done by
making the directory available through NFS in case the RPC call is performed from
a different host.
simulator The file name of the simulator executable (.exe). It can be an absolute or relative
path name. If it is a relative path name, it is relative to the path in work_dir.
schedule The file name of the simulator schedule file (.sched). It can be an absolute or
relative path name. If it is a relative path name, it is relative to the path in
work_dir.
scenarios An array of scenario files (.mdl). It can be an absolute or relative path name. If it is
a relative path name, it is relative to the path in work_dir.
dict The file name of the data dictionary file (.dict). It can be an absolute or relative path
name. If it is a relative path name, it is relative to the path in work_dir.
model The file name of the model file (.model). It can be an absolute or relative path
name. If it is a relative path name, it is relative to the path in work_dir. This file is
not actually used by the simulator for reading. It used for tracing purposes as a
reference.
recorderdir the path name of the directory where all recordings are stored. It can be an absolute
or relative path name. If it is a relative path name, it is relative to the path in
work_dir.
initconds An array of initial condition files (.init). It can be an absolute or relative path name.
If it is a relative path name, it is relative to the path in work_dir.
Table J.1: session def structure
528
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
field description
calibrations An array of calibration files (.cal). It can be an absolute or relative path name. If it
is a relative path name, it is relative to the path in work_dir.
exports the file name of the exports file (.exports). It can be an absolute or relative path
name. If it is a relative path name, it is relative to the path in work_dir.
alias the file name of the alias file (.alias). It can be an absolute or relative path name. If
it is a relative path name, it is relative to the path in work_dir.
tsp_map the file name of the TSP map file (.tsp). It can be an absolute or relative path name.
If it is a relative path name, it is relative to the path in work_dir.
environment an array of environment variables in the usual format VAR=value. Normally it is
sufficient to copy the entire current environment into this array. If you want to start
the simulator with a custom environment setting you have to set at least the
following environment variables used by EuroSim in addition to the ones used by
the simulator model software. EFOROOT should be set to the EuroSim installation
directory. EFO_SHAREDMEMSIZE is the amount of memory reserved for dynamic
memory allocation. Default is 4194304 (4 MB). This value can be set in the
ModelEditor since Mk3rev2. EFO_STACKSIZE is the stack size reserved for each
thread of the simulator. Default is 128k (IRIX) or 16k (Linux). This value can be set
in the ModelEditor since Mk3rev2. PWD is the current working directory and is set
to work_dir by the daemon if it is not present. LD_LIBRARYN32_PATH should be set
to the path of the shared libraries of EuroSim for IRIX 6.5. The value is normally
$EFOROOT/lib32. LD_LIBRARY_PATH should be set to the path of the shared
libraries of EuroSim for other systems than IRIX 6.5 (e.g. Linux). The value is
normally $EFOROOT/lib.
prefcon set to -1 under normal circumstances, a connection number is selected by the
daemon and returned on successful start-up of the simulator. Put a positive value
here if you want to force the new simulator to have a specific connection number.
umask the umask used for creation of new files. See umask(2).
flags there are currently two flags defined: SESSION REALTIME and
SESSION NO AUTO INIT. Flags shall be or-ed together. Add the
SESSION REALTIME flag for real-time runs, or do not set the flag for
non-real-time runs. The SESSION NO AUTO INIT flag can be set to prevent the
EuroSim scheduler from automatically going into initializing state. This is used by
the EuroSim Simulation Controller to set break points and traces and to disable
tasks before the simulation goes into initializing state.
Table J.1: session def structure
The following small example in C will show how to start a simulator using representative values for the
parameters.
int main(void)
{
struct session5_def session;
struct start5_result *result;
env_item env[6];
file_def scenario;
c Dutch Space BV 529
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
file_def initcond;
CLIENT *clnt;
session.sim.path="Demo.sim";
session.sim.vers="";
session.work_dir="/home/user/projects/STD";
session.simulator="Demo.exe";
session.schedule.path="Demo.sched";
session.schedule.vers="";
scenario.path="Demo.mdl";
scenario.vers="";
session.scenarios.scenarios_len=1;
session.scenarios.scenarios_val=&scenario;
session.dict="Demo.dict";
session.model.path="Demo.model";
session.model.vers="";
session.recorderdir="2000-04-01/00:00:01";
initcond.path="Demo.init";
initcond.vers="";
session.initconds.initconds_len=1;
session.initconds.initconds_val=&initcond;
session.exports="Demo.exports";
session.alias="Demo.alias";
session.tsp_map="Demo.tsp";
session.prefcon=-1;
session.umask=022;
session.flags=SESSION_REALTIME;
env[0] = "LD_LIBRARY_PATH=/usr/EuroSim/lib";
env[1] = "HOME=/home/user";
env[2] = "EFO_HOME=/home/user/project/EfoHome";
env[3] = "LD_LIBRARYN32_PATH=/usr/EuroSim/lib32";
env[4] = "PWD=/home/user/project/STD";
env[5] = "EFOROOT=/usr/EuroSim";
session.environment.environment_len = 6;
session.environment.environment_val = env;
530
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Linux:
It is however easier if you use the esimd_complete_session function to fill in the missing pieces.
You only have to provide the simulation definition and the other entries will be completed by the
esimd_complete_session:
memset(&session, 0, sizeof(session));
session.work_dir = ds("/home/user/projects/STD");
session.sim.path = ds("Demo.sim");
if (esimd_complete_session(&session, environ) == 0) {
/* start session */
esimd_free_session(&session);
}
}
After successfully launching the simulator a connection can be created. There is some time between
launching the simulator and when a connection can be created. This time is normally less than a second.
To make a connection with the simulator the function eventConnect() must be called.
The second parameter is the client name. In this example it has the value “test-controller”. If the string
contains the sub-string “-observer”, the client is treated as a read-only client of the simulator. The client
can monitor variables but not change them. The client cannot do anything which influences the simulator.
The parameter eventHandler is the callback function which is called when an event from the simulator
has been received. Each event results in one call to the callback. The callback must determine the type
of the message and decode its contents. The callback has one parameter called userdata which contains
the value given when calling eventConnect().
The following example in C code shows an implementation of the eventHandler callback.
c Dutch Space BV 531
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
simtime = evEventSimTime(event);
wallclocktime = evEventRunTime(event);
switch (evEventType(event)) {
case maMessage:
evEventArg(event, &offset, EV_ARG_STRING(&sev));
evEventArg(event, &offset, EV_ARG_STRING(&thread));
evEventArg(event, &offset, EV_ARG_STRING(&mesg));
printf("%s: %s %s\n", auxSeverity2string(sev), thread, mesg);
break;
case scSpeed:
evEventArg(event, &offset, EV_ARG_DOUBLE(&speed));
printf("speed = %f\n", speed);
break;
}
return 0;
}
The programmer can choose to use synchronous or asynchronous handling of events. The example above
has chosen for asynchronous event handling. This means that each time an event arrives a signal (SIGIO)
is sent to the application. The library installs a signal handler which ultimately calls the eventHandler
callback. If you select synchronous handling, the application has full control over when events are
read. Using select(2) the programmer can determine if data is ready to be read and would then call
eventPoll() to process all the available events. The function eventPoll() will call the eventHandler
callback for each event.
eventJoinChannel(conn, MISSIONCHANNEL);
For a simulator client it is mandatory to join the MISSIONCHANNEL. After launching the simulator,
the simulator waits with the further initialization until the first client joins this particular channel. The
532
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
simulator can then send its messages to a client. This is particular useful when something goes wrong. It
enables the user to read the messages and take corrective actions.
The following four chapters will describe each channel in detail. Each chapter will contain tables de-
scribing events coming from the simulator and commands which can be sent to the simulator. Each
command is sent using an event* function. This function takes 2 or more arguments. The first two
arguments are always the same. The first argument is the handle to the connection, the second argument
is a pointer to an AuxStamp structure which can be a NULL pointer for clients.
eventJoinChannel(MISSIONCHANNEL)
rtUnconfigured rtInitializing
(automatic)
(automatic)
eventAbort
rtStandby
eventStop
eventAbort
rtExecuting
Table J.3 lists the messages sent to the client after joining the real-time control channel.
Table J.4 shows the functions which can be used to request the change and the events sent back as a
result.
c Dutch Space BV 533
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
As state transitions may take some time, a rtTimeToNextState message is sent to the simulator client
which contains the amount of time to the transition.
After joining the rt-control channel the current simulator state is sent. All state transitions from then on
are sent to the client, including automatic state transitions, or transitions requested by another client. The
standard time stamps of the state transition message can be used to calculate valid future state transition
times which can be used to issue timed state transition commands. To calculate a valid future transition
time take the wallclock or simulation time from the last state transition message and add an integer
number of main cycle times.
The following example in C requests a state transition at midnight on April 1, 2001 (wallclock time):
534
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
struct tm tm;
tm.tm_sec = 0;
tm.tm_min = 0;
tm.tm_hour = 0;
tm.tm_mday = 1;
tm.tm_mon = 4;
tm.tm_year = 100; /* years since 1900 */
tm.tm_isdst = 0;
tv.tv_sec = mktime(&tm);
tv.tv_nsec = 0;
eventGoAt(conn, NULL, &tv);
Table J.6 shows the events which can be sent to the simulator and the responses they send back. Argu-
ments are enclosed in angled brackets. Literal messages are in courier where variant parts are in italic.
Wherever you see the word file (as in scenario file) a file on disk is meant. All other references to scenario
are to the run-time data structure inside the simulator.
c Dutch Space BV 535
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
1
In case a monitor action (obsolescent) is executed various messages from the monitor channel are generated. These can be
found in Table J.9
536
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Table J.7 shows the events relating to messages which can be sent from the model code or the simulator
infrastructure.
The following example in C requests the loading of a scenario file into the simulator.
c Dutch Space BV 537
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The result will be a maMessage event informing about the successful opening of the scenario file.
• monitor values
• heartbeat
Alternatively it is possible to retrieve the value of a variable only once by using the dtGetValueRequest
command.
Table J.10 shows the event sent periodically at 2 Hz for each variable in an active monitor.
538
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Table J.12 shows the messages sent on the mission channel autonomously with a frequency of 2 Hz.
The following example in C requests the monitoring of a specific variable in the data dictionary of the
running simulator.
From this moment on dtLogValueUpdate messages will be sent to the simulator client with 2 Hz. To
stop these messages call:
c Dutch Space BV 539
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
540
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
There are three groups of events which need additional attention. These groups of events are used to
transmit complicated data structures to the client:
• task list
• event list
• debugger position list
The task list uses 5 events which are sent in a nested fashion.
The task list starts with scTaskListStart and ends with scTaskListEnd. After scTaskListStart one
or more tasks are sent. Each task starts with scTaskStart and ends with scTaskEnd. After scTaskStart
one or more entry points are sent. Each entry point is sent using scTaskEntry.
c Dutch Space BV 541
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
The event list starts with scEventListStart and ends with scEventListEnd.
After scEventListStart one or more event descriptions are sent. Each event is sent using scEventInfo.
The debugger position list, also called where list, starts with scWhereListStart and ends with the re-
sponse scWhereListEnd. After scWhereListStart zero or more positions are sent. Each position is
sent using scWhereEntry.
Table J.15 shows the messages sent autonomously every 2 seconds.
The following example in C sets the speed of a non-realtime simulator to run as fast as possible.
From now the scheduler from EuroSim will execute all models as fast as possible. The event scSpeed is
sent at 2 Hz. The value of the speed parameter will reflect the actual acceleration achieved.
eventDisconnect(conn);
After disconnecting from the simulator it is not possible to send messages to the simulator. However it
is possible to reconnect to the simulator using the functions described in Section J.2.
events(3) Retrieval system for information about all available EuroSim events
evEvent(3) Event construction, access and I/O functions
rt-control(3) Real-time control events
data-monitor(3) Monitor events
sched-control(3) Scheduler control events
Table J.16: Overview of relevant manual pages.
542
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 543
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
544
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix K
K.1 Introduction
The execution sequence of as fast as possible (AFAP) scheduling is a result of the same constraints as
normal real-time scheduling and the overall behavior will thus be the same. However, one should be
aware that AFAP scheduling exploits the parallelism of the schedule to a maximum. If a schedule is not
well defined, this parallelism could lead to erroneous behavior. Below is an explanation of the opera-
tion of the scheduler, followed by some examples illustrating AFAP scheduling and some consequences
regarding parallelism.
c Dutch Space BV 545
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
50Hz/0ms
50Hz/5ms
simulation time
0 5 10 15 20
real
A allowed
real
B allowed
0 5 10 15 20
wall clock time
simulation time
0–10 15 20
A real
B real
0 5 10 15 20
wall clock time
Figure K.3 shows the execution sequence of the AFAP simulation. After task A is started, the simulation
time may be increased immediately up to 5 ms, because there is no task with a deadline at 5 ms. Task
B can thus be started and the simulation time can be increased up to 10 ms. The simulation time can be
increased up to 15 ms only after the completion of task A and up to 20 ms after the completion of task
B. The 20 ms of simulation time are executed in 6 ms real time, an acceleration factor of 3.3.
In the AFAP simulation task A and B run in parallel where they were running exclusive in the real time
simulation.
546
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
simulation time
0 5 10 15 20
real
A allowed
real
B allowed
0 5 10 15 20
wall clock time
Figure K.4: Real time execution sequence with 5 ms allowed execution time for task A
simulation time
0 5–15 20
A real
B real
0 5 10 15 20
wall clock time
Figure K.5: AFAP execution sequence with 5 ms allowed execution time for task A
A B C
100Hz/0ms
The schedule has a basic frequency of 1000 Hz and the tasks have the following properties:
In a real time run these specifications result in the following task sequence:
c Dutch Space BV 547
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
simulation time
0 5 10 15 20
real real
A allowed allowed
real real
B allowed allowed
real real
C allowed allowed
0 5 10 15 20
wall clock time
simulation time
0–3 4–7 8–11 12–17 18–21 22–27
B real real
C real real
0 5 10 15 20
wall clock time
After task B has completed simulation time can be incremented to 11 ms allowing task A to start again.
According to the schedule this is allowed, since task C does not depend on A. The effect is that task A
and C run in parallel.
If this is not the intended behavior then task C should be made dependent on task A (Figure K.9) or the
sum of all allowed execution times should be made smaller then the task period.
In fact, with this schedule parallelism would also occur in the real time situation if every task had a real
execution time of 4 ms.
A C
100Hz/0ms
548
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
K.7 Performance
Estimates for the acceleration factor in AFAP scheduling can be made with the data form the timings file
incremented with the scheduler overhead of Table K.1.
Note that the ActionMgr has a default frequency equal to the basic frequency. This can become one of
the major CPU consuming tasks in an accelerated simulation. Accelerated simulations will run faster if
the ActionMgr is scheduled at a lower frequency.
c Dutch Space BV 549
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
550
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix L
L.1 Introduction
EuroSim Mk3 offers a completely rewritten GUI based on the Qt toolkit. A lot of effort has been in-
vested in eliminating the shortcomings of the Mk2 interface. At the same time new features have been
introduced which result in some user visible changes.
The changes for each tool will be described in a separate chapter. The last chapter describes the conver-
sion tool which is capable of converting a complete project from Mk2 in Mk3.
c Dutch Space BV 551
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
user analyze timing behavior of the system. Where the Mk2 time bar display showed timings based on
average, minimum and maximum values, the Mk3 variant will show individual timings.
The special EI input connector has been removed in Mk3. This is done because all external events can
now be configured in the ’Tools: External Event’ menu of the Schedule Editor, it was decided to not have
an exception for the EI (External Interrupt) on SGI. You can simply create an external event handler for
’EI’ with the appropriate path (i.e. /dev/ei) and set the dispatcher type to ’default’. The Schedule Editor
then automatically adds an external input connector with the name of the event handler to the ’Insert:
External event’ menu. You can then use this input connector just as the ’EI’ input connector in Mk1 and
Mk2.
After the conversion a new project database file has been created called projects.db. If you start now the
new Mk3 Project Manager you will see all the existing projects back.
It is also possible to convert individual projects. In that case you call the conversion tool like this:
host:˜/EfoProject$ projconv .
After the conversion the files in that directory have been converted and a file database for this project has
been created called project.db.
The conversion of a project consists of the following activities:
552
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• build clean for every Mk2 makefile found and remove the makefile (extension .mk)
• convert Mk2 plot description files (pdf) into Mk3 plot files (plt)
• create a project file database with the following contents: model files, schedule files, simulation
definition files, MDL files, initial condition files, User Program definition files.
c Dutch Space BV 553
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
554
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix M
Introduction to CVS
M.1 Introduction
CVS, short for Concurrent Versions System, allows you to save versions of your files for later retrieval
by yourself or other users (provided they have sufficient access rights). The files are stored in what is
called a “repository”. This chapter describes the basic commands that are required to start using CVS
with EuroSim. See [CVS00] for more information on CVS.
• Open a shell and change directory to the designated directory (create it first if it doesn’t exist yet):
cd repository root directory
See Section M.4 for a description on how to use CVS under Windows.
If all went well, a CVSROOT directory is created in the repository root directory. Note that you only have
to perform the above steps once.
• Go to the directory where the files of your EuroSim project are located (model files, schedule file,
etc. . . ).
cd project directory
c Dutch Space BV 555
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
You can now start the EuroSim Project Manager, select your project and select the Tools:Project Settings
menu command to set the project repository root to the repository root directory that you assigned to the
CVSROOT environment variable. When starting the EuroSim tools from the Project Manager, you can use
the Tools:Version menu commands to add files to the repository.
Other versions of CVS for Windows may require the addition of the local server specification like this:
export CVSROOT=:local:drive letter/repository root directory
For example:
export CVSROOT=:local:F:/repository
Consult the README files of the version of CVS that you are using for more information on how to set
up CVS.
556
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix N
The XML files used in EuroSim are officially described by XML schemas. These schema files are located
in the lib/schemas subdirectory of the EuroSim installation directory.
c Dutch Space BV 557
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
558
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix O
In case a problem or error with EuroSim occurs, use the spr tool for submitting Software Problem
Reports. See Figure O.1 for a screendump of the tool.
Document the problem or error with as much detail as possible. Things of interest are:
• Hardware specifications
• Sequence of actions (such as selecting files, clicking buttons, changing state of the simulator)
Preferably the problem or error should be reproducible, and try to create a minimal environment in which
the error occurs, to facilitate finding the source of the problem.
The user criticality can be one of:
Critical A major problem that hinders the completion of the user’s job. This category includes a time
aspect (solution is needed as soon as possible) for the user to be able to finish the job.
Major A serious problem, but the user can still continue with the job.
Minor A problem was noted, but it is not seriously affecting the use of EuroSim.
Suggestion
A suggestion for the improvement of EuroSim.
Question
A question on EuroSim details.
If you are not able to submit the SPR by e-mail, then please send a paper version and any related infor-
mation to:
c Dutch Space BV 559
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
560
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix P
The actual plugin can use several methods to communicate with EuroSim. This way Variables can
be requested, values changed, names set, etc. These methods are available through scMonInterface.h.
Detailed descriptions are given in the header files itself.
c Dutch Space BV 561
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
changeValue
Change the value of a variable in the model.
getValue
Request the value of a variable in the model.
setVarlist
Set the list of used variables.
getVarlist
Request the list of used variables.
parentWidget
Request the parent widget of the plugin.
dictWidget
Request a variable selection dialog.
getPluginPath
Request the path to the shared library
setCaption
Set the caption of the plugin monitor
getCaption
Request the caption of the plugin monitor
addProperty
Add a custom property.
readProperty
Request the value of a property.
clearProperty
Clear all custom properties. Usefull to rebuild the list.
deleteProperty
Remove a single property.
An example makefile for each plugin example is provided. They are called plugin.make and placed with
the source code. These should help the user to quickly generate their own makefile for building, installing
and testing their plugin.
After a plugin is compiled to a shared library, it can be tested for basic loading functionality. For this
purpose a small program called pluginTest can be used. It is located in the EuroSim src/MmiPlugin
directory. It requires the path to the shared library as an argument.
562
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Appendix Q
Q.1 Introduction
Phar Lap ETS is a dedicated real-time operating system that supports a subset of the Windows Applica-
tion Programming Interface (win32 API). EuroSim supports this platform with some constraints, which
are described in this chapter.
$EFOROOT/lib/PharLapSupportedWin32API.txt
When building a simulator for the Phar Lap target, the tool checkPharLapAPI is used to check that
the simulator is not using any unsupported Win32 API calls. In the log window of the Model Editor a
warning is given for each unsupported function that is referenced by the simulator.
Following is a list of a selection of functions that are not supported by Phar Lap ETS, but which are
reimplemented for EuroSim simulators with suitable default behaviour. The implementation for (most
of) these functions is empty, unless indicated otherwise.
ADVAPI library
AllocateAndInitializeSid
DeregisterEventSource
GetSidSubAuthorityCount
GetTokenInformation
GetUserName
LookupAccountSid
OpenProcessToken
RegCloseKey
RegCreateKey
RegSetValueEx
RegisterEventSource
ReportEvent
c Dutch Space BV 563
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
KERNEL library
AddAtomA
CreateProcess
OpenProcess
SetPriorityClass
SetThreadIdealProcessor
SleepEx Implemented with Sleep()
TerminateProcess
VirtualLock
FormatMessage
GetExitCodeProcess
GetSystemInfo dwNumberOfProcessors defaults to 1
GetTempPath Defaults to C:/temp
WaitForSingleObjectEx Reimplemented with WaitForSingleObject()
MPR library
WNetGetUniversalNameA
NETAPI library
Netbios
RPC library
authunix create default
clnt create
clnt pcreateerror
xdr array
xdr int
xdr string
xdr void
WINMM library
timeSetEvent
timeBeginPeriod
timeEndPeriod
timeGetDevCaps
timeKillEvent
WINSOCK library
WSASetEvent
WSACloseEvent
WSAResetEvent
WSACreateEvent
WSAEventSelect
WSAWaitForMultipleEvents
564
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
The exit() call is supported by Phar Lap ETS, but is reimplemented to reset the system to wait for an
incoming run.cmd, instead of a process exit. This was done because the simulator runs in the same
process context as the dll loader, and an exit would thus cause the entire loader (including FTP server) to
exit.
Q.3 Building the simulator for a Phar Lap ETS target system
To build a simulator for the Phar Lap ETS platform, take the following steps:
1. Select the Tools:Set Build Options menu item in the EuroSim Model Editor.
2. Go to the Support tab page and place a check mark on the Phar Lap ETS support item.
3. Follow the usual steps for building a simulator: Make clean and Build.
The other build options may or may not work in combination with the Phar Lap ETS support option.
Some options require additional dynamic link libraries to be available at runtime on the Phar Lap ETS
target, e.g. qt-mt.dll. This is not supported at this moment.
It is important that the simulator project (on the localhost) and the simulator (running on the Phar Lap
system) reside on a file system with the same drive letter. If the Phar Lap ETS file system is mounted on
C:, then the simulator project must also reside on C:. This is required because various simulator files
use absolute paths to refer to other files. The drive on the Phar Lap ETS platform can be changed by
rebuilding the kernel.
Q.4 Running the simulator on the Phar Lap ETS target system
The mechanism for launching a simulator on a target system with the Phar Lap ETS kernel is different
from the mechanism used on other platforms (IRIX, Linux, Windows NT/XP) that are supported by
EuroSim. Because the CreateProcess() function is not supported by the Phar Lap kernel, it is not
possible to create more processes, and therefor to run more than one simulator. Neither is there support
for RPC, so the esimd daemon used on other platforms had to be replaced.
See Figure Q.1 for a representation of the sequence of events when launching a simulator on the Phar
Lap ETS target system. After startup of the system, the Phar Lap ETS boot loader loads the kernel into
memory and activates it. The kernel that is provided by EuroSim is configured in such a way that it will
automatically load the Phar Lap version of the EuroSim daemon. Once the daemon is started, it will start
an FTP server that is part of the kernel. After that, the daemon simply waits for incoming files.
c Dutch Space BV 565
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
Figure Q.1: Message Sequence Diagram for starting the simulator on a Phar Lap ETS system.
When you press the Init button on the toolbar of the EuroSim Simulation Controller, it will check which
files make up the simulator mission and send them to the target system using FTP1 . These files consist of
the EuroSim simulator files, the simulator executable, and the stubbed win32 API DLLs. Once all files
are stored, a file called run.cmd is sent. This file contains the name of the simulator executable and its
command line. The simulator executable is built as a DLL by the Model Editor. As mentioned before,
Phar Lap does not support the CreateProcess() system call, so the LoadLibrary() system call is used
instead to load the executable. After the call to LoadLibrary returns successfully, the daemon retrieves the
main entrypoint of the simulator and passes control to it. Once the simulator is running, the Simulation
Controller connects to it by means of TCP/IP, similar to simulations running on other platforms.
When the Simulation Controller disconnects from the simulation or the simulator is stopped, the (inter-
mediate) results are retrieved from the Phar Lap ETS target by FTP. The results are stored in the usual date/-
time directory structure in the simulator project directory (unless specified otherwise, see Figure 11.13).
The simulator output on stdout and stderr are redirected to the files stdout.txt and stderr.txt, re-
spectively. These files are also retrieved and stored in the date/time directory structure.
• 3com 3c509
• Crystal CS89x0
• Digital 2114x
• Intel 8254x
1
Files that are uploaded to the Phar Lap ETS target systems are placed in a RAM-disk that is created by the boot loader.
Make sure the ramdisk is large enough to hold all the necessary files. To change the size of the ramdisk the Phar Lap ETS kernel
needs to be rebuild (see Section Q.6).
566
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
• Intel 8255x
• NE 2000 Compatible
• RealTek 81x9
• SMC 8003/8216/8416
• SMC 91C92/91C94
• VIA VT610x
A kernel must be built to specifically support a netwerk adapter. Every kernel only supports a single type
of network adapter.
• All symbols that are linked to the WSOCK32.DLL at run-time, must be resolved by Phar Lap ETS’s
KERNEL32.DLL by means of the -dllredirect option at link time of the Phar Lap ETS kernel.
• The winsock32.dll functionality is contained in the Phar Lap ETS kernel. There is no mapping
from the internal symbols to the symbols that an application expects. This mapping has to be given
by the user as an export file. The export file can be linked in the kernel with the linkloc linker. The
dllload project contains the export file wsock.xpo that provides this mapping.
Under $EFOROOT/src/PharlapETS/dllload/ the source for the dllload project is found. With build.bat
the Phar Lap ETS kernel is built. The following command links the kernel with support for Intel Gigabit
network cards.
Use Microsoft Visual Studio 6 with the Phar Lap ETS integration suite to tweak the kernel parameters
such as the ramdisk size (project file is dllload.dsw). After that, build the kernel image and a boot
floppydisk with the build.bat script.
c Dutch Space BV 567
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
568
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Bibliography
c Dutch Space BV 569
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
[COM98] Inside distributed COM, 1998, ISBN 1-57231-849-X, Microsoft Press, Eddon & Eddon. Back-
ground on (D)COM components and applications.
[CVS00] CVS pocket reference, 2000, ISBN 0-596-00003-0, O’Reilly & Associates, Gregor N. Purdy.
Pocket reference to the Concurrent Versions System.
[MAN11] EuroSim manual pages, 2011, Stored in $EFOROOT/man. This directory contains the EuroSim
on-line manual pages, which can be read using the UNIXman command.
[OM11] Dutch Space BV, EuroSim Mk4.4 owner’s manual, 2011, FSS-EFO-TN-530, issue 4 revision 4.
This document contains the information relevant for the facility manager of EuroSim. Stored
in $EFOROOT/doc/pdf/OM.pdf. This file contains the EuroSim Owner’s Manual in Adobe
Acrobat format. Also stored in directory $EFOROOT/doc/html/OM. This directory contains
the EuroSim Owner’s Manual in HTML format.
[PMA11] EuroSim manual pages, 2011, FSS-EFO-SPE-523, issue 3 revision 0, 2-Sep-2004. This document
contains a printed version of all end user relevant manual pages, which are also available
on-line though the UNIXman command.
[PVW] Visual Numerics, Inc., Documentation and manuals for PV-WAVE CL version 6.01, Contains
the user manual and reference documentation for the operation of PV-Wave.
[Sec03] ECSS Secretariat (ed.), Ground systems and operations - telemetry and telecommand packet
utilization, Space engineering, no. ECSS-E-70-41A, ESA-ESTEC, 2003.
[SMP03] Simulation model portability handbook, 2003, EWP-2080, issue 1, revision 4, 2003/01/29. This
document is the Handbook for the Simulation Model Portability (SMP) Standard.
[SMP05a] Simulation model portability 2.0 c++ mapping, 2005, EGOS-SIM-GEN-TN-0102, issue 1, revision
2, 2005/10/28. This document contains the mapping to C++ for both the metamodel and the
component model of the SMP2 standard.
[SMP05b] Simulation model portability 2.0 component model, 2005, EGOS-SIM-GEN-TN-0101, issue 1, revi-
sion 2, 2005/10/28. This document specifies the component model of the SMP2 standard.
[SMP05c] Simulation model portability 2.0 handbook, 2005, EGOS-SIM-GEN-TN-0099, issue 1, revision 2,
2005/10/28. This document is the Handbook for the SMP2 Standard.
[SMP05d] Simulation model portability 2.0 c++ model development kit, 2005, EGOS-SIM-GEN-TN-1001,
issue 1, revision 2, 2005/10/28. This document contains the documentation of the Model
Development Kit for the SMP2 standard.
[SMP05e] Simulation model portability 2.0 metamodel, 2005, EGOS-SIM-GEN-TN-0100, issue 1, revision
2, 2005/10/28. This document describes the metamodel specification (SMDL) of the SMP2
standard.
[SPR11] Resolved SPR list, 2011, Stored in $EFOROOT/etc/ResolvedSPRList. This file contains a list
of solved bugs (SPRs) of each EuroSim release.
c Dutch Space BV 571
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
[SUM11] Dutch Space BV, EuroSim Mk4.4 software user’s manual, 2011, NLR-EFO-SUM-002, issue 5
revision 4. Stored in $EFOROOT/doc/pdf/SUM.pdf. This file contains the EuroSim Software
User Manual in Adobe Acrobat format. Also stored in directory $EFOROOT/doc/html/SUM.
This directory contains the EuroSim Software User Manual in HTML format.
[VMI93] VMIVME-6000, 1553 communications interface board, product manual, October 26 1993,
These documents contain information on the VMIVME-6000 BCU software library.
572
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
Index
EuroSim python, 207
services tcl, 255
see services, 435 useful command line utilities, 156
BC
action see bus controller, 327
action manager number, 118 BM
condition, 94, 118 see bus monitor, 328
error conditions
see MDL, 93 C language limitations
icons, 114 see API limitations, 491
inactive, 118 C++
monitor Interface reference, 395
see monitor, 94 C++ support
recorder see C++ interface reference, 395
see recorder, 94 Calibration Editor
script, 93 calibration types, 67
editor, 117 menu, 69
stimulus overview, 8
see stimulus, 94 reference, 67
action button client
editor, 127 see external simulator, 343
Action Editor COM Interface
overview, 9 reference, 365
reference, 117 connectors
action manager output
configuring multiple, 80 using for I/O, 85
multiple, 88 CPU load monitor, 106
scheduling, 87 CVS, 555
ADA language limitations Use under Windows, 556
see API limitations, 492
alias, 98 data dictionary
alias file alias, 98
example, 476 Datapool
file format, 476 Model Description Editor, 57
API Simulator Integration Support, 355
examples, 487 deadlock, 491
header layout, 485 Debug Control
limitations breakpoint on task entry point, 110
ADA language, 492 concepts, 110
C language, 491 enable/disable task, 110
Fortran language, 492 return to normal, 110
generic, 491, 527 step to next entry point, 110
variables trace task entry point, 110
conflicts, 47 debugging using gdb, 448
/dev/ei, 326
Batch utility dict view
example script, 154 choosing EuroSim views, 344
java, 157 choosing external views, 344
perl, 147 compression, 349
c Dutch Space BV 573
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
574
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 575
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
576
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 577
iss: 5 rev: 4 SUM NLR-EFO-SUM-2
578
c Dutch Space BV
NLR-EFO-SUM-2 SUM iss: 5 rev: 4
c Dutch Space BV 579