Skip to content

Commit

Permalink
Версия 1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
maisvendoo committed Mar 14, 2020
2 parents 027af98 + 48d3b9f commit 2a0a889
Show file tree
Hide file tree
Showing 23 changed files with 347 additions and 95 deletions.
3 changes: 3 additions & 0 deletions addons/vl60/vl60-equipment/include/ekg-8g.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class EKG_8G : public Device

bool is_auto;

/// Имя звука ЭКГ-8Ж
QString sound_name;

/// Таймер управления переключением позиций
Timer pos_switcher;

Expand Down
10 changes: 9 additions & 1 deletion addons/vl60/vl60-equipment/src/ekg-8g.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ EKG_8G::EKG_8G(QObject *parent) : Device(parent)
, is_fix_off(false)
, dir(0)
, is_auto(false)
, sound_name("")
{
connect(&pos_switcher, &Timer::process, this, &EKG_8G::slotPosSwitch);

Expand Down Expand Up @@ -99,48 +100,55 @@ void EKG_8G::process()
// Нулевая позиция
if (km_state.pos_state[POS_ZERO] && (position != 0) && !is_auto)
{
sound_name = "EKG_serv_auto";
pos_switcher.start();
dir = -1;
}

// Фиксация пуска
if (km_state.pos_state[POS_FP])
{
sound_name = "";
is_fix_start = true;
dir = 1;
}

// Ручной пуск
if (km_state.pos_state[POS_RP] && is_fix_start)
{
sound_name = "EKG_serv_rp";
is_fix_start = false;
pos_switcher.start();
}

// Фиксация выключения
if (km_state.pos_state[POS_FV])
{
sound_name = "";
is_fix_off = true;
dir = -1;
}

// Ручное выключение
if (km_state.pos_state[POS_RV] && is_fix_off)
{
sound_name = "EKG_serv_rp";
is_fix_off = false;
pos_switcher.start();
}

// Автоматический пуск
if (km_state.pos_state[POS_AP] && !is_auto)
{
sound_name = "EKG_serv_auto";
pos_switcher.start();
dir = 1;
}

// Автоматический пуск
if (km_state.pos_state[POS_AV] && !is_auto)
{
sound_name = "EKG_serv_auto";
pos_switcher.start();
dir = -1;
}
Expand Down Expand Up @@ -222,7 +230,7 @@ void EKG_8G::slotPosSwitch()
position = cut(position, 0, static_cast<int>(NUM_POSITIONS - 1));

if ( (position != 0) && (position != NUM_POSITIONS - 1) )
emit soundPlay("EKG_serv");
emit soundPlay(sound_name);

// Останавливаемся, если не находимся на переходных позициях
if ( ( (position < PP_MIN) || (position > PP_MAX) ) && !is_auto )
Expand Down
2 changes: 1 addition & 1 deletion addons/vl60/vl60k/include/vl60.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class VL60k : public Vehicle
};

/// Список звуков перестука
QMap <int, QString>tap_sounds;
QList<QString> tap_sounds;

float pant1_pos;
float pant2_pos;
Expand Down
27 changes: 15 additions & 12 deletions addons/vl60/vl60k/src/vl60-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ void VL60k::initBrakeControls(QString modules_dir)

loco_crane = loadLocoCrane(modules_dir + QDir::separator() + "kvt254");
loco_crane->read_config("kvt254");
connect(loco_crane, &LocoCrane::soundPlay, this, &VL60k::soundPlay);
connect(loco_crane, &LocoCrane::soundStop, this, &VL60k::soundStop);
connect(loco_crane, &LocoCrane::soundSetVolume, this, &VL60k::soundSetVolume);
}

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -214,18 +217,18 @@ void VL60k::initTriggers()
void VL60k::initTapSounds() {
QString f_p = "tap_";

tap_sounds.insert(5, f_p + "5-10");
tap_sounds.insert(10, f_p + "10-20");
tap_sounds.insert(20, f_p + "20-30");
tap_sounds.insert(30, f_p + "30-40");
tap_sounds.insert(40, f_p + "40-50");
tap_sounds.insert(50, f_p + "50-60");
tap_sounds.insert(60, f_p + "60-70");
tap_sounds.insert(70, f_p + "70-80");
tap_sounds.insert(80, f_p + "80-90");
tap_sounds.insert(90, f_p + "90-100");
tap_sounds.insert(100, f_p + "100-110");
tap_sounds.insert(110, f_p + "110-~");
tap_sounds << (f_p + "5-10");
tap_sounds << (f_p + "10-20");
tap_sounds << (f_p + "20-30");
tap_sounds << (f_p + "30-40");
tap_sounds << (f_p + "40-50");
tap_sounds << (f_p + "50-60");
tap_sounds << (f_p + "60-70");
tap_sounds << (f_p + "70-80");
tap_sounds << (f_p + "80-90");
tap_sounds << (f_p + "90-100");
tap_sounds << (f_p + "100-110");
tap_sounds << (f_p + "110-~");
}

