Development of the Soyuz TMA spacecraft simulator

Hello! We are the team of the Soyuz TMA simulator, a program that simulates the orbital flight of the Soyuz spacecraft and the International Space Station, rendezvous and docking of the spacecraft with the ISS, as well as undocking and descent. All this is simulated both in the automatic (i.e., under the control of the onboard equipment of the Motion Control System) and in the manual flight modes, which are identical in their algorithmic and logical composition to those used on board the Soyuz TMA spacecraft.





We have developed a software called "Modeling and Control" in the C ++ Builder 6 environment. Why exactly in it, and not in VS - this is our first project and before none of us had experience in programming, and even more so in simulator construction, so for "Pen tests" the most simple environment was chosen, but at the same time the code is developed so that it can be quickly integrated into another environment (Qt, VS).





First of all, we decided to develop the main window forms for debugging the operation of software algorithms - an event logging log, as well as formats that simulate onboard equipment with which the cosmonaut interacts during the flight program.





- " ". , , . , . , , , , . .





:





  1. :





    • (Jxx, Jyy, Jzz, Jxy, Jyz, Jzx) - . , .





    • ( ).





    • .





  2. :





    • .





    • J2000.





  3. :





    • ( ).





    • (, , ).





    • (Wx, Wy, Wz).





  4. :





    • ( ).





    • .





    • .





    • .





    • .









:





Format "NU Input" - Complex
" " -













, -, , , , .





- , . , TSaveDialog TOpenDialog. ini (TIniFile), . .





( , ) .









Receipt for loading initial conditions from a file

, .





//    
struct{
////     ////
TDateTime nu_day;                   // 2    /
////    ////
double vec_j2000_mks[3];                // 8      ..   J2000 (X, Y, Z)
double vel_j2000_mks[3];                // 11       ..         J2000 (X, Y, Z)
double Q_mks[4];                        // 14                                                  0  1  2
double w_j2000_mks[3];                  // 18        J2000      (Wx Wy Wz)
double vec_mks_PC[3];                   // 21      ..             (X, Y, Z)
double m_mk;                            // 24   
double mi_mks[3][3];                    // 25       (Jxx, Jxy, Jxz...)
////   ////
double vec_j2000_tk[3];                 // 34     ..   J2000 (X, Y, Z)
double vel_j2000_tk[3];                 // 37       ..         J2000 (X, Y, Z)                   0   1   2   3
double Q_tk[4];                         // 40         J2000 (Qs, Qx, Qy, Qz)
double w_j2000_tk[3];                   // 44        J2000      (Wx Wy Wz)
double vec_tk_TPK[3];                   // 47      ..    /         (X, Y, Z)
double m_tk;                            // 50   
double mi_tk[3][3];                     // 51       (Jxx, Jxy, Jxz...)
//// M I S C ////
double vec_solar[3];                    // 60      J2000      J2000 (ex, ey, ez)
unsigned long r_st_mks;                 // 63    
unsigned long n_su_4_dk;                // 64     ,      (,  )
unsigned long nu_otor_switch_styk_dk;	  // 65  β„– ,     (    )
double tk_top_zap;                      // 66     ( +)
double mks_top_zap;                     // 67     (  +)
unsigned long pr_doking;                // 68         
unsigned long nr_sudn;                  // 69      
} NU_temp;

//   
static bool USO_Booled[20][16];         //   (  _ .. 3.7)

      
      



(. . - ISBN 5-7038-2178-9), ( SoyCOM) , .





SGP4, ( TLE - ).





() UI , "" -





"-16". ().





, .





: () 15- ( + / -), "" - . . :





  • / ( 16- ).





  • ( ).





  • .





  • / .





, , .





, - , "" ( 246), (1-1) ( , () ). 20.





C++ Builder 6 Visual Studio (, MFC + OpenGL ) (***_form.cpp) , /. :





, ON, brvi_on = true;





void __fastcall TIrBrForm::brvi_on_btnClick(TObject *Sender)
{
brvi_on=true;           //   
Panel1->Color=clLime;   //      
}
      
      



- , , , , . . - , β„–228

















14









15









17









18





"0"





30





"1"





31

















24









25









27









28









04









05





TPanel, Caption. - . "1":





