Skip to content

Commit 00fe984

Browse files
authored
Merge pull request #91 from fransjacobs/78-after-a-layout-change-the-autolink-between-block-and-sensor-needs-restart-of-jcs
78 after a layout change the autolink between block and sensor needs restart of jcs
2 parents cc01f71 + 4f3401e commit 00fe984

16 files changed

+153
-44
lines changed

DRIVING.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Driving with JCS
2+
3+
- Manual
4+
- Automatically
5+
6+
## Manual
7+
8+
For Manual Driving Loc Driver Cab Dialog is avaliable. This this Dialog a Locomotive can be controlled. Functions can be switched. Multipel dialog can be show simultanously.
9+
The Locomotive Driver can be opened by double clicking on the locomotive of choice in locomotive list.
10+
11+
![LOCOMOTIVE_LIST](assets/locomotive-list.png)
12+
13+
### Driver Cab
14+
15+
![DRIVER_CAB](assets/drivercab-dialog.png)
16+
17+
### Accessory Switching
18+
19+
Click in the toolbar on the "switch" button to show Accessory Keyboard
20+
21+
![ACCESSORY_KEYBOARD](assets/accessory-keyboard.png)
22+
23+
The Accessory buttons directly switch the address as shown on the Button.
24+
25+
## Automatic Driving
26+
27+
In the Home Screen click on a Block to set a locomotive in a Block. The first step is to place a locomotive on the track, both pysical as grapical ;)
28+
29+
![LOC_ASSIGNMENT](assets/blockproperties-assignment.png)
30+
31+
For each block the wait times can be set.
32+
33+
![BLOCK_WAITING](assets/blockproperties-waittimes.png)
34+
35+
When the __Always Stop__ checkbox is checked, a locomotive will stop and wait for the specified waiting time be for starting a new cycle. The Min. Wait Time is used in case the __Random Wait__ is not selected.
36+
37+
When the __Random Wait__ checkbox is checked a random time between the min and max wait time is used when a locomtive stops in the block.
38+
39+
![LOC_IN_BLOCK](assets/loc-in-block-1.png)
40+
41+
When this pysical direction of the locomotive is different, it can be changed by either using:
42+
43+
- Reverse Arrival side
44+
- Toggle Direction
45+
46+
By Right clicking on the block these menu options are available.
47+
48+
![LOC_IN_BLOCK](assets/right-click-block-menu.png)
49+
50+
## Start Auto Pilot
51+
52+
The JCS AutoPilot is the automatic driving Algorithm within JCS.
53+
AutoPilot is enabled by clicking the __*Pilot*__ button.
54+
Every locomotive on track is assigned a Dispatcher. whic can be viewd in the Dispatcher List.
55+
56+
![LOC_IN_BLOCK](assets/autopilot-dispatcher.png)
57+
58+
A Locomotive can by started by right click via the Block Menu or Start All by clicking on the __Cruise Control__ button.
59+
60+
When Auto drive start the Status of the dispatche is shown in the Dispatche list. Also the layou screen will show what is happening by shoing reserved routes and Block States.
61+
62+
![LOC_DRIVING](assets/loc_driving.png)

JCS_SETUP.md

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
***
44

55
## Get Started driving your Trains automatically
6+
67
This guide explains how to configure JCS for a layout and automatically run trains.
78
For the purpose of this guide the following Layout is used.
89
![Test Layout](assets/testlayout.png)
910

1011
This layout consist out of 4 blocks and 2 switches.
11-
Every block has 2 sensors, in total there are 8 sensors used.
12+
Every block has 2 sensors, in total there are 8 sensors used.
1213
What is a Block? A block is a part of track where one train can be without hindering other routes. In JCS a block is always demarcated by two sensors.
1314

1415
## Drawing the Layout
@@ -24,13 +25,20 @@ Use the __+__ button to add a tile on the canvas. The Bin button will delete a t
2425
Rightclick on a tile to see properties or rotate or flip if applicable.
2526
When a tile is selected it can be dragged to the right position. Tiles are automatically saved. The example looks like this when all tiles are placed on the canvas.
2627

27-
![Start Edit](assets/layoutedit1.png?raw=true)
28+
![Start Edit](assets/layoutedit1.png)
29+
30+
## Pysical vs schematic Layout
2831

29-
## Configuring Accessories and Sensors
32+
The below picure shows the physical layout side by side with the schematic layout.
33+
![LAYOUT_OVERVIEW](assets/TestLayoutSideBySide.png?raw=true)
34+
35+
### Configuring Accessories and Sensors
3036

