Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

小田急PI互換機能追加 #101

Merged
merged 3 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions bve-autopilot/ato.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,29 @@ namespace autopilot
}
}

if (状態.互換モード() == 互換モード型::小田急PI) {
switch (地上子.Type) {
case 4: //制限速度設定
if(地上子.Optional % 100 == 0)//制限解除
制限区間終了(_制限速度6, { 直前位置, 状態.現在位置() });
else //制限開始
{
int 制限速度 = (地上子.Optional % 100) * 5;
int 距離 = 300; //300m固定
int 送信電文 = 距離 * 1000 + 制限速度;
制限区間追加(
_制限速度6, 送信電文, { 直前位置, 状態.現在位置() },
4.0_kmph);
}
break;
case 5: //制限速度設定
制限区間追加(
_制限速度9, 地上子.Optional, { 直前位置, 状態.現在位置() },
5.0_kmph);
Comment on lines +172 to +180
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この 4.0_kmph5.0_kmph は何か意図がありましたか?
(自分の印象だと小田急は割と制限ギリギリまで出す運転士が多いイメージがありますが)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D-ATS-Pの速度照査は、JR系のATSと異なり、制限速度ぴったりで行われます(あくまでプラグイン上の話です)。そのため、いくらかはマージンを入れておく必要があると思い、設定しましたが、おっしゃる通りこれでは緩く、ダイヤについていけないので、マージンはもう少し小さくてもよいかもしれません。ただ、多かれ少なかれ設定する必要はあると思います。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

もともと全ての速度制御に 0.5 km/h のマージンを入れているので、ここでさらにマージンを足すとしても 0.5~1 km/h 程度で良さそうな気がしますね。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

手元で小田急PIとbve-autopilot両方積んだ車両でちょっと実験しましたがここはマージン 0 でもいけそうな感触です

break;
}
}

