Mochy Specification

LogoMochy

Mochy / Models for Concurrent Hybrid Systems

1. Presentation

This is the explanation about the code structure made to run the simulation of the transport systems.
It is advised to read the user guide first.
It will first explain the global architecture of the software, then it will be about the network model, the timetable model, the joint of those two models and the details of the user interface.
It is developped with Java 14.0.2, Javafx 11.0.2 and use Graphviz 2.50.0.

2. Software Architecture

The software is separate in two projects : MochyCore for the kernel which create and control the models and MochyUi which is the User Interface made with JavaFX. It simulate the models set in MochyCore.

diagram project general structure

There is abstract classes PhysicalModel for the Net and Schedular for the TimeTable to let the possibility to add future models.

3. Network Model Specification

The Network Model is in the MochyCore project in the mochy package.
The model of the network can be specified at the start of the input file (Net, EqualizationNet or TrajectoryNet), and can be loaded automatically as specified in the methods LoadFiles.generateSimu, Preferences.initialize and Sim.Sim.

3.1. Initial set up

diagram network general structure
Figure 1. Creation of a network from a file
    ClassLoader classLoader = getClass().getClassLoader();
    File file = new File(classLoader.getResource("reseau5.net").getFile());
    String netFileUrl = file.getAbsolutePath();
    Sim simu=new Sim(0,netFileUrl, "test.txt", false);
    simu.getN().loadFile();

The Sim constructor has four parameters :
- the number of steps
- the net file url
- the path of the logs
- the boolean parameter is true to enable the logs.

It creates a new net which take the net file url as parameter.
Then simu.getN().loadFile() creates the net with the places, the transitions, their predecessors and successors depending on the inflow and outflow.

The predecessors and successors places of a transition fill respectively the pre and post list parameter of the transitions.

It fills also the Marking attribute which contains the different places which are marked at the initial configuration. It is evolving during the simulation.

3.2. Simulation

There is multiple ways of control of the net from the Sim class.

There is the move function which advance the time by decreasing the clocks of the maximum allowed time or fire a transition if there is a firable one. This mean that a transition was enabled with a specific clock, the clock decreased until 0 and there is no filled places in its successors.
If there is multiple firable transitions, one is chosen randomly. The maximum allowed time is the smallest clock value of the enabled and firabled transitions.
The move function has a parameter to be set to true to save the logs

There is the oneStep function which is similar to the move function but it taked into account stats for the blocked transitions.
The simtot count the number of blocked transitions since the creation of the net and siminfo list the blocked transitions at each step since the start.
The logs are saved if the attribute enableLogs has been set at the creation of the net.

There is the main function which take into parameter the number of steps to perform.

There is the fireTransition function to fire, if possible, the specific transition set as parameter of the function. The parameter is the name of the transition.

There is the discreteStep function which fire a random firable transition if there is some.

The displayFeedback function return a list of the transitions and places at the current time. The transitions and places are encapsulated in a Dom class which has an attribute type which is equal to p for the places and t for the transitions.

The reset function reload the net to set it up at its initial configuration.

3.3. TrajectoryNet

For the trajectory net, which can be set from Edit/Preferences, is a model which has transitions, as in the previous model, but it has also some places with specific behaviour.
A place can contains multiple trajectories, which represent the evolution of the location of a token during a specific time.
A trajectory can contains multiple segments which are made of two points.
If a place contains a usable trajectory and the clock of the next transition is 0, this transition is fireable. A trajectory is usable if it has a distance of 0 at the time 0.
A Trajectory.leftShift function is used to symbolize the advancement of the time.
Multiple functions are used to preserve the behavior of the trajectories in a place :

  • Trajectory.isBlockedBy : it check if a trajectory cross another trajectory headway.

  • Trajectory.truncateFrom : it allows to cut the trajectory from the point where the trajectory cross another trajectory headway. It also save the cut part as saveTraj to recover when the trajectory which block will be consumed.

  • Trajectory.followFrom : it allows to follow a trajectory and its headway from a specific point.

  • Trajectory.recover : it allows to recover a trajectory from the save trajectory saveTraj as it is not blocked anymore by a consumed trajectory. It also recover the trajectories blocked by this one.

  • TrajPlace.refactor : when a trajectory is consumed, as all the other trajectories have been recovered their originate trajectories, the refactor function is called to recalculate the trajectories to avoid some conflicts between trajectories and their headway.
    A place is defined in the .net file as place:nb:name:distance:headway where distance and headway are float numbers.