3137
The next step is to configure the Accessories and Sensors.
32-
Accessories Sensore and locomotive are alway linked to a Command Station.
38+
Accessories, Sensors and Locomotives are always linked to a Command Station.
39+
3340
#### Step 1 selecting the Default Command Station
41+
3442
For this guide the [DCC-EX](https://dcc-ex.com) Command Station is used. Feedback via [DCC-EX](https://dcc-ex.com) is not yet supported, see [issue 59](https://github.com/fransjacobs/model-railway/issues/59), hence the [HSI-S88](https://www.ldt-infocenter.com/dokuwiki/doku.php?id=en:hsi-88-usb) is used for Sensor feedback.
3543
Use the cog button or via Menu -> Tools Command Stations to show the Command Station Dialog.
3644

@@ -43,17 +51,20 @@ Set the [DCC-EX](https://dcc-ex.com) Command Station as __Default__ and __Enable
4351
The Test Button can be used to check whether the connection can be established.
4452

4553
##### Setup the Feedback module(s)
54+
4655
In the Command Station Dialog select the [HSI-S88](https://www.ldt-infocenter.com/dokuwiki/doku.php?id=en:hsi-88-usb) in the Command Stations dropdown menu.
4756

48-
![Setup HSI-S88](assets/command-station-HSI-S88.png)
57+
![Setup HSI-S88](assets/command-station-HSI-S88.png)
4958

50-
Do __*NOT*__ set the [HSI-S88](https://www.ldt-infocenter.com/dokuwiki/doku.php?id=en:hsi-88-usb) as *Default*, as the default Command Station is supposed to put the power on the Track. However set the [HSI-S88](https://www.ldt-infocenter.com/dokuwiki/doku.php?id=en:hsi-88-usb) __Enabled__.
59+
Do __*NOT*__ set the [HSI-S88](https://www.ldt-infocenter.com/dokuwiki/doku.php?id=en:hsi-88-usb) as *Default*, as the default Command Station is supposed to put the power on the Track.
60+
However set the [HSI-S88](https://www.ldt-infocenter.com/dokuwiki/doku.php?id=en:hsi-88-usb) __Enabled__. The [HSI-S88](https://www.ldt-infocenter.com/dokuwiki/doku.php?id=en:hsi-88-usb) is connected via the "ttyACM1" port.
5161

5262
For the Feedback Interface like the [HSI-S88](https://www.ldt-infocenter.com/dokuwiki/doku.php?id=en:hsi-88-usb) the number of connected S88 modules has to be specified. Set the Channel to which the S88 module(s) is/are connected and the number of Modules.
5363
In this case one S88 module, connected to Channel 0 is used.
5464
Click on __*Re-create Sensors*__ button to create the sensors in the system.
5565

56-
### Step 2 create Accessories
66+
### Step 2 create Accessories
67+
5768
The Test track has two turnouts which can be added using the Accessory Dialog. This Dialog can be opened via Settings (Mac) or Menu -> Tools -> Options.
5869
To Add a new Accessory click on the __+__ button. For a Turnout choose the right Turnout type in the __*Type*__ dropdown menu.
5970

@@ -62,11 +73,12 @@ To Add a new Accessory click on the __+__ button. For a Turnout choose the right
6273
To save the Accessory click the Save Button. When save the Accessory will appear in the list on the left side. This List can be filtered using the 3 radio buttons on top (All, Turnouts, Signals).
6374

6475
### Step 3 add Locomotives
76+
6577
As we are in the options Dialog let's also add the Locomotives. In this Example two locomotives used. For both locomotives an icon is already put in a subdirectory .../jcs/images.
6678

6779
![Edit Locomotive](assets/locomotive-edit.png)
6880

69-
Locomotives can only commute back and forth, hence the __Commuter__ check box is selected for both locomotives. If the __Commuter__ checkbox not selected the Locomotice can __*NOT*__ change direction in Automatic mode.
81+
Locomotives can only commute back and forth, hence the __Commuter__ check box is selected for both locomotives. If the __Commuter__ checkbox not selected the Locomotice can __*NOT*__ change direction in Automatic mode.
7082

7183
### Step 4 Link sensors to their graphical representation
7284

@@ -90,22 +102,35 @@ The Sensor Monitor will appear. When the sensor is activated (pre condition is t
90102

91103
Select the Sensor with the right name in Sensor Properties dialog. Repeat this for all sensors in the layout.
92104

93-
### Step 5 Trace the layout
105+
### Step 5 Link Accessories to the pycisl ones
106+
107+
Like the Sensor also accessories __must__ be linke to their pysical counterpart.
108+
Right click on the Accessory and select properties.
109+
110+
![LINK_ACCESSORY](assets/link_accessory.png)
111+
112+
### Step 6 Trace the layout
113+
94114
Trace the layout. This will generate all the driveways from block to block. Click on the __*Trace*__ button.
95115

96-
![Show Routes](assets/routes-dialog-empty.png)
116+
![Show Routes](assets/routes-dialog-empty.png)
97117

98118
Left of the Main JCS Window the Routes Dialog will Appear.
99119
Click in the __*Trace*__ Button in the *Routes Dialog* to generate all possible routes.
100120

101-
![Empty Routes](assets/routes-dialog-traced.png)
121+
![Empty Routes](assets/routes-dialog-traced.png)
102122

103123
When a route is selected in the list it is displayed in the main screen.
104124

105-
### Step 6 Configure the Blocks
106-
Configure the Block properties.
107-
First Restart JCS. This is due to a [known issue 78](https://github.com/fransjacobs/model-railway/issues/78).
125+
### Step 7 Configure the Blocks
126+
127+
Configure the Block properties. For every Block a name __must__ be filled in. Sensors must be linked to a block. The side of the Block with the __Bold__ line is the __+__ (plus) side of the Block. The Sensors can be automatically linked by using the __*Auto Link*__ Button.
128+
Notice: when the Sensors do not link to the block, the sensors are usually not linked to a pysical sensor.
129+
130+
![Empty Routes](assets/block-properties.png)
131+
132+
After all these settings are done a restart of JCS is strongly advised.
108133

109-
The Sensors must be linked to a block. The side of the Block with the __Bold__ line is the __+__ (plus) side of the Block. The Sensor can be automatically linked.
134+
## Driving
110135

111-
TBW
136+
[DRIVING](DRIVING.md)

README.md

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
![GitHub issues](https://img.shields.io/github/issues-raw/fransjacobs/model-railway)
1010
![GitHub Release](https://img.shields.io/github/v/release/fransjacobs/model-railway)
1111
***
12-
## About The Project
13-
JCS is a hobby project of me where I try to automate my Model Railway. The past year I have on and off worked on several aspects or modules of the software whic are needed to finally drive automatically. A short summary of the topics which are needed and used to finally be able to drive a train automatically:
14-
- Connectivety to the Command Station hardware. (DCC-EX,HSI-S88, Marklin CS2/3)
12+
## About the Project
13+
14+
JCS is a hobby project of me where I try to automate my Model Railway. Over the past years I have worked on and off on several aspects and modules of the software which are needed to drive automatically.
15+
A short summary of the topics which are needed and used to be able to drive trains automatically:
16+
17+
- Connectivity to the Command Station hardware. (DCC-EX,HSI-S88, Marklin CS2/3)
1518
- Edit and display graphically a layout
1619
- With the layout be able to route all the possible drive ways
1720
- Show the routes and driveways in the layout screen
@@ -24,6 +27,7 @@ JCS is a hobby project of me where I try to automate my Model Railway. The past
2427
I created a [short video](https://youtu.be/xP6eUdScMY0) demonstrating automatic running of locomotives. Also a [video of pysical locomotives running on the Test Layout](https://www.youtube.com/watch?v=CyLmGk6gfHA)
2528

2629
## Why?
30+
2731
There are already many "out of the box" working products. I wanted to create my own to learn and to have FUN!
2832

2933
As I am a great supporter of Open Source I have put the project on github with the purpose for others to use it, learn from it, or improve it.
@@ -32,15 +36,24 @@ So I hope you get inspired!
3236

3337
Frans
3438

39+
## Guides
40+
41+
- Setup : [JCS_SETUP](JCS_SETUP.md)
42+
- Driving : [DRIVING](DRIVING.md)
43+
3544
## Screenshots
45+
3646
So here are a few screenshots of the Project:
37-
#### Thottle / Driver Cab
47+
48+
### Thottle / Driver Cab
49+
3850
The Locomotive- and function images are displayed. Images are automatically downloaded from the Central Station.
3951
Or can be manually added.
4052

4153
![UI screenshot: JCS Throttle](assets/driver_cab.png?raw=true)
4254

43-
#### Layout overview
55+
### Layout overview
56+
4457
The (schematic) layout is displayed. Locomotive can be Placed in a Block.
4558
When the AutoPilot is switched on Locomotive will drive from block to block.
4659
![UI screenshot: JCS Main Screen](assets/mainscreen.png?raw=true)
@@ -49,44 +62,48 @@ In Editmode you can draw a layout using pre defined Tiles.
4962
also the layout can be routed. (it the very first and early step for the preparation of automatic running).
5063
![UI screenshot: JCS Edit Screen](assets/mainscreen_edit_route.png?raw=true)
5164

52-
#### Sensor Monitor
65+
### Sensor Monitor
66+
5367
To debug or easly setup your feedback sensors
5468
![UI screenshot: JCS Sensor Monitor](assets/sensor_monitor.png?raw=true)
5569

56-
#### Keyboard Panel for switching accessories and viewing feedback sensor status
70+
### Keyboard Panel for switching accessories and viewing feedback sensor status
5771

5872
![UI screenshot: JCS keyboard Screen](assets/keyboard-panel.png?raw=true)
5973

60-
#### Import Locomotives from a CS-2 or CS-3
74+
### Import Locomotives from a CS-2 or CS-3
75+
6176
![UI screenshot: JCS Preferences Locomotives](assets/prefs_locomotives.png?raw=true)
6277

6378
## Releases
64-
* [First Release V 0.0.1](https://github.com/fransjacobs/model-railway/releases/tag/V0.0.1)
79+
80+
- [First Release V 0.0.1](https://github.com/fransjacobs/model-railway/releases/tag/V0.0.1)
6581

6682
## Supported Hardware
67-
* [DCC-EX](https://dcc-ex.com) can be connected either via serial port or network
68-
* [Marklin CS-2](https://www.marklin.nl/producten/details/article/60215)
69-
* [Marklin CS-3](https://www.marklin.nl/producten/details/article/60216)
70-
* [HSI-S88](https://www.ldt-infocenter.com/dokuwiki/doku.php?id=en:hsi-88-usb) or the [DIY version](https://mobatron.4lima.de/2020/05/s88-scanner-mit-arduino) for feedback
83+
84+
- [DCC-EX](https://dcc-ex.com) can be connected either via serial port or network
85+
- [Marklin CS-2](https://www.marklin.nl/producten/details/article/60215)
86+
- [Marklin CS-3](https://www.marklin.nl/producten/details/article/60216)
87+
- [HSI-S88](https://www.ldt-infocenter.com/dokuwiki/doku.php?id=en:hsi-88-usb) or the [DIY version](https://mobatron.4lima.de/2020/05/s88-scanner-mit-arduino) for feedback
7188

7289
## Current status
90+
7391
Currently the following feature are in development:
74-
* Internationalization enable multiple languages
75-
* Add support for ESU ECOS
76-
* Show Signal aspects in automatic driving
77-
* Document
78-
79-
## TODO's (and there are still a lots of todo's...):
80-
Currently the following features are under active development:
81-
* Documentation
82-
* Enhance GUI
83-
* Add more Unit tests
84-
* ...
92+
93+
- Documentation
94+
- Internationalization enable multiple languages
95+
- Add support for ESU ECOS
96+
- Show Signal aspects in automatic driving
97+
- Enhance GUI
98+
- Add more Unit tests
99+
- ...
85100

86101
## License
102+
87103
[LICENSE](LICENSE.md)
88104

89105
## Build JCS from source
106+
90107
[BUILDING](BUILDING.md)
91108

92109
## Contributors
@@ -105,7 +122,7 @@ Currently the following features are under active development:
105122
</tr>
106123
</table>
107124

108-
** Copyright 2019 - 2024 Frans Jacobs **
125+
## Copyright 2019 - 2024 Frans Jacobs
109126

110127
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
111128
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,

assets/TestLayoutSideBySide.png

477 KB
Loading

assets/accessory-keyboard.png

36.4 KB
Loading

assets/autopilot-dispatcher.png

29.2 KB
Loading

assets/block-properties.png

15.5 KB
Loading

assets/blockproperties-assignment.png

32.2 KB
Loading

assets/blockproperties-waittimes.png

20 KB
Loading

assets/drivercab-dialog.png

47.5 KB
Loading

assets/link_accessory.png

51.8 KB
Loading

assets/loc-in-block-1.png

9.14 KB
Loading

assets/loc_driving.png

17.9 KB
Loading

assets/locomotive-list.png

13.1 KB
Loading

assets/right-click-block-menu.png

24.8 KB
Loading

src/main/java/jcs/ui/layout/dialogs/BlockDialog.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,16 @@ private void saveExitBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
366366
//Can't be null and should be the same as the block
367367
bb.setId(this.block.getId());
368368
}
369-
370-
if(bb.getStatus() == null) {
369+
370+
if (bb.getStatus() == null) {
371371
bb.setBlockState(BlockBean.BlockState.FREE);
372372
}
373-
373+
374+
if (bb.getMinWaitTime() == null) {
375+
//The wait time cannot be null, put a default there
376+
Integer minWait = Integer.getInteger("default.min.waittime", 10);
377+
bb.setMinWaitTime(minWait);
378+
}
374379

375380
PersistenceFactory.getService().persist(bb);
376381
}

0 commit comments

Comments
 (0)