16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 13:59:19 +02:00

More python dictionary entries for compressors

This commit is contained in:
Królik Uszasty
2020-11-07 21:03:37 +01:00
committed by tmj-fstate
parent 20b8c10e3a
commit 52dcd5bf5f
2 changed files with 29 additions and 2 deletions

View File

@@ -452,8 +452,11 @@ TTrain::TTrain() {
bConv[ i ] = false; bConv[ i ] = false;
bComp[ i ][ 0 ] = false; bComp[ i ][ 0 ] = false;
bComp[ i ][ 1 ] = false; bComp[ i ][ 1 ] = false;
//bComp[ i ][ 2 ] = false;
//bComp[ i ][ 3 ] = false;
bHeat[ i ] = false; bHeat[ i ] = false;
} }
bCompressors.clear();
for( int i = 0; i < 9; ++i ) for( int i = 0; i < 9; ++i )
for (int j = 0; j < 10; ++j) for (int j = 0; j < 10; ++j)
{ {
@@ -598,6 +601,7 @@ dictionary_source *TTrain::GetTrainState() {
bPN = ( static_cast<TLSt*>( temp_ham )->GetEDBCP() > 0.2 ); bPN = ( static_cast<TLSt*>( temp_ham )->GetEDBCP() > 0.2 );
} }
dict->insert( "indir_brake", bPN ); dict->insert( "indir_brake", bPN );
dict->insert( "emergency_brake", mvOccupied->AlarmChainFlag );
dict->insert( "brake_delay_flag", mvOccupied->BrakeDelayFlag ); dict->insert( "brake_delay_flag", mvOccupied->BrakeDelayFlag );
dict->insert( "brake_op_mode_flag", mvOccupied->BrakeOpModeFlag ); dict->insert( "brake_op_mode_flag", mvOccupied->BrakeOpModeFlag );
// other controls // other controls
@@ -609,6 +613,7 @@ dictionary_source *TTrain::GetTrainState() {
dict->insert( "radio_channel", RadioChannel() ); dict->insert( "radio_channel", RadioChannel() );
dict->insert( "radio_volume", Global.RadioVolume ); dict->insert( "radio_volume", Global.RadioVolume );
dict->insert( "door_lock", mvOccupied->Doors.lock_enabled ); dict->insert( "door_lock", mvOccupied->Doors.lock_enabled );
dict->insert( "door_step", mvOccupied->Doors.step_enabled );
// movement data // movement data
dict->insert( "velocity", std::abs( mvOccupied->Vel ) ); dict->insert( "velocity", std::abs( mvOccupied->Vel ) );
dict->insert( "tractionforce", std::abs( mvOccupied->Ft ) ); dict->insert( "tractionforce", std::abs( mvOccupied->Ft ) );
@@ -644,9 +649,20 @@ dictionary_source *TTrain::GetTrainState() {
dict->insert( ( "eimp_c" + std::to_string( i + 1 ) + "_conv" ), bConv[ i ] ); dict->insert( ( "eimp_c" + std::to_string( i + 1 ) + "_conv" ), bConv[ i ] );
dict->insert( ( "eimp_u" + std::to_string( i + 1 ) + "_comp_a" ), bComp[ i ][ 0 ] ); dict->insert( ( "eimp_u" + std::to_string( i + 1 ) + "_comp_a" ), bComp[ i ][ 0 ] );
dict->insert( ( "eimp_u" + std::to_string( i + 1 ) + "_comp_w" ), bComp[ i ][ 1 ] ); dict->insert( ( "eimp_u" + std::to_string( i + 1 ) + "_comp_w" ), bComp[ i ][ 1 ] );
//dict->insert( ( "eimp_c" + std::to_string( i + 1 ) + "_comp_a" ), bComp[ i ][ 2 ]);
//dict->insert( ( "eimp_c" + std::to_string( i + 1 ) + "_comp_w" ), bComp[ i ][ 3 ]);
dict->insert( ( "eimp_c" + std::to_string( i + 1 ) + "_heat" ), bHeat[ i ] ); dict->insert( ( "eimp_c" + std::to_string( i + 1 ) + "_heat" ), bHeat[ i ] );
} }
dict->insert( "compressors_no", (int)bCompressors.size() );
for (int i = 0; i < bCompressors.size(); i++)
{
dict->insert("compressors_" + std::to_string(i + 1) + "_allow", std::get<0>(bCompressors[i]));
dict->insert("compressors_" + std::to_string(i + 1) + "_work", std::get<1>(bCompressors[i]));
dict->insert("compressors_" + std::to_string(i + 1) + "_car_no", std::get<2>(bCompressors[i]));
}
bool kier = (DynamicObject->DirectionGet() * mvOccupied->CabOccupied > 0); bool kier = (DynamicObject->DirectionGet() * mvOccupied->CabOccupied > 0);
TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->CabOccupied < 0 ? end::rear : end::front, 4); TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->CabOccupied < 0 ? end::rear : end::front, 4);
int in = 0; int in = 0;
@@ -655,6 +671,7 @@ dictionary_source *TTrain::GetTrainState() {
if (p->MoverParameters->eimc[eimc_p_Pmax] > 1) if (p->MoverParameters->eimc[eimc_p_Pmax] > 1)
{ {
in++; in++;
dict->insert(("eimp_c" + std::to_string(in) + "_invno"), p->MoverParameters->InvertersNo);
for (int j = 0; j < p->MoverParameters->InvertersNo; j++) { for (int j = 0; j < p->MoverParameters->InvertersNo; j++) {
dict->insert(("eimp_c" + std::to_string(in) + "_inv" + std::to_string(j + 1) + "_act"), p->MoverParameters->Inverters[j].IsActive); dict->insert(("eimp_c" + std::to_string(in) + "_inv" + std::to_string(j + 1) + "_act"), p->MoverParameters->Inverters[j].IsActive);
dict->insert(("eimp_c" + std::to_string(in) + "_inv" + std::to_string(j + 1) + "_error"), p->MoverParameters->Inverters[j].Error); dict->insert(("eimp_c" + std::to_string(in) + "_inv" + std::to_string(j + 1) + "_error"), p->MoverParameters->Inverters[j].Error);
@@ -6176,8 +6193,11 @@ bool TTrain::Update( double const Deltatime )
bConv[i] = false; bConv[i] = false;
bComp[i][0] = false; bComp[i][0] = false;
bComp[i][1] = false; bComp[i][1] = false;
//bComp[i][2] = false;
//bComp[i][3] = false;
bHeat[i] = false; bHeat[i] = false;
} }
bCompressors.clear();
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
{ {
if (p) if (p)
@@ -6206,6 +6226,10 @@ bool TTrain::Update( double const Deltatime )
if (p->MoverParameters->CompressorSpeed > 0.00001) if (p->MoverParameters->CompressorSpeed > 0.00001)
{ {
bComp[iUnitNo - 1][1] = (bComp[iUnitNo - 1][1] || p->MoverParameters->CompressorFlag); bComp[iUnitNo - 1][1] = (bComp[iUnitNo - 1][1] || p->MoverParameters->CompressorFlag);
bCompressors.emplace_back(
p->MoverParameters->CompressorAllow || (p->MoverParameters->CompressorStart == start_t::automatic),
p->MoverParameters->CompressorFlag,
i);
} }
if ((in < 8) && (p->MoverParameters->eimc[eimc_p_Pmax] > 1)) if ((in < 8) && (p->MoverParameters->eimc[eimc_p_Pmax] > 1))
{ {
@@ -6227,6 +6251,8 @@ bool TTrain::Update( double const Deltatime )
bBatt[in] = p->MoverParameters->Battery; bBatt[in] = p->MoverParameters->Battery;
bConv[in] = p->MoverParameters->ConverterFlag; bConv[in] = p->MoverParameters->ConverterFlag;
bHeat[in] = p->MoverParameters->Heating; bHeat[in] = p->MoverParameters->Heating;
//bComp[in][2] = (p->MoverParameters->CompressorAllow || (p->MoverParameters->CompressorStart == start_t::automatic));
//bComp[in][3] = (p->MoverParameters->CompressorFlag);
in++; in++;
iPowerNo = in; iPowerNo = in;
} }

View File

@@ -784,6 +784,7 @@ private:
bool bBatt[8]; // baterie bool bBatt[8]; // baterie
bool bConv[8]; // przetwornice bool bConv[8]; // przetwornice
bool bComp[8][2]; // sprezarki bool bComp[8][2]; // sprezarki
std::vector<std::tuple<bool, bool, int>> bCompressors;
bool bHeat[8]; // grzanie bool bHeat[8]; // grzanie
// McZapkie: do syczenia // McZapkie: do syczenia
float fPPress, fNPress; float fPPress, fNPress;