3.4. EquNet

The equalization net has its own specification in DevelopmentNotes/CircleRegulation.pdf.

4. Timetable Model Specification

The Timetable Model is in the MochyCore project in the timetable package.

4.1. Initial Set Up

diagram timetable general structure
Figure 2. Creation of a timetable from a file
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("timetable3.tt").getFile());
String fileUrl = file.getAbsolutePath();
TimeTable timeTable = new TimeTable(fileUrl); #1
timeTable.fileLoading(); #2
TTConfig ttConfig = new TTConfig(timeTable); #3
ttConfig.init("", false); #4

#1 : The TimeTable constructor initialize attributes : lists (events, dependencies, and topoOrder) and the filename.
#2 : The fileLoading function load the timetable from the file. It creates the events, its tags and the dependencies. The dependencies fill the predecessors and successors lists of events. It also fill the dlist of the events which means that the event is an end event of the dependency.
#3 : The TTConfig constructor takes a timetable as parameter and initialize the date to 0.
#4 : The init method takes two parameters. There is the file name for the logs and a boolean set to true to save the logs. It also calculates the minevents which is, at the start, the list of the events which have no predecessors or the predecessors have been realized.

4.2. Simulation

There is multiple methods of control the timetable from the TTConfig class.

There is timeMove which take the duration to advance the time as parameter.

discreteMove takes the number of an event as parameter. It realizes the event if its date is achieved (the current date is superior or equal to the event date) and it has no unrealized predecessors events.
If enableLogs has been set, the realized event will be logged with the date of its realization in the log file. (The log folder can be set in the Preferences pane.)
If there is a delay at the realization of the event the following method is called PropagateDelay(event number, delay) from the instance of TimeTable. It will add a delay to the date of all the successors events and their sucessors…​etc

The allRealized method return true if all the events of the timetable has been realized.

The reset method set the current date at 0, set all the events realization to false and set their date to the initial date as specified in the file used for creates the timetable.

4.3. TTChecker

The TTChecker class has a constructor which takes a TimeTable as parameter.
It has the method hasNoCycle which return false if the timetable has a cycle.
This means that an event appears as an end event of a dependency, the start event of another and is linked to the end event of another dependencies which is linked to the last one.
The second method verifiedConstraints checks the time constraints between the dates of two events and the duration of the dependency which link those two events.

4.4. Tag

A tag is linked to multiple events and allow to calculate the delays statistics (the sum, the average and the confidence interval) of the events linked to this tag.
The tag constructor takes its name as parameter.
The method addEvent allows to add an event linked to this Tag as specified in the timetable file.
The method addDelayOfAnEvent allows to add a delay of any event linked to this tag.
The confidence interval determines alpha and beta which determine the interval in between 95% of the delays of the events linked to the tag are present. The method computeConfidenceInterval must be called to calculate alpha and beta.

4.5. Table.propagateDelay

It calls the visit method of the Table instance which allows to create a topological order which means it constructs a list depending of the link between a start event given as parameter and all the following events which depend from it.
Then the topoligical order list is browsed in the correct order. If the date of an event is inferior of the date of its predecessor + the duration specified in the link dependency, the delay is added to the date of the event.

5. Joint Model Specification

The management of the Joint Model between a timetable and a net is done mainly in the package RPN of the MochyCore project.
The first step is to creates the RegulNet and call the loadCorrespondance method.
The second step is to creates the RPNConfig which will help to manage the simulation of the joint model.
The joint model can be saved and load through File/save/load project : the name file of the net, timetable and/or correspondancies are written/read from the project file. They are open through the net folder as defined in edit/preferences for the net files and correspondance files and from the timetable folder as set in edit/preferences for the timetable files.

5.1. RegulNet

It takes a timetable and a net as parameters.