void __fastcall TIrBrForm::brvi_btn_1Click(TObject *Sender)
{
if(brvi_on){
USO_BitType[16][3] = 0111;
if(i1->Caption=="")
        i1->Caption="1";
else if(i2->Caption=="")
        i2->Caption="1";
else if(i3->Caption=="")
        i3->Caption="1";
else if(i4->Caption=="")
        i4->Caption="1";
else if(i5->Caption=="")
        i5->Caption="1";
else if(i6->Caption=="")
        i6->Caption="1";
else if(i7->Caption=="")
        i7->Caption="1";
else if(i8->Caption=="")
        i8->Caption="1";
else if(i9->Caption=="")
        i9->Caption="1";
else if(i10->Caption=="")
        i10->Caption="1";
else if(i11->Caption=="")
        i11->Caption="1";
else if(i12->Caption=="")
        i12->Caption="1";
else if(i13->Caption=="")
        i13->Caption="1";
else if(i14->Caption=="")
        i14->Caption="1";
else {}
}
}
      
      



, for, . . , "", , "".





, :





void __fastcall TIrBrForm::isp_btnClick(TObject *Sender)
{
if(brvi_on) { //   
if(i1->Caption==""&&i2->Caption==""){  //      ,
i1->Caption=="A";     //   
i2->Caption=="A";
JPS(3,is_irvi,is_operator,"","");  //    
} else {              //  ( 1  2  )
AnsiString brvi_msg = i1->Caption+i2->Caption+i3->Caption+i4->Caption+    //      
i5->Caption+i6->Caption+i7->Caption+i8->Caption+i9->Caption+i10->Caption+
i11->Caption+i12->Caption+i13->Caption+i14->Caption+i15->Caption;
JPS(1,is_operator,is_irvi,brvi_msg,"");
Timer1->Enabled=true;  //    
//    
i1->Caption="";
i2->Caption="";
i3->Caption="";
i4->Caption="";
i5->Caption="";
i6->Caption="";
i7->Caption="";
i8->Caption="";
i9->Caption="";
i10->Caption="";
i11->Caption="";
i12->Caption="";
i13->Caption="";
i14->Caption="";
i15->Caption="";

irvi_string = brvi_msg; //     

ChekIrvi(irvi_string); }} else  //   
JPS(3,is_miu,is_operator,cmd_brvi_error,"");   //   
}

      
      



, AnsiString irvi_string. ChekIrvi :