_信号.地上子通過(地上子, 直前位置, 状態);
_早着防止.地上子通過(地上子, 直前位置, 状態);
}
Expand Down
13 changes: 13 additions & 0 deletions bve-autopilot/tasc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ namespace autopilot {
case 255: // TASC 目標停止位置設定
停止位置を追加(static_cast<m>(地上子.Optional), 状態);
break;
case 200: // TASC 目標停止位置設定(追加:小田急PIのATO互換)
if (状態.互換モード() == 互換モード型::メトロ総合 || 状態.互換モード() == 互換モード型::小田急PI) {
Comment on lines +87 to +88
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一見、やっていることが互換モードの名前と合ってないような気がして「ん?」と思いましたが、以下のような使い分けを意図しているという理解で良いでしょうか。

  • 互換モード型::メトロ総合 → CS-ATC の路線で使う
  • 互換モード型::小田急PI → D-ATS-P の路線で使う

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

その通りになります。元々、D-ATS-Pの地上子というよりは小田急PI全般の地上子なので、「小田急PIのCS-ATC路線」を見越した仕様ということになります。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ですよね。

後で enum の名前を変えさせてもらうかもしれません。
何となく、 互換モード型::小田急PI よりも 互換モード型::d_ats_p とかの方が紛らわしくなさそうな気がしています。
OM-ATS の場合はどうするのかみたいな論点もあり。
(と言ってもまだ深く検討していません)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

他も「メトロ総合」や「swp2」のような書き方だったので、それに揃えてこのようにしたのですが、こだわりがあるわけではないです。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本当に 状態.互換モード() == 互換モード型::メトロ総合 に対して200番地上子をサポートしてよいのか? 小田急プラグイン以外のプラグインと干渉する可能性があるのでは? (現に22番地上子は小田急プラグインとメトロTASCプラグインとで被っている)

となると、やはり 互換モード型::メトロ総合 とは別に「メトロ総合プラグインと小田急プラグインを同時利用するためのモード」を設けるべき?

停止位置を追加(static_cast<m>(地上子.Optional / 10), 状態);
}
break;
case 1031: // TASC 停止位置許容誤差設定
最大許容誤差を設定(static_cast<cm>(地上子.Optional));
break;
Expand All @@ -102,6 +107,14 @@ namespace autopilot {

switch (地上子.Type)
{
case 21:
//case 22:(小田急PIのATSと干渉するため暫定コメントアウト)
case 23:// TASC 目標停止位置設定(追加:メトロ対応TASC互換)
if (状態.互換モード() == 互換モード型::メトロ総合) {
Comment on lines +110 to +113
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

21~23番地上子での停止位置設定ってどのプラグインで使われている仕様ですか?
自分が知らない仕様なので、教えていただけないでしょうか。
可能ならドキュメントとかへのリンクをいただけると助かります。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらは10年前に公開されていたメトロATO/TASCプラグインで使われていた仕様になります。
新規設定は非推奨ですが、すでにこの地上子が置かれている路線もあるので、メトロ総合互換で使える仕様としています。(なお、当方のSのプラグインでは、既に対応済みです)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます! 参考になります。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いただいた資料を見たところ、以下の記述が気になっています。

*3 TASC第1パターン発生地上子(21)のオプション
送信値の一万の位でTASC急行運転の設定を行います。
これは、副都心線などの急行運転で通過駅のTASC地上子をスルーするための機能です。
列車種別表示器に「2:急行」または「5:通勤準急」を設定した場合、
プラグインでは自列車を速達列車として処理します。
急行列車の通過駅のTASC第1パターン発生地上子の送信値に+20000することで、
この機能を使用できます。

こちらのプラグインでは列車種別の切り替えを車両プラグイン側で行う想定のようです。
一方、bve-autopilot は列車種別ごとにマップ内の地上子設置方法を変えてもらう想定の仕様になっているので、急行運転時には通過駅の停止位置地上子を認識させないようにする必要があります。
この食い違いを容易に解決する方法が思い浮かばず、どうしようかと考えています。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いろいろ考えましたが、以下のようにしたいと思います。

  • 互換モードに以下の3種類を新たに追加する
    • 小田急プラグインに対応した CS-ATC 路線用のモード
    • 小田急プラグインに対応した D-ATS-P 路線用のモード
    • メトロ TASC プラグインに対応した CS-ATC 路線用のモード
  • 現行のメトロ総合プラグイン互換モードに新たな次停車駅位置設定地上子は追加しない
  • メトロ TASC プラグインの通過駅用設定には (少なくとも今は) 対応しない

判断の理由としては

  • 一つのメトロ総合プラグイン互換モードで微妙に異なる複数のプラグインに対応しようとすると今回の22番地上子のようにコンフリクトが起きることがあります。将来的にさらに別のプラグインが登場してコンフリクトが増える可能性もあるので、プラグインごとに別々のモードに分けた方が良いと思いました。
  • メトロ TASC プラグインの通過駅用設定に対応するには21番地上子で行った通過駅判定を22番と23番の地上子にも適用する必要があり、そのためのコーディングが必要になりそうです。とはいえ、そもそも21番地上子での通過駅設定を実際に使っている路線データが現存するのか私は良く知らないのですが……。もし bve-autopilot でこれに対応するとしても、その時にコードを後から足せばよいので、今は気にしないことにします。

私の方でコードを整理してからマージしようと思うのでもうしばらくお待ちください。

次駅停止位置を設定(
static_cast<m>(地上子.Optional % 1000), 直前位置, 状態);
}
break;
case 30: // TASC 目標停止位置設定
if (状態.互換モード() == 互換モード型::汎用ats) {
次駅停止位置を設定(
Expand Down
23 changes: 23 additions & 0 deletions bve-autopilot/信号順守.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,29 @@ namespace autopilot
}
}
break;
case 22: // 信号現示受信(小田急PI互換)
if (状態.互換モード() == 互換モード型::小田急PI) {
ATS_BEACONDATA Option;
Option = 地上子; //代入する
switch (地上子.Optional)
{
case 4:
Option.Optional = 7654320;
break;
case 5:
Option.Optional = 76543210;
break;
case -4:
Option.Optional = 7654210;
break;
case 3:
default:
Option.Optional = 765420;
break;
}
信号現示受信(Option, 直前位置, 状態, true);
}
break;
case 31: // 信号現示受信 (メトロ総合プラグイン互換)
if (状態.互換モード() == 互換モード型::メトロ総合) {
信号現示受信(地上子, 直前位置, 状態, false);
Expand Down
1 change: 1 addition & 0 deletions bve-autopilot/共通状態.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace autopilot {
汎用ats,
メトロ総合,
swp2,
小田急PI,
};

class 共通状態
Expand Down