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

互換モード追加 (小田急プラグイン・メトロ TASC) #103

Merged
merged 5 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
- [x] 独自地上子
- [x] 汎用 ATS プラグインの地上子
- [x] δ ナックニスタさんの TASC プラグインの地上子
- [ ] 小田急線向け ATS プラグインの地上子
- [x] 小田急線向け ATS プラグインの地上子
- [x] Unicorn さんの東京メトロ準拠 TASC プラグインの地上子
- [x] 計器パネルへの動作状態の表示
- [x] ブレーキノッチ
- [x] 停止位置までの残距離
Expand Down
21 changes: 21 additions & 0 deletions bve-autopilot/ato.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,27 @@ namespace autopilot
}
}

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

_信号.地上子通過(地上子, 直前位置, 状態);
_早着防止.地上子通過(地上子, 直前位置, 状態);
}
Expand Down
15 changes: 15 additions & 0 deletions bve-autopilot/tasc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ namespace autopilot {
case 255: // TASC 目標停止位置設定
停止位置を追加(static_cast<m>(地上子.Optional), 状態);
break;
case 200: // TASC 目標停止位置設定(追加:小田急PIのATO互換)
if (状態.互換モード() == 互換モード型::小田急d_ats_p ||
状態.互換モード() == 互換モード型::小田急cs_atc)
{
停止位置を追加(static_cast<m>(地上子.Optional / 10), 状態);
}
break;
case 1031: // TASC 停止位置許容誤差設定
最大許容誤差を設定(static_cast<cm>(地上子.Optional));
break;
Expand All @@ -102,6 +109,14 @@ namespace autopilot {

switch (地上子.Type)
{
case 21:
case 22:
case 23:// TASC 目標停止位置設定(追加:メトロ対応TASC互換)
if (状態.互換モード() == 互換モード型::メトロtasc) {
次駅停止位置を設定(
static_cast<m>(地上子.Optional % 1000), 直前位置, 状態);
}
break;
case 30: // TASC 目標停止位置設定
if (状態.互換モード() == 互換モード型::汎用ats) {
次駅停止位置を設定(
Expand Down
35 changes: 30 additions & 5 deletions bve-autopilot/信号順守.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,39 @@ namespace autopilot
}
break;
case 12: // ORP 起動 (メトロ総合プラグイン互換)
if (状態.互換モード() == 互換モード型::メトロ総合) {
if (cs_atc互換モードである(状態.互換モード())) {
if (_現在閉塞.信号指示 == orp::orp信号インデックス) {
_現在閉塞.orp.設定(地上子.Optional, 直前位置);
}
}
break;
case 22: // 信号現示受信(小田急PI互換)
if (状態.互換モード() == 互換モード型::小田急d_ats_p) {
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:
Option.Optional = 765420;
break;
default:
Option.Optional = 0;
break;
}
信号現示受信(Option, 直前位置, 状態, true);
}
break;
case 31: // 信号現示受信 (メトロ総合プラグイン互換)
if (状態.互換モード() == 互換モード型::メトロ総合) {
if (cs_atc互換モードである(状態.互換モード())) {
信号現示受信(地上子, 直前位置, 状態, false);
}
break;
Expand Down Expand Up @@ -508,7 +533,7 @@ namespace autopilot
}
}

if (状態.互換モード() == 互換モード型::メトロ総合) {
if (cs_atc互換モードである(状態.互換モード())) {
// ORP の出力ノッチを取り込む
ノッチ = std::min(ノッチ, _現在閉塞.orp.出力ノッチ());
ノッチ = std::accumulate(
Expand All @@ -529,7 +554,7 @@ namespace autopilot

bool 信号順守::orp照査中(const 共通状態 &状態) const noexcept
{
return 状態.互換モード() == 互換モード型::メトロ総合 &&
return cs_atc互換モードである(状態.互換モード()) &&
_現在閉塞.orp.制御中();
}

Expand Down Expand Up @@ -587,7 +612,7 @@ namespace autopilot
auto 閉塞 = 対応する閉塞(受信した閉塞始点のある範囲, _前方閉塞一覧);
閉塞->状態更新(地上子, _信号速度表, 信号インデックスを更新する);

if (状態.互換モード() == 互換モード型::メトロ総合) {
if (cs_atc互換モードである(状態.互換モード())) {
const auto &直前閉塞 =
閉塞 == _前方閉塞一覧.begin() ? _現在閉塞 : *std::prev(閉塞);
閉塞->orp状態更新(直前閉塞.信号速度);
Expand Down
14 changes: 14 additions & 0 deletions bve-autopilot/共通状態.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,22 @@ namespace autopilot {
汎用ats,
メトロ総合,
swp2,
小田急d_ats_p,
小田急cs_atc,
メトロtasc,
};

constexpr bool cs_atc互換モードである(互換モード型 互換モード) noexcept {
switch (互換モード) {
case autopilot::互換モード型::メトロ総合:
case autopilot::互換モード型::小田急cs_atc:
case autopilot::互換モード型::メトロtasc:
return true;
default:
return false;
}
}

class 共通状態
{
public:
Expand Down