void ChekIrvi (AnsiString irvi_str){
if(irvi_str.IsEmpty())JPS(3,is_miu,is_operator," !",""); else {
irvi_type.mode = StrToInt(irvi_str.SubString(1,2)); //       ""
switch (irvi_type.mode) {   //  
        case 00: /*      - 1 - 4 */ break;
        case 04: /*   10-  */ break;
        case 05: /*   8-  */ break;
        case 10: /*    */   break;           // Arg addr RUS AUS data?
        case 11: /*    1-  */  break;
        case 12: /*    2-  */  break;
        case 14: /*   10-  */                       //   14, 
                 if((irvi_str.SubString(3,5)).IsEmpty())JPS(3,is_miu,is_operator," !",""); else {
                 irvi_type.addr = StrToInt(irvi_str.SubString(3,5));   //   
                 if(CorrectAddr(irvi_type.addr)) {                     //   ,  , 
                 if((irvi_str.SubString(8,7)).IsEmpty())JPS(3,is_miu,is_operator," !",""); else {
                 irvi_type.value = StrToInt(irvi_str.SubString(8,7));  //  
                 ArgonMemoryType[irvi_type.addr] = irvi_type.value;    //      
                 SetItvi(irvi_type.mode,irvi_type.addr,ArgonMemoryType[irvi_type.addr], irvi_type.z );   //    
                 JPS(4,is_argon,is_irvi,"  "+               //   (  )
                 IntToStr(irvi_type.value)+"   "+IntToStr(irvi_type.addr),"");}}
                 else {                                                 //     ,
                 irvi_err = true;
                 JPS(3,is_argon,is_operator,arg_addr_error,"");     } }  //      16
                 break;
        case 15: /*   8-  */  break;
        case 17: /*   10-  */ break;
        case 18: /*   8-  */
                // irvi_type.addr = StrToInt(irvi_str.SubString(3,5));   //   
                 // if(CorrectAddr(irvi_type.addr)) {                    //   ,  , 
                 //irvi_type.value = StrToInt(irvi_str.SubString(8,7));  //  
                // ArgonMemoryType[irvi_type.addr] = irvi_type.value;   //      
                 //SetItvi(irvi_type.mode,(irvi_type.addr)+1,ArgonMemoryType[irvi_type.addr], irvi_type.z );   //    
                 //mode18act=true;
                 break;
        case 21: /*    1-  */ break;
        case 22: /*    2-  */ break;
        case 24: /*   10-  */                      //   24, 
                 irvi_type.addr = StrToInt(irvi_str.SubString(3,5));   //     
                 if(CorrectAddr(irvi_type.addr)) {                     //   ,  , 
                 SetItvi(irvi_type.mode,irvi_type.addr,ArgonMemoryType[irvi_type.addr], irvi_type.z ); }  //    
                 else   {                                               //     ,
                 irvi_err = true;
                 JPS(3,is_argon,is_operator,arg_addr_error,"");   }     //      16
                 break;
        case 25: /*   8-  */ break;
        case 27: /*   10-  */ break;
        case 28: /*   8-   */break;
        case 30: /*      -   */
                 irvi_type.addr = StrToInt(irvi_str.SubString(3,5));   //     
                 if(CorrectAddr(irvi_type.addr)) {                     //   ,  , 
                 irvi_type.value = StrToInt(irvi_str.SubString(8,7));  //  
                 mode_30(irvi_type.addr,irvi_type.value); }             //    
                 else   {                                              //     ,
                 irvi_err = true;
                 JPS(3,is_argon,is_operator,arg_addr_error,"");   }    //      16
                 break;
        case 31: /*      -   */
                 irvi_type.addr = StrToInt(irvi_str.SubString(3,5));   //     
                 if(CorrectAddr(irvi_type.addr)) {                     //   ,  , 
                 irvi_type.value = StrToInt(irvi_str.SubString(8,7));  //  
                 mode_31(irvi_type.addr,irvi_type.value); }             //    
                 else   {                                              //     ,
                 irvi_err = true;
                 JPS(3,is_argon,is_operator,arg_addr_error,"");   }    //      16
                 break;
        case 40: /*  */ break;
        case 41: /*  */ break;
        case 42: /*  */ break;
        case 43: /*  */ break;
        case 44: /*  */ break;
        case 45: /*  */ break;
        case 46: /*  */ break;
        case 48: /*   */
        break;
        default: irvi_err = true;       //   (   )
                 JPS(3,is_argon,is_irvi,"","");        //     
                 JPS(3,is_miu,is_operator," !","");
        irvi_type.addr = StrToInt(irvi_str.SubString(3,5));
        irvi_type.value = StrToInt(irvi_str.SubString(8,7));
        break;
} } }

      
      



/ , . , :





(, , .) .





"-16", " 16", :





( ), ( , .. 2 - UDP), , (.. 2 3) . . TLabel , .





( ) ( ).





, , - . "-" . - , , . :









, , - β„–219 ( β„– 5.19, β„– 5.1)





.. . , . - () , (), , . , , "", "7". , , "" .





, , :





, - , , () . , 11 " 4" 15 " 15" 13 " 8".





.





static bool KSP_Booled[16][9];
      
      



, , true, . 7 " " KSP_Booled[0][6]=true;



, KSP_Booled[0][6]=1 , , , " ", :





//  ,    7
 ...
   if (KSP_Let[0]){ //                                  
   KSP_Booled[0][6]=true;                          //    7 - 
   JPS(1,is_operator,is_miu,is_ksp,"7"); } else   //   
 ... 

//  uso_model.cpp  USO_work
 ...
     if(KSP_Booled[0][6]) { // A 7
        KSP_Booled[0][6] = false;
        // 95     
        USO_Booled[0][3]=true;
        kdu_sdd = false;
     }
 ...
 
//   -   
 ...
  if(USO_Booled[0][3]){  // KSP A7
  A7_LABEL->Color=clLime;
  A7_LABEL->Font->Color=clBlack;  } else {
  A7_LABEL->Color=clGreen;
  A7_LABEL->Font->Color=clYellow; }
 ...  
      
      



Thus, we implement the standard logic of working with the PCB and USO, of course, if there are people who understand the USO of the Soyuz spacecraft who have found an error in our interpretation of the logic of work with the PCB, please correct us, because we do not have materials on USO and we built this logic by studying the work of the InPU models and the manual for working with the Neptune-ME system.





I think this is quite a lot of information for one post, so I will describe the rest of the formats in the next post.








All Articles