//------------------------------------------------------------------------------
Expand Down
32 changes: 2 additions & 30 deletions addons/vl60/vl60k/src/vl60-step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,9 @@ void VL60k::stepTapSound()
{
double speed = abs(this->velocity) * 3.6;

QMap<int, QString>::const_iterator i = tap_sounds.constBegin();

QString soundPlay = "";

while (i != tap_sounds.constEnd())
{
if (speed >= i.key())
{
soundPlay = i.value();
}
if (speed < i.key())
{
break;
}
++i;
}

i = tap_sounds.constBegin();

int volume;

while (i != tap_sounds.constEnd())
for (int i = 0; i < tap_sounds.count(); ++i)
{
if (soundPlay == i.value())
{
volume = 100;
} else {
volume = 0;
}
emit soundSetVolume(i.value(), volume);
++i;
emit volumeCurveStep(tap_sounds[i], static_cast<float>(speed));
}
}

Expand Down
2 changes: 1 addition & 1 deletion addons/vl60/vl60pk/include/vl60.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class VL60pk : public Vehicle
};

/// Список звуков перестука
QMap <int, QString>tap_sounds;
QList<QString> tap_sounds;

double U_bat;

Expand Down
3 changes: 0 additions & 3 deletions addons/vl60/vl60pk/src/vl60-debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
//------------------------------------------------------------------------------
void VL60pk::debugPrint(double t)
{

DebugMsg = QString("t: %1 x: %2 км v: %3 км/ч АЛСН: %4 Дист.: %5")
.arg(t, 10, 'f', 2)
.arg((railway_coord + dir * length / 2.0) / 1000.0, 8, 'f', 3)
.arg(velocity * Physics::kmh, 6, 'f', 1)

.arg(alsn_info.code_alsn, 2)
.arg(alsn_info.signal_dist, 7, 'f', 1);


//DebugMsg = brake_crane->getDebugMsg();
}
25 changes: 13 additions & 12 deletions addons/vl60/vl60pk/src/vl60-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ void VL60pk::initBrakeControls(QString modules_dir)
loco_crane = loadLocoCrane(modules_dir + QDir::separator() + "kvt254");
loco_crane->read_config("kvt254");
connect(loco_crane, &LocoCrane::soundPlay, this, &VL60pk::soundPlay);
connect(loco_crane, &LocoCrane::soundStop, this, &VL60pk::soundStop);
connect(loco_crane, &LocoCrane::soundSetVolume, this, &VL60pk::soundSetVolume);
}

Expand Down Expand Up @@ -212,18 +213,18 @@ void VL60pk::initTriggers()
void VL60pk::initTapSounds() {
QString f_p = "tap_";

tap_sounds.insert(5, f_p + "5-10");
tap_sounds.insert(10, f_p + "10-20");
tap_sounds.insert(20, f_p + "20-30");
tap_sounds.insert(30, f_p + "30-40");
tap_sounds.insert(40, f_p + "40-50");
tap_sounds.insert(50, f_p + "50-60");
tap_sounds.insert(60, f_p + "60-70");
tap_sounds.insert(70, f_p + "70-80");
tap_sounds.insert(80, f_p + "80-90");
tap_sounds.insert(90, f_p + "90-100");
tap_sounds.insert(100, f_p + "100-110");
tap_sounds.insert(110, f_p + "110-~");
tap_sounds << (f_p + "5-10");
tap_sounds << (f_p + "10-20");
tap_sounds << (f_p + "20-30");
tap_sounds << (f_p + "30-40");
tap_sounds << (f_p + "40-50");
tap_sounds << (f_p + "50-60");
tap_sounds << (f_p + "60-70");
tap_sounds << (f_p + "70-80");
tap_sounds << (f_p + "80-90");
tap_sounds << (f_p + "90-100");
tap_sounds << (f_p + "100-110");
tap_sounds << (f_p + "110-~");
}