It allows to construct the link between the net and the timetable.

The loadCorrespondance method takes the file of the correspondancies as parameter, will browse the file and will add :

  • for the line of the form transition i implements event j will add to the event which number is j the transition i.

  • for the line of the form event i allows place j will add to the event which number is i the place j.

5.2. RPNConfig

This allows to perform the simulation of the joint between the net and the timetable.

The RPNConfig constructor takes also a timetable and a net as parameters. It takes also the path of the logs to save and the boolean value to true if the logs have to be saved.

5.2.1. perform a time move

Long remTime = rpnc.maxTimedMove(); #1
rpnc.advanceTime(remTime.intValue()); #2
ttConfig.timeMove(remTime.intValue()); #3

#1 : the maxTimedMove function of RPNConfig instance :

long deltanet = (long) currentNetConfig.maxAllowedTimedMove(); #a
long deltaTT = currentTTConfig.maxAllowedTime(getCurrentTime()); #b
if (deltaTT < 0) { return deltanet;} #c
if (deltaTT < deltanet) { return deltaTT;} #d
else { return deltanet;} #e

#a : it is 0 if there is some firable transitions. It is 0 also if there is no firable and no enabled transitions. If there is some enabled transitions the value returned is the minimum of the clock of the enabled transitions.
#b : it is the min time between the events and the current time for the events which are linked to places. It is -1 if there is no events linked to places. It is inferior to 0 if there is events linked to places but none of them have an initial date superior or equal to the current time.
#c,d,e : the time returned is deltanet if deltaTT is inferior to 0 or if deltanet is inferior or equal to deltaTT. Else the time returned is deltaTT.

#2 : the time returned is used to advance the time of the RPNConfig instance.
#3 : it is also needed to advance the time to the TTConfig.

5.2.2. perform a discrete move

In order to perform a joint discrete move, the method tryDiscreteMove from the StartController is called.

It first checks if there is fireable transitions, then checks if there is a linked event ready to be realized.
If there is one the transition and its linked event are fired.

Else if there is a fireable transition and a linked event not ready to be realized, the method return false to let time to be elapsed such as the linked event is ready to be realized.

Else if there is a fireable transition not linked to any not realized events, it is fired.

6. User Interface

The user interface has been developed with JavaFX. It contains multiple windows which have for each a Controller class and a fxml file wich is in the resources folder. The controller describes the interactions between the user interface and the user. The fxml files describe the user interface : buttons, text fields, menus and display informations through tables or labels. They are constructed with JavaFX Scene Builder. The controller linked to a specific fxml file is mentioned in the pane xml tag with the attribute fx:controller="package.class"
The view class has methods which load the fxml files.

The Main class load start.fxml which contain the main window and the interaction are done with the class StartController. It contains the menus and a button to display a chart. When they are clicked it calls the view class to load the specific fxml file. The view class calls the JfxUtils.loadFxml to load the fxml file. Then it prepares the window base elements like the Scene and the Stage used to display it.

diagram user interface general structure

The chart window is linked to chart.fxml and BarChartController.

The config window is linked to config.fxml and Config.

The multiple runs window is linked to multipleRuns.fxml and MultipleRunsController.

The preferences window is linked to preferences.fxml and PreferencesController.

The stats window is linked to stats.fxml and StatsController.

Each controller contains an initialize method which allow to setup the initial configuration of the window.
It contains also attributes and methods linked to the fxml file with the annotation @FXML. The attributes are linked to objects defined in the fxml file with their fx:id like labels, chart and tables. The methods are linked to events fired with a click on a button or a menu. It is defined in the fxml file with the onAction="#method" parameter.

The fxml files are build with JavaFX Scene Builder.

6.1. startController

The startController initialize method prepares the tables columns with their names and their sizes. It prepares also the tables with the specific colors for a kind of transitions or event and allow the double click to fire a transition or an event if possible. It adds a button too for the chart column of the transitions table which fire an event to launch the chart window to display the random distributions.

