From 9ce1c5a736ea725dc78805d67f991cc75e785141 Mon Sep 17 00:00:00 2001 From: maisvendoo Date: Thu, 30 Apr 2020 21:02:51 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=201.0.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/chs2t/chs2t/include/chs2t-signals.h | 6 +++ addons/chs2t/chs2t/include/chs2t.h | 2 + .../chs2t/src/chs2t-step-decode-alsn.cpp | 44 +++++++++++++++++++ addons/chs2t/chs2t/src/chs2t.cpp | 2 + addons/tep70/tep70/include/disel.h | 9 ++++ addons/tep70/tep70/src/disel.cpp | 3 +- addons/tep70/tep70/src/tep70-step-disel.cpp | 1 + setup/setup.iss | 2 +- 8 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 addons/chs2t/chs2t/src/chs2t-step-decode-alsn.cpp diff --git a/addons/chs2t/chs2t/include/chs2t-signals.h b/addons/chs2t/chs2t/include/chs2t-signals.h index f1d1072d..7ab04bea 100644 --- a/addons/chs2t/chs2t/include/chs2t-signals.h +++ b/addons/chs2t/chs2t/include/chs2t-signals.h @@ -76,6 +76,12 @@ enum VAL_PR_SKOR1 = 60, VAL_PR_SKOR2 = 61, + LS_G = 62, + LS_R = 63, + LS_W = 64, + LS_Y = 65, + LS_YR = 66, + WHEEL_1 = 194, WHEEL_2 = 195, WHEEL_3 = 196, diff --git a/addons/chs2t/chs2t/include/chs2t.h b/addons/chs2t/chs2t/include/chs2t.h index d75a4d8d..dc0233cb 100644 --- a/addons/chs2t/chs2t/include/chs2t.h +++ b/addons/chs2t/chs2t/include/chs2t.h @@ -334,6 +334,8 @@ class CHS2T : public Vehicle void stepSwitcherPanel(); + void stepDecodeAlsn(); + /// Шаг моделирования всех систем локомотива в целом void step(double t, double dt); diff --git a/addons/chs2t/chs2t/src/chs2t-step-decode-alsn.cpp b/addons/chs2t/chs2t/src/chs2t-step-decode-alsn.cpp new file mode 100644 index 00000000..f2a04b2f --- /dev/null +++ b/addons/chs2t/chs2t/src/chs2t-step-decode-alsn.cpp @@ -0,0 +1,44 @@ +#include "chs2t.h" +#include "chs2t-signals.h" + +void CHS2T::stepDecodeAlsn() +{ + analogSignal[LS_W] = 0.0f; + analogSignal[LS_YR] = 0.0f; + analogSignal[LS_R] = 0.0f; + analogSignal[LS_Y] = 0.0f; + analogSignal[LS_G] = 0.0f; + + switch (alsn_info.code_alsn) + { + case ALSN_WHITE: + + analogSignal[LS_W] = 1.0f; + + break; + + case ALSN_RED: + + analogSignal[LS_R] = 1.0f; + + break; + + case ALSN_RED_YELLOW: + + analogSignal[LS_YR] = 1.0f; + + break; + + case ALSN_YELLOW: + + analogSignal[LS_Y] = 1.0f; + + break; + + case ALSN_GREEN: + + analogSignal[LS_G] = 1.0f; + + break; + } +} diff --git a/addons/chs2t/chs2t/src/chs2t.cpp b/addons/chs2t/chs2t/src/chs2t.cpp index 8770f81e..93c75948 100644 --- a/addons/chs2t/chs2t/src/chs2t.cpp +++ b/addons/chs2t/chs2t/src/chs2t.cpp @@ -139,6 +139,8 @@ void CHS2T::step(double t, double dt) stepSwitcherPanel(); + stepDecodeAlsn(); + registrate(t, dt); //Journal::instance()->info("Step horn"); diff --git a/addons/tep70/tep70/include/disel.h b/addons/tep70/tep70/include/disel.h index 9cc39f47..736f0421 100644 --- a/addons/tep70/tep70/include/disel.h +++ b/addons/tep70/tep70/include/disel.h @@ -44,6 +44,12 @@ class Disel : public Device this->n_ref = n_ref; } + /// Задать уровень топлива бака + void setFuelLevel(double fuel_level) + { + this->fuel_level = fuel_level; + } + /// Вернуть давление в системе смазки double getOilPressure() const { return getY(0); } @@ -141,6 +147,9 @@ class Disel : public Device /// Имя текущего проигрываемого звука QString soundName; + /// Уровень топлива в баке + double fuel_level; + enum { MIN_POS = 0, diff --git a/addons/tep70/tep70/src/disel.cpp b/addons/tep70/tep70/src/disel.cpp index 58a9ee9a..5f52e8a0 100644 --- a/addons/tep70/tep70/src/disel.cpp +++ b/addons/tep70/tep70/src/disel.cpp @@ -27,6 +27,7 @@ Disel::Disel(QObject *parent) : Device(parent) , delta_omega(0.0) , pos_count(0) , soundName("pos0") + , fuel_level(0.0) { std::fill(K.begin(), K.end(), 0.0); @@ -90,7 +91,7 @@ void Disel::preStep(state_vector_t &Y, double t) } else { - is_fuel_ignition = state_mv6; + is_fuel_ignition = state_mv6 && (fuel_level >= 0.01); } delta_omega = n_ref * Physics::PI / 30.0 - Y[1]; diff --git a/addons/tep70/tep70/src/tep70-step-disel.cpp b/addons/tep70/tep70/src/tep70-step-disel.cpp index 84d126d4..e62702e3 100644 --- a/addons/tep70/tep70/src/tep70-step-disel.cpp +++ b/addons/tep70/tep70/src/tep70-step-disel.cpp @@ -13,6 +13,7 @@ void TEP70::stepDisel(double t, double dt) disel->setMV6state(mv6->getContactState(0)); disel->setVTNstate(vtn->getContactState(0)); disel->setRefFreq(km->getRefFreq()); + disel->setFuelLevel(fuel_tank->getFuelLevel()); disel->step(t, dt); double I_gen = Icc + motor_compressor->getCurrent(); diff --git a/setup/setup.iss b/setup/setup.iss index bd7dc88a..39cf7408 100644 --- a/setup/setup.iss +++ b/setup/setup.iss @@ -1,5 +1,5 @@ #define Name "RRS" -#define Version "1.0.5" +#define Version "1.0.6" #define arch "x86_64" #define Publisher "maisvendoo"