//------------------------------------------------------------------------------
Expand Down
32 changes: 2 additions & 30 deletions addons/vl60/vl60pk/src/vl60-step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,9 @@ void VL60pk::stepTapSound()
{
double speed = abs(this->velocity) * 3.6;

QMap<int, QString>::const_iterator i = tap_sounds.constBegin();

QString soundPlay = "";

while (i != tap_sounds.constEnd())
{
if (speed >= i.key())
{
soundPlay = i.value();
}
if (speed < i.key())
{
break;
}
++i;
}

i = tap_sounds.constBegin();

int volume;

while (i != tap_sounds.constEnd())
for (int i = 0; i < tap_sounds.count(); ++i)
{
if (soundPlay == i.value())
{
volume = 100;
} else {
volume = 0;
}
emit soundSetVolume(i.value(), volume);
++i;
emit volumeCurveStep(tap_sounds[i], static_cast<float>(speed));
}
}

Expand Down
77 changes: 77 additions & 0 deletions cfg/trains/vl60pk-1543-T33_15.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Config>
<Common>
<CouplingModule>ef-coupling</CouplingModule>
<CabineInVehicle>0</CabineInVehicle>

<!-- Зарядное давление, МПа -->
<ChargingPressure>0.5</ChargingPressure>
<!-- Начальное давление в ГР, МПа -->
<InitMainResPressure>0.9</InitMainResPressure>
<!-- Поезд без воздуха (1 - без воздуха, 0 - полностью заряженный) -->
<NoAir>0</NoAir>

<Title>ВЛ60пк-1543_Поезд 33</Title>
<Description>Состав из 15 вагонов и вагона-ресторана</Description>
</Common>
<Vehicle>
<Module>vl60pk</Module>
<ModuleConfig>vl60pk-1543</ModuleConfig>
<Count>1</Count>
<PayloadCoeff>1</PayloadCoeff>
</Vehicle>
<Vehicle>
<Module>passcar</Module>
<ModuleConfig>IMR_pass_rzd-25924</ModuleConfig>
<Count>3</Count>
<PayloadCoeff>1</PayloadCoeff>
</Vehicle>
<Vehicle>
<Module>passcar</Module>
<ModuleConfig>IMR_pass_rzd-13819</ModuleConfig>
<Count>1</Count>
<PayloadCoeff>1</PayloadCoeff>
</Vehicle>
<Vehicle>
<Module>passcar</Module>
<ModuleConfig>IMR_pass_rzd-11100</ModuleConfig>
<Count>2</Count>
<PayloadCoeff>1</PayloadCoeff>
</Vehicle>
<Vehicle>
<Module>passcar</Module>
<ModuleConfig>IMR_pass_rzd-13819</ModuleConfig>
<Count>1</Count>
<PayloadCoeff>1</PayloadCoeff>
</Vehicle>
<Vehicle>
<Module>passcar</Module>
<ModuleConfig>IMR_pass_rzd-65361</ModuleConfig>
<Count>1</Count>
<PayloadCoeff>1</PayloadCoeff>
</Vehicle>
<Vehicle>
<Module>passcar</Module>
<ModuleConfig>IMR_pass_rzd-16733</ModuleConfig>
<Count>1</Count>
<PayloadCoeff>1</PayloadCoeff>
</Vehicle>
<Vehicle>
<Module>passcar</Module>
<ModuleConfig>IMR_pass_rzd-13819</ModuleConfig>
<Count>1</Count>
<PayloadCoeff>1</PayloadCoeff>
</Vehicle>
<Vehicle>
<Module>passcar</Module>
<ModuleConfig>IMR_pass_rzd-11100</ModuleConfig>
<Count>2</Count>
<PayloadCoeff>1</PayloadCoeff>
</Vehicle>
<Vehicle>
<Module>passcar</Module>
<ModuleConfig>IMR_pass_rzd-25924</ModuleConfig>
<Count>2</Count>
<PayloadCoeff>1</PayloadCoeff>
</Vehicle>
</Config>
Loading

0 comments on commit 2a0a889

Please sign in to comment.