There is multiple methods for the simulation of the net :

  • loadNet : it is the target of the menu File/Load net click. It calls the method loadNetFile (used to open a directory to choose a net file) from the LoadFiles class, return the logs if there is errors at the bottom of the main window and it display the content of the net on the table.

  • oneStep : it is linked to the One Step button. It calls the oneStep function of the instance of the Sim class and display the updated net on the table (for the transitions and the places).

  • launchSteps : it is linked to the launch button of the interface. It get the number of steps to perform from the textfield and calls the main class of the Sim instance to make multiple steps. It then display the updated net.

  • discreteStep : it is linked to the Discrete step button. It fire a firable transitions if there is one. If there is multiple firable transitions, one is chosen randomly. It calls the discreteStep() method of the Sim instance. Then the contend of the table is updated.

  • timeMove : it is linked to the Timed Move button. It gets the time defined in the textfield. If this time is superior than the minimum of the clocks of the enabled and firable transitions, the time to advance will be this minimum. Else the time indicated in the text field will be advanced. The getN().progressTime(time) method will be used to progress the time with the instance of Sim. Then the content of the table will be update with the new clocks and distribution.

  • displayNet : there is two functions displayNet to display the net on the table of the interface. One takes the feedback as parameter and the other get the feedback from the displayFeedback method of the Sim instance. The feedback is the list of Dom objects which represent places with a "p" parameter and transitions with a "t" parameter. Then the displayNet function calls the displayFeedback from the View class which split the feedback in TransitionDom and PlaceDom depending of the type of the object, generate a placesList and a transitionsList with those objects and update the two tables as set in parameters. Then it calls displayInfoDiscretStep from the view class to indicates the firable transitions if there are ones near to the Discrete step button. In the end it update the max time allowed near to the Timed Move button.

    There is multiple methods for the interactions with the timetable too :

  • loadTT : it is linked to the File/Load TT menu. It calls loadTT from the LoadFiles instance. It shows a file chooser window to chose the timetable file, creates the TimeTable object, load it, creates the TTConfig object and display the infos about the timetable in the logs at the bottom of the main window. The loadTT from StartController also construct the HashMap list of the tags. If a tag of this list has the value set to true, it is used for the statistics as set in the menu Stats/Stats. It also set variables to 0 : delaySum and nbOfRealizedEvents for the stats and the date of the timetable if it is specified in Edit/Preferences. It then calls displayTTFeedback from the View instance which get the events and dependencies from the TTConfig instance through getTable().getEvents().values() and getTable().getDependencies().

  • oneStepTT : it is linked to the One step of timetable button. It get the firable event with the minimum date, calls realizeEvent with the minimum event as parameter and display the new configuration on the timetable. realizeEvent calls discreteMove from the TTConfig instance and calculate the statistics as set in Stats/Stats menu. It also propagate a delay from a specific event to the next events linked to it.

  • timedMoveTT : it is linked to the Timed Move button and get the time to advance from the field at its right. It calls timeMove from the TTConfig instance to progress the time as indicated in the field. It then update the current time of the timetable by calling getCurrentDate() from the TTConfig instance. It finally update the timetable to see the events ready to be fired at time or with delay and those which are not ready to be fired but there is still a delay.

  • randomTimedMove : it is linked to the Random Timed Move button. It is similar to the timedMoveTT method but the time to progress is chosen randomly as set in the code : for example a gaussian value chosen with a mean of 100 and a deviation of 20 with gaussSampler(100, 20) from a Sampler instance. Other distribution can be chosen from the Sampler instance in the MochyCore project.

  • delayTT : it is linked to the Delay button and the two text fields at its right : event number and time. It allows to add a delay on a specific event. This delay is propagated to the successors of this event.

  • realizeClickedEvent : it is linked to a double click on an event. It calls realizeEvent (as described in oneStepTT above) if the event is not realized and it is minimal. An event is minimal if its predecessors have been realized and its date is superior or equal to the current date.

  • globalMove : it calls tryDiscreteMove (a joint discrete move (net+tt+cor)), if it return false it advance the time.

  • tryDiscreteMove : see RpnConfig/perform a discrete move
    There is also some methods to manage the menus and their actions :

  • statsMenuItem : it is linked to the Stats/stats menu. It calls displayWindowStats from the View instance which load stats.fxml.

  • multipleRuns : it is linked to the Stats/Multiple Runs menu. It calls multipleRuns from the View instance which load multipleRuns.fxml.

  • preferencesMenuItem : it is linked to the Edit/Preferences menu. It calls displayPreferences from the View instance which load preferences.fxml.

  • config : it is linked to the Config/Config menu. It calls displayConfig from the View instance and load config.fxml (used to create/edit net and timetable files).

  • quit : it is linked to the File/Quit menu. It quit the application.

6.2. BarChartController

The BarChartController uses methods contains in the Sampler class of the sampler package in the MochyCore project.

The BarChartController is called when a click on the button of the chart column of the transitions is performed.
This button is added from the addButtonToTable of JfxUtils class. The click on the button leads to displayChart method of the View class with the TransitionDom object as parameter to indicate the transition which we want to display the distribution of the clock. This method load the chart.fxml file to display the content in a new window. The chart.fxml has BarChartController as controller.

BarChartController gets the TransitionDom object from the View class and get the sampling interval defined in the Edit/Preferences. The sampling value is the width of a bar of the chart. Then the controller will calculate the value of each bar depending of the distribution set in the end of the file of the net (none for uniform distribution, Gaussian for a gaussian distribution and Weibull:coef for the weibull distribution.

The uniform distribution will calculate the number of steps/number of bars depending of the sampling and of the lowerbound and upperbound of the clock interval. And the value for each bar which are browsed will be 1/nbSteps.

The gaussian distribution will calculate the mean, the deviation which depend of the clock interval and it will creates a new Sampler instance to calculate the gaussian value mean for the bar interval. Each bar of the interval will be browsed to get the value.
The weibull distribution creates a new Sampler instance to perform the calculation of each bar which are browsed depending of the sampling and of the interval of the clock. Then it get the coefficient from the StartController as defined in the file. It calculate also the mean in the interval of the clock. Finally it retrieve the weibull value from the Sampler instance for each bar browsed.

6.3. Config

The Config window is similar to the StartController window for the tables in the window and for the file menu.

Config is a controller linked to the config.fxml file. The config.xml is load from the displayConfig method of the View instance. DisplayConfig is called from a click on the "Config"/"create or edit net/tt" menu which is linked to config method of the StartController.

It construct the transitions, places, events and dependencies tables. It allows the table and its fields to be edited.

The methods of the Config class :

  • saveNet : it is linked to the first save button on the bottom middle of the config window. It saves the content of the transition and places table in the indicated file. The places which have a content as marked will be add to the initial marked places line.

  • addPlace, addTransition, deletePlace, deleteTransition : those methods are linked to the + and - buttons depending of the table on which we want to add or remove a specific line.

  • saveTT : it is linked to the second save button at the bottom right of the config window. It browse the events and dependencies and save them in the specified file and specified location.

  • addEvent, addDependency, deleteEvent, deleteDependency : those methods are linked to the + and - buttons depending of the table on which we want to add or remove a specific line.

6.4. GenerateTimeTable

The GenerateTimeTable class is used from the menu "Config"/"generate tt/core from net".

It allows to generate a timetable and a correspondance files in a interval of time from a net file and with a start place.

6.5. StatsController

This class is linked to the stats.fxml file which is loaded from the displayWindowStats method of the View instance. This one is called from the statsMenuItem method of the StartController class which is fired when the menu Stats/Stats is clicked.
This is the stats for the Timetable connected or not to the Net depending on the checkbox Connect/Disconnect the timetable under the events table. The stats are shown in the logs pane at the bottom of the window.

It contains multiple attributes :

  • delaySum : it allow to make the calculus of the sum of the delays on all events for a run. It communicates with delaySumEnabled from the StartController. ^ It is set to true if the delaySum checkbox is enabled, false else. Then the StartController will takes this into account to display the sum of the delays.

  • averageDelay : it allow to make the calculus of the average of the delays on all events for a run. It communicates with averageDelayEnabled from the StartController. It is set to true if the averageDelay checkbox is enable, false else. Then the StartController will takes this into account to display the average of the delays.

  • delayEscape : it is used to escape the delays inferior to the specified value in the text field. Once the escapeDelayOk button is clicked, the delayEscape attribute of the StartController is equals to the specified value. It allows to escape some statistics when a simulation is done.

  • min and max : it is used to perform stats only on the events which date is in the min and max interval. By default, min is 0 and max is not filled with which all the events will be in the stats. It communicates with minInterval and maxInterval values from the StartController. When Ok is clicked on the stats window, the intervalOk method is called which set the minInterval and maxInterval values.

  • tags : it is a checkComboBox which is a list of CheckBox. It enable the tags which are checked for the stats. It communicates with the listTags HashMap<Tag, Boolean> of the StartController. The values of the tags are set to true if the tags are enabled in the CheckComboBox. Stats will be calculated for the true tags when a MultipleRuns is launch. The results will be the average delay at this specific tag and the 95% confidence interval of a delay for the events with this tag.

  • average time between two places : when the places have been chosen and the checkbox is selected the values of startPlace, endPlace and calculTime are valorized from the StartController. calculTime is set to true if the checkbox is selected. Those values will be used from the MultipleRunsController to calculate the average time between the two places.

6.6. MultipleRunsController

This class is linked to the multipleRuns.fxml file which is loaded from the multipleRuns method of the View instance. This one is called from multipleRuns method of the StartController which is called from the Stats/Multiple Runs menu.

It has a TextField named nbRuns which contains the number of runs the user wants to perform. It is set to 1 during the initialization.

Then there is the run method linked to the run button on the multiple runs window. It creates a new Sampler instance.
It gets the HashMap<Tag, Boolean> with the list of the tags and their status : enabled or not.
It then set the total sum of the delay and the count of the realized events to 0 in order to calculate the average delay at the end for all the events of all runs.

Then a loop on the runs begin.
For each loop, the models are retrieved, the sum of the delays of a run is set to 0 as the number of realized events for the run in order to calculate the average delay of a run at the end of the loop.

Then there is a condition to verify if the simulation must be done with the timetable only or with the connection to the net.
In any case in the loop of the runs, a new loop is started and finished once all the events will be realized.

6.6.1. The timetable only

Until all events are realized :
A timedMove is done randomly following an invert transform distribution from the Sampler instance.
If an event is firable e.g. it has no predecessors or they have been realized and the date of the event is inferior or equal to the current date, it is fired. If there is multiple firable events, the one with the minimum date is chosen.
If no event is firable, a new timedMove is done.

Finally the total of the sum of the runs is increased and a log is written containing the number of the run, the sum of the delays for this run and the average delay of this run. Also the TTConfig instance reset method is called to set it up to its initial configuration.

6.6.2. The timetable connected to the net

The connection is made through the checkbox Connect/Disconnect the timetable at the bottom of the timetable.

+ The models are first loaded and until all the events are realized :
The time is advanced to the max time allowed as described in the chapter 5.2.1 .
Then the method get the firable transition and seek for the event linked to this transition.
If it is found a discreteMoveTTPN of the TTConfig instance is called.
If it is fired the stats are updated : the number of realized events, the sum of the delays for the run and the total of realized events for the multiple runs.
Then the tags are updated and a discreteMove of the Net instance is called.

Finally the total of the sum of the runs is increased and a log is written containing the number of the run, the sum of the delays for this run and the average delay of this run.
Also the RPNConfig instance reset method is called to set it up to its initial configuration.

The number of locks is displayed in the logs pane. A lock is a state of a run which there was no firable transitions linked to the current event. Then the simulation can’t go forward.

6.7. LoadFiles

There are multiple methods in the LoadFiles class which allow to manage the load of the net, timetable and correspondance files :

  • initFolders : it loads the file foldersConfiguration.txt which is in the root of the MochyUi project.
    Then it values the default folders for the logs, the net and the timetable location folder of the files as set in the window of the Preferences (menu Edit/Preferences).
    The preferences window is controlled from the PreferencesController through the preferences.fxml file.

  • loadNetFile : it is called from the StartController in the loadNet method which is fired by a click through the menu File/Load Net.
    It allows to load a file chooser in the directory as set in the preferences if it is set.
    Then it has the url of the file chosen, it set up the log file, and create a Sim instance which is returned.
    The Sim instance has a log name which is a timestamp and it is saved in the log folder as specified in the preferences.

  • loadTT : it is called from the StartController in the method loadTT which is fired from the File/Load TT menu.
    It allows to load a file chooser in the directory as set in the preferences if it is set.
    Then it has the url of the file chosen, it set up the log file, and create a TTConfig instance which is returned at the end.
    It also start the check of the timetable file and display the results in the log pane of the bottom of the window. It check if there is cycles and if there is unsatisfied constraints from the duration between two events as specified in the dependencies.
    The log files begin with TT and there is a timestamp too. They are saved in the logs folder as specified in the preferences pane.

  • loadCorrespondance : it is called from the StartController in the loadCorrespondance method which is targeted by a click on the menu File/Load Correspondance.
    The correspondance file must be loaded after the net and the timetable have been loaded as it load the links between the transitions and the events.
    An instance of RegulNet and one of RPNConfig are created and are set in the StartController as rn and rpnc attributes.

  • getLogsFolder, getNetsFolder and getTimeTablesFolder : they are used to get the default folders to load a net, timetable or correspondance (in the net folder) file, to get the default folders in the preferences pane or to save them, from the Config window.

6.8. PreferencesController

  • In the initialize method the initFolders from the LoadFiles is called to get the folders defined for the location of the nets (and correspondancies), timetable and logs.
    Then the sampling and resetDate value is get from the StartController.
    The sampling value is used to set the width of the bars of the chart of the transitions distributions.
    The resetDate checkbox reset the date of the timetable to 0 at the load if it is enabled. It is composed of a Listener which makes the link with the resetDateTTLoad attibute of the StartController.+

  • logsFolderButton, netsFolderButton and timeTablesFolderButton are targeted by a click on the right of the text fields. It allows to choose the folders the user wants to be as default for the logs, nets and timetables files.

  • saveFolders : it is called with a click on the save button.
    It will write the values of the folders path in the foldersConfiguration.txt file.
    It also set the sampling attribute of the StartController as indicated in the sampling field.

6.9. ScenarioController

The input field is split by ";" to separate the different delays.
Each delay is split by ":" to have the transition or all the transitions, the start date, the end date and the value of the delay.
Then a Delay object is created with those values and is added to a delays list. At the end the delays list is send to the StartController and it is retrieved for the global move steps and multiple runs tool of the joint simulation.

7. Behavior Specification

7.1. Update the content of the tables

7.1.1. For the nets

The content of the tables (transitions and places) for the net is first the construction of a list of Dom objects (dom package) in the Sim class of the MochyCore project with the method displayFeedback.
The Dom object contains the content of a place or a transition. It has a type parameter which is "p" if it is a place or "t" if it is a transition. Each transition and place of the net is browsed, included in a Dom object and added to the list feedback.

The feedback list can be retrieved from the move function or by the call of the displayFeedback function.

In the MochyUi project, once the feedback list has been retrieved, it is treated with the displayFeedback method of the View class. It takes the feedback list and the tables as parameters. The feedback list is split depending of the type of the Dom object ("t" or "p") to construct the placesList (PlaceDom objects from the dom package of MochyCore project) and the transitionsList (TransitionDom objects from the dom package of MochyCore project).
Finally and still in the View class, the lists filled the TableView tables, the tables are refreshed to update the content in the window.
In this project the displayFeedback method of the View class is called in the displayNet method. This one is called in the loadNet method of the StartController class and at each move of the net to update the content of the net tables.

7.1.2. For the timetables

The content of the tables (events and dependencies) of the timetable is treated differently.

The displayTTFeedback method of the View class is called to update the content of the tables. It takes the TTConfig instance, the eventsTable and the dependenciesTable as parameters. The events and the dependencies of the TimeTable instance get from the TTConfig instance are browsed. They are added to eventsList or dependenciesList depending of the objects. Then the lists fill the tables and the tables are refreshed to update the content of the tables on the main window.
The displayTTFeedback method is called in the StartController in the loadTT method and at each move of the timetable.