Ejemplo n.º 1
0
//---------------------------------------------------------------------------
void __fastcall TBitmapForm::InvoiceGridUpdateFooter(TObject *Sender)
{
  double  balanceDue, totalInvoice;
  TBookmark curBookmark;

  if (InUpdateFooter) return;

  InUpdateFooter = true;
  try {
	InvoiceTable->DisableControls();
	curBookmark = InvoiceTable->Bookmark;
	balanceDue = 0.0;
	totalInvoice = 0.0;
	while (!InvoiceTable->Eof)
	{
	  balanceDue= balanceDue + InvoiceTable->FieldByName("Balance Due")->AsCurrency;
	  totalInvoice= totalInvoice + InvoiceTable->FieldByName("Total Invoice")->AsCurrency;
	  InvoiceTable->Next();
	}
	InvoiceTable->Bookmark = curBookmark;
	InvoiceTable->EnableControls();
	InvoiceGrid->ColumnByName("Balance Due")->FooterValue=
	  FloatToStrF(balanceDue, ffCurrency, 10, 2);
	InvoiceGrid->ColumnByName("Total Invoice")->FooterValue=
	  FloatToStrF(totalInvoice, ffCurrency, 10, 2);
	InUpdateFooter = false;
  } catch (...) {
	InUpdateFooter = false;
  }
}
Ejemplo n.º 2
0
//===========================================================================
void __fastcall Tform_Result_1::Button4Click(TObject *Sender)
{
    if ( TabControl1->Tabs->Count         <    2 ) return;
    if ( *pCountSelectedStorageParts      <    2 ) return;
    if ( ComboBox1->ItemIndex            ==   -1 ) return;
    if ( StringGrid1->Cells[1][1].data() == NULL ) return;
    if ( ComboBox2->ItemIndex            ==   -1 ) ComboBox2->ItemIndex = ComboBox1->ItemIndex;

    SetupTableValues(0);
    Application->ProcessMessages();

    double Coriolis_1   = StrToFloat(StringGrid1->Cells[1][ComboBox1->ItemIndex + 1]);
    double Quadrature_1 = StrToFloat(StringGrid1->Cells[1][ComboBox2->ItemIndex + 1]);

    SetupTableValues(1);
    Application->ProcessMessages();

    double Coriolis_2   = StrToFloat(StringGrid1->Cells[1][ComboBox1->ItemIndex + 1]);
    double Quadrature_2 = StrToFloat(StringGrid1->Cells[1][ComboBox2->ItemIndex + 1]);

    SetupTableValues(0);
    Application->ProcessMessages();

    double speed;
    try { speed = StrToFloat(Edit3->Text); } catch ( ... )
    {
       MessageBox(Handle, "No numeric number", "Warning", MB_ICONWARNING|MB_OK);
       Edit3->SetFocus();
       Edit3->SelectAll();
       return;
    }

    // ---- Затычка на деление на ноль -----
    if ( Coriolis_1 - Coriolis_2 == 0 ) Coriolis_1 -= Coriolis_1*0.01;

    // ---- Расчет значений -----
    double mashtab, angle;
    try
    {
        mashtab = (Coriolis_1 - Coriolis_2) / ( 2.0 * speed );
        // *******************
        double sin_angle = 0;
        try { sin_angle = (Quadrature_1 - Quadrature_2) / (Coriolis_1 - Coriolis_2); } catch (...) {}
        if ( sin_angle < -1.0 ) sin_angle = -1.0;
        if ( sin_angle >  1.0 ) sin_angle =  1.0;
        angle = atan(sin_angle) * 180.0 / M_PI;
    }
    catch (...)
    {
        mashtab = 0;
        angle   = 0;
    }

    if ( fabs(mashtab) < 1e-3 )
         Edit1->Text = FloatToStrF(mashtab, ffFixed   , 20, 9);
    else Edit1->Text = FloatToStrF(mashtab, ffFixed   , 20, 10);

    Edit2->Text = FloatToStrF(angle, ffFixed, 20, 5);
}
Ejemplo n.º 3
0
//---------------------------------------------------------------------------
void __fastcall TfrmView::FormMouseMove(TObject *Sender, TShiftState Shift, int X,
          int Y)
{
	float x,y;

	_pView->onMouseMove( X, Y, &x, &y);
    StatusBar1->Panels->operator [](0)->Text = FloatToStrF(x, ffFixed, 10, 3);
    StatusBar1->Panels->operator [](1)->Text = FloatToStrF(y, ffFixed, 10, 3);
}
Ejemplo n.º 4
0
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    for (int i = 0; i < Chart1->SeriesList->Count; i++) Chart1->Series[i]->Clear();

  // --------------------------------------------------------
  // ----------- Система Координат XYZ ----------------------
  // ----------- Ось X напрвлена по нормали -----------------
  // ----------- Плоскость YZ лежит в апертуре антенны ------
  // ----------- Ось Z направлена по вертикали апертуры -----
  // ----------- Ось Х направлена по гГоризонтали апертуры --
  // --------------------------------------------------------
  // ----------- По оси "Y" идет сторона "А" еллипса --------
  // ----------- По оси "Z" идет сторона "B" еллипса --------
  // --------------------------------------------------------
  
      double a = 1 * 3.14 / 180;
      double b = 1 * 3.14 / 180;
      double h = 1;
  // -----------
  // -----------
      double a_cos = sin(Math::ArcTan2(a, h));
      double b_cos = sin(Math::ArcTan2(b, h));

      double AlfaX =  cos(DeltaQ) * cos(DeltaAlfa);
      double AlfaY = -sin(DeltaQ) * cos(DeltaAlfa);
      double AlfaZ =  sin(DeltaAlfa);
  // -----------
      double New_AlfaX, New_AlfaY, New_AlfaZ, New_DeltaQ, New_DeltaAlfa;

      double Base_DeltaQ, Base_DeltaAlfa, Offset = 0;

      for (double fi = 0; fi < 2 * 3.15; fi = fi + 0.01){
         New_AlfaY = AlfaY + a_cos * cos(fi);
         New_AlfaZ = AlfaZ + b_cos * sin(fi);
         New_AlfaX = sqrt(fabs(1 - New_AlfaY*New_AlfaY - New_AlfaZ*New_AlfaZ));

         if (fi == 0) {
            Label5->Caption = FloatToStrF(New_AlfaX, ffFixed, 20, 3);
            Label6->Caption = FloatToStrF(New_AlfaY, ffFixed, 20, 3);
            Label7->Caption = FloatToStrF(New_AlfaZ, ffFixed, 20, 3);

            Base_DeltaQ    = - Math::ArcTan2(AlfaY, AlfaX);
            Base_DeltaAlfa =   Math::ArcTan2(AlfaZ, sqrt(fabs(1 - AlfaZ*AlfaZ)));
          //--------------
            Series5->AddXY(Base_DeltaQ * 180 / 3.14, Base_DeltaAlfa * 180 / 3.14, "", clYellow);
         }

         New_DeltaQ    = - Math::ArcTan2(New_AlfaY, New_AlfaX);
         New_DeltaAlfa =   Math::ArcTan2(New_AlfaZ, sqrt(fabs(1 - New_AlfaZ*New_AlfaZ)));

         Series1->AddXY(New_DeltaQ * 180 / 3.14, New_DeltaAlfa * 180 / 3.14, "", clBlack);
      }
  // -----------                                                                  

}
Ejemplo n.º 5
0
void __fastcall TfrmSetari::FormShow(TObject *Sender)
{
txtEuro->Text=FloatToStrF(frmMain->setari.curs_eur,ffGeneral,7,4);
txtUsd->Text=FloatToStrF(frmMain->setari.curs_usd,ffGeneral,7,4);
txtMarja->Text=IntToStr(frmMain->setari.marja_cautare);
txtMoneda->ItemIndex=txtMoneda->Items->IndexOf(frmMain->setari.moneda_marja_cautare);
frmMain->ComboList(txtJudet, "den", "judete", false, "");
txtJudet->ItemIndex=txtJudet->Items->IndexOf(frmMain->setari.judet);
txtJudetChange(Sender);
txtLocalitate->ItemIndex=txtLocalitate->Items->IndexOf(frmMain->setari.localitate);
}
Ejemplo n.º 6
0
//===========================================================================
void __fastcall Tform_Main::listbox_DTFFreqsClick(TObject *Sender)
{
    DecimalSeparator = '.';
    if ( listbox_DTFFreqs->ItemIndex == -1 ) return;

    AnsiString as = listbox_DTFFreqs->Items->Strings[listbox_DTFFreqs->ItemIndex];
    double freq = StrToFloat(as);

    // ---- Заполнение полей редактора --------
    e_Freq1->Text = FloatToStrF(freq - DFT_DeltaFreq, ffFixed, 20, 2);
    e_Freq2->Text = FloatToStrF(freq + DFT_DeltaFreq, ffFixed, 20, 2);
}
Ejemplo n.º 7
0
//---------------------------------------------------------------------------
void __fastcall TForm1::TrackBar1Change(TObject *Sender)
{
  DeltaQ    = TrackBar1->Position * 3.14 / 180;
  DeltaAlfa = TrackBar2->Position * 3.14 / 180;

  Label3->Caption = DeltaQ    * 180 / 3.14;
  Label4->Caption = DeltaAlfa * 180 / 3.14;

  Label12->Caption = FloatToStrF(ArcCos(cos(DeltaAlfa)*cos(DeltaQ))*180 / 3.14, ffFixed, 20, 3 );
  Label14->Caption = FloatToStrF(Math::ArcTan2(sin(DeltaAlfa), cos(DeltaAlfa)*sin(DeltaQ)) *180 / 3.14, ffFixed, 20, 3 );

  Button1Click(Sender);
}
Ejemplo n.º 8
0
//===========================================================================
void __fastcall TfrmTargetList::CheckListBox1Click(TObject *Sender)
{
  if (CheckListBox1->ItemIndex == -1) return;

  StatusBar1->Panels->Items[0]->Text = "Ro:" + FloatToStrF(Targets[CheckListBox1->ItemIndex]->R0, ffFixed, 20, 1);
  StatusBar1->Panels->Items[1]->Text = "Bo:" + FloatToStrF(Targets[CheckListBox1->ItemIndex]->B0*_180_del_Pi, ffFixed, 20, 1);
  StatusBar1->Panels->Items[2]->Text = "Vo:" + FloatToStrF(Targets[CheckListBox1->ItemIndex]->V0, ffFixed, 20, 1);
  StatusBar1->Panels->Items[3]->Text = "Ho:" + FloatToStrF(Targets[CheckListBox1->ItemIndex]->H0, ffFixed, 20, 1);
  StatusBar1->Panels->Items[4]->Text = "Ko:" + FloatToStrF(Targets[CheckListBox1->ItemIndex]->K0*_180_del_Pi, ffFixed, 20, 1);

  for (int i = 0; i < TargetIndicatorList->Count; i ++)
    if ( ((TfrmTargetIndicator*)TargetIndicatorList->Items[i])->TargetId == Targets[i]->id)
          ((TfrmTargetIndicator*)TargetIndicatorList->Items[i])->SetFocus();
}
Ejemplo n.º 9
0
void __fastcall TAcquireThread::Draw() {
	switch(mm) {
	case 0:
//		StatusRecForm->Label1->Caption = s;
//		StatusRecForm->Label2->Caption = s1;
		break;
	case 1:
		StatusRecForm->Close();
		MainForm->StartMonitoring();
		break;
	case 2:
//		StatusRecForm->Label2->Caption = "Количество блоков " + IntToStr
//			(num_blocks);
		break;
	case 3:
//		StatusRecForm->ProgressBar1->Position = pos;
		break;
	case 4:
		TFormatSettings FormatSettings;
		GetLocaleFormatSettings(GetSystemDefaultLCID(), FormatSettings);
		FormatSettings.ThousandSeparator = 160;
		FormatSettings.CurrencyString = "";
		FormatSettings.CurrencyDecimals = 0;

		MainForm->ListView2->Items->Item[0]->SubItems[0].Text = FloatToStr(t)
			+ " нс";
		MainForm->ListView2->Items->Item[1]->SubItems[0].Text = FloatToStrF
			(AcfParams._time * 1e-6, ffFixed, 5, 2) + " с";
		MainForm->ListView2->Items->Item[2]->SubItems[0].Text = Format
			("%m", ARRAYOFCONST((double(AcfParams.vybr))), FormatSettings);
		MainForm->ListView2->Items->Item[3]->SubItems[0].Text = FloatToStr
			(AcfParams.zashk / n0 * 100) + "%";
		MainForm->ListView2->Items->Item[4]->SubItems[0].Text = Format
			("%m", ARRAYOFCONST((1e6 * n1 / AcfParams._time)), FormatSettings);
		MainForm->ListView2->Items->Item[5]->SubItems[0].Text = Format
			("%m", ARRAYOFCONST((double(n1))), FormatSettings);

		int ind = 0;
		for (int i = 0; i < n1; i++) {
			if (RawData_t.a[i] > 1e6) {
				ind = i - 1;
				break;
			}
		}

		int m = Floor(ind / 1e3);
		MainForm->Series1->Clear();
		for (int i = 0; i < 1e3; i++) {
			if (!(RawData.a[i * m] == 0)) {
				MainForm->Series1->AddXY(RawData_t.a[i * m] * 1e-6, 1e9 /
					(RawData.a[i * m] * t));
			}
			else {
				MainForm->Series1->AddNullXY(RawData_t.a[i * m] * 1e-6, 0);
			}
		}
		break;
	}

}
Ejemplo n.º 10
0
bool TCurve::SaveToFile(AnsiString asName)
{

    DecimalSeparator = '.';
    FILE *stream = NULL;
    stream = fopen(asName.c_str(), "w");

    AnsiString str;
    str = AnsiString(iNumValues);
    fprintf(stream, str.c_str());
    fprintf(stream, "\n");
    for (int i = 0; i < iNumValues; i++)
    {
        str = "";
        if (i % 10 == 0)
            str += "\n";
        for (int j = 0; j < iNumCols; j++)
            str += FloatToStrF(Values[i][j], ffFixed, 6, 2) + AnsiString(" ");
        str += AnsiString("\n");
        fprintf(stream, str.c_str());
    }

    fclose(stream);
    DecimalSeparator = ',';
}
Ejemplo n.º 11
0
//===========================================================================
void __fastcall TfrmSetupAngleNet::bbApplyClick(TObject *Sender)
{
   // ---------- Проверка ввода ----------
      if (CurAngleTick == NULL) CurAngleTick = (TAnglesTick*) malloc (sizeof(TAnglesTick));

      CurAngleTick->Value   = StrToFloat (Edit1->Text);
      CurAngleTick->Visible = CheckBox1->Checked;

      ListBox1->Items->AddObject(FloatToStrF(CurAngleTick->Value, ffFixed, 20, 2), (TObject*)CurAngleTick);

      SetNewArrayAglesTick();
      AddAndSortItemsListBox();
  // ---------- Проверка ввода ----------

  bool flag = true;

  BitBtn1     ->Enabled = flag;
  BitBtn2     ->Enabled = flag;
  ListBox1    ->Enabled = flag;
  tbDeleteTick->Enabled = flag;
  tbAddTick   ->Enabled = flag;

  Label2->Enabled = !flag;
  Edit1 ->Enabled = !flag;
  Label3->Enabled = !flag;
  bbApply->Visible = !flag;
  bbCancel->Visible = !flag;

  ListBox1    ->ItemIndex = -1;
  tbDeleteTick->Enabled = false;
  CurAngleTick          = NULL;

  frmMain->Repaint();
}
Ejemplo n.º 12
0
//---------------------------------------------------------------------------
void __fastcall TformAi3032::readData()
{
	float VolAi32[AI32_NUM];
	short nErr;

	nErr = api->readVoltage(SlaveNo, Slot, AI32_NUM, _OUTPUT_DATA_ADDRESS_, VolAi32);
	if(nErr != ECMaster_ERROR_SUCCESS)
	{
		api->displayLogMsg(nErr, "Read voltage fail(EPS-3032)");
		return;
	}

	for(int i = 0; i < AI32_NUM; i++)
	{/*
		nErr = api->readSingleRaw(SlaveNo, Slot, i+1, 0x3000, &raw);
		if(nErr != ECMaster_ERROR_SUCCESS)
		{
			api->displayLogMsg(nErr, "Read analog fail(EPS-3216)");
			return;
		}
		this->Edit[i]->Text = IntToHex((int)raw, 4);*/

		this->Edit[i]->Text = FloatToStrF(VolAi32[i], ffFixed, 4, 3);

	}
}
Ejemplo n.º 13
0
void __fastcall TForm1::setVolume(TObject *Sender)
{
	/* Метод расчета и передачи значения уровня громкости */

	// Положение ползунка громкости (0 .. 127)
	float level = TrackBar1->Value;

    // Значение (1 байт) уровня громкости (0x00 .. 0x7F)
	unsigned char volume_level = 0x00;

	// Расчет значения уровня для передачи устройству
	// DEBUG: возможность инвертирования значения
	if (CheckBox16->IsChecked) {
		volume_level = (unsigned char) (TrackBar1->Max - level);
	}
	else
		volume_level = (unsigned char) level;

	// Расчет и отображение уровня громкости в процентах
	Label1->Text = "Уровень: " + FloatToStrF(level*100/TrackBar1->Max, ffNumber, 3, 0) + "%";

	// Передача данных в структуру
	DeviceConfig.volume_level = volume_level;

	// Отправка данных устройству
	deviceSend(DeviceConfig);

	// DEBUG: Вывод отладочной информации
	Memo1->Lines->Strings[1] = ("Level: 0x" + IntToHex(volume_level, 2));
}
Ejemplo n.º 14
0
bool
load_vmat(bool load_direct, const String& proj_name, const String& fn, size_t xdim, size_t ydim, int map_cnt, bool compress)
{
  // String vmat_fp = /*outdir + */ proj_name + "." + fn;
  // if (compress)
  //   vmat_fp += comp_suffix;
  String vmat_fp;
  if (load_direct) {
    vmat_fp = fn;
  } else {
    vmat_fp = make_vmat_output_name(outgridfn, fn, compress);
  }
  Form1->Memo1->Lines->Add("Loading vmat from: " + vmat_fp);

  struct stat results;
  if (0 == stat(vmat_fp.toUtf8().constData(), &results))
    Form1->Memo1->Lines->Add("Size of vmat file: " + FloatToStrF((float)results.st_size/(1024.0*1024.0),ffFixed, 4,4)+" MB");

  bool r = false;
  time_t ti = time(NULL);
  if (!compress) {
    std::ifstream f((vmat_fp).toUtf8().constData(), std::ios::in | std::ios::binary);
    if (!f) {
      Form1->Memo1->Lines->Add(" FATAL ERROR: failed to open vmat dump file for reading: " + vmat_fp);
      return false;
    }
    r = load_vmat_raw(f, xdim, ydim, map_cnt);
  } else {
    r = load_vmat_compressed(vmat_fp, xdim, ydim, map_cnt);
  }

  time_t tf = time(NULL);
  Form1->Memo1->Lines->Add("Time required to load vmat: "+IntToStr(tf-ti) + " seconds.");
  return r;
}
Ejemplo n.º 15
0
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AnsiString Load_Base(AnsiString aFileName, TTreeView *tv1, TTreeView *tv2, TTreeView *tv3, TTreeView *tv4)
{
     TDateTime t1= Now();
 // -------------
     TFileStream* FileStream;
     try {
        FileStream = new TFileStream(aFileName, fmOpenRead);
     } catch ( ... ) {
        MessageBox(NULL, " Невозможно открыть файл 'Estimate.dat' \n\n Данные файла не будут загружены", " Ошибка открытия файла ...", MB_ICONERROR);
        return FloatToStrF((Now().Val - t1.Val)*3600.0*24.0, ffFixed, 15, 3) + "c.";
     }
 // -------------
      ShortString tempString;
      int FileVersion = 0;
      FileStream->Read(&tempString[0], 1);   FileStream->Read(&tempString[1], tempString[0]);
      FileStream->Read(&tempString[0], 1);   FileStream->Read(&tempString[1], tempString[0]);
      FileStream->Read(&tempString[0], 1);   FileStream->Read(&tempString[1], tempString[0]);
      FileStream->Read(&tempString[0], 1);   FileStream->Read(&tempString[1], tempString[0]);
      FileStream->Read(&tempString[0], 1);   FileStream->Read(&tempString[1], tempString[0]);

      FileStream->Read(&FileVersion, sizeof(FileVersion));
      Load_(FileStream, tv1, &GlobalElementCounter );
      Load_(FileStream, tv2, &GlobalMaterialCounter);
      Load_(FileStream, tv3, &GlobalMashineCounter );
      Load_(FileStream, tv4, &GlobalEnergoCounter  );


   // ----------- Создаю список материалов и другой фиговины ---------
         PrepareSpecificallArrays();

         CreateMaterialList (tv1);
         CreateRashodnikList(tv1);
         CreateMashineList  (tv1);
         CreateEnergoList   (tv1);
         CreateServiseList  (tv1);

      
/*      Load_2004_07_14(FileStream, tv1, &GlobalElementCounter);
      Load_2004_07_14(FileStream, tv2, &GlobalMaterialCounter);
      Load_2004_07_14(FileStream, tv3, &GlobalMashineCounter);
      Load_2004_07_14(FileStream, tv4, &GlobalEnergoCounter);*/

 // -------------

  delete FileStream;
  return FloatToStrF((Now().Val - t1.Val)*3600.0*24.0, ffFixed, 15, 3) + "c.";
}
Ejemplo n.º 16
0
//---------------------------------------------------------------------------
void __fastcall TfrmView::FormShow(TObject *Sender)
{
    _pPainter->initialize(this->Handle);
    _pView->onRegen();

    float scale =  _pPainter->getScale();
    StatusBar1->Panels->operator [](2)->Text = "X " + FloatToStrF(scale, ffFixed, 10, 3);
}
Ejemplo n.º 17
0
void __fastcall TfrmView::FormMouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta,
          TPoint &MousePos, bool &Handled)
{
	Handled = true;

    _pView->onMouseWheel(WheelDelta, MousePos.x, MousePos.y);
    float scale =  _pPainter->getScale();
	StatusBar1->Panels->operator [](2)->Text = "X " + FloatToStrF(scale, ffFixed, 10, 3);
}
// ---------------------------------------------------------------------------
void TfrOperationLamination::SetParams() {
	TfrOperationWithMaterial::SetParams();
	Count();

	// приходится вызывать повторно
//	TfrOperationWithMaterial::SetParams();
	lbCount->Caption = "Площадь ламинации " + FloatToStrF(primeNom->GetCount(),
		ffFixed, 10, 2) + " " + primeNom->nomenklatura->unit;
}
Ejemplo n.º 19
0
void __fastcall TfrmMain::SaveToESPECClick(TObject *Sender)
{
	if ( SerialPort == NULL ) return;
	if ( SerialPort->isOpen == false ) return;
    
    char WriteBuffer[256] = {0};
    char ReadBuffer[256] = {0};

  // ----- Чтение базовых параметров профиля --------
    SerialPort->WriteBuffer("PRGM DATA WRITE,PGM: 1,EDIT START\r\n");   Sleep(50);
    SerialPort->ReadBuffer (ReadBuffer);

    for ( int i = 0; i < 9; i++)
    {                     
        UpdateChart(i);
        
        AnsiString s1 = IntToStr(i+1);
        AnsiString s2 = FloatToStrF(EspecProfile[0][i]->temper, ffFixed, 10,1);
        AnsiString s3 = ( EspecProfile[0][i]->Ramp == true) ? "ON" : "OFF";

        AnsiString s4 = "";
        AnsiString s41 = IntToStr(EspecProfile[0][i]->hi);
        AnsiString s42 = IntToStr(EspecProfile[0][i]->mi);
        if ( s41.Length() == 1 ) s4 = s4 + "0";
        s4 = s4 + s41 + ":";
        if ( s42.Length() == 1 ) s4 = s4 + "0";
        s4 = s4 + s42;

        AnsiString s5 = ( EspecProfile[0][i]->Ramp == false) ? "ON" : "OFF";
        sprintf(WriteBuffer, "PRGM DATA WRITE,PGM: 1,STEP %s,TEMP%s,TRAMP%s,TIME%s,GRANTY%s,REF9\r\n", s1.c_str(), s2.c_str(), s3.c_str(), s4.c_str(), s5.c_str() );
        SerialPort->WriteBuffer(WriteBuffer);   Sleep(50);
        SerialPort->ReadBuffer (ReadBuffer);
    }

    SerialPort->WriteBuffer("PRGM DATA WRITE,PGM: 1,END,HOLD\r\n");   Sleep(50);
    SerialPort->ReadBuffer (ReadBuffer);

    SerialPort->WriteBuffer("PRGM DATA WRITE,PGM: 1,EDIT END\r\n");   Sleep(50);
    SerialPort->ReadBuffer (ReadBuffer);

    UpdateChart(-1);

    ShowMessage("Program Saved");

//<LF>
//PRGM DATA WRITE,PGM: 1,STEP 2,TEMP50.0,TRAMPON,TIME00:25,GRANTYOFF,REF9<LF>
//PRGM DATA WRITE,PGM: 1,STEP 3,TEMP50.0,TRAMPOFF,TIME02:00,GRANTYON,REF9<LF>
//PRGM DATA WRITE,PGM: 1,STEP 4,TEMP-40.0,TRAMPON,TIME01:30,GRANTYOFF,REF9<LF>
//PRGM DATA WRITE,PGM: 1,STEP 5,TEMP-40.0,TRAMPOFF,TIME02:00,GRANTYON,REF9<LF>
//PRGM DATA WRITE,PGM: 1,STEP 6,TEMP50.0,TRAMPON,TIME01:30,GRANTYOFF,REF9<LF>
//PRGM DATA WRITE,PGM: 1,STEP 7,TEMP50.0,TRAMPOFF,TIME02:00,GRANTYON,REF9<LF>
//PRGM DATA WRITE,PGM: 1,STEP 8,TEMP25.0,TRAMPON,TIME00:25,GRANTYOFF,REF9<LF>
}
Ejemplo n.º 20
0
//---------------------------------------------------------------------------
void TfrmPelengCharacteristic::CreateSeriesAndAddToChart(TChart *aChart, TFloat aVal)
{
 TFastLineSeries *Series;

    Series                 = new TFastLineSeries(this);
    Series->ParentChart    = aChart;
    Series->LinePen->Color = aChart->GetFreeSeriesColor(true);
    Series->LinePen->Width = 2;
    Series->XValues->Order = loNone;
    Series->YValues->Order = loNone;
    Series->Title          = "Teta = " + FloatToStrF(aVal*_180_del_Pi, ffFixed, 20, 2);
}
Ejemplo n.º 21
0
void __fastcall TReportForm::VirtualStringTree1GetText(TBaseVirtualTree *Sender, PVirtualNode Node,
		  TColumnIndex Column, TVSTTextType TextType, UnicodeString &CellText)
{
   TReportData *t;
   t=(TReportData *)Sender->GetNodeData(Node);

   if ( !(t == NULL) ) {
	 int level = Sender->GetNodeLevel(Node);
	 switch (level) {
	   case 0:  switch (Column) {
				  case 0: CellText=t->Name; break;
				  case 1: CellText=FloatToStrF(t->pcs, ffFixed, 5, 2); break;
				  case 2: CellText=FloatToStrF(t->pi, ffFixed, 5, 2); break;
				  case 4: CellText=FloatToStrF(t->rms, ffFixed, 5, 3); break;
				}
				break;
	   case 1:  switch (Column) {
				  case 0: CellText=t->Name; break;
				  case 1: CellText=FloatToStrF(t->pcs, ffFixed, 5, 2); break;
				  case 2: CellText=FloatToStrF(t->pi, ffFixed, 5, 2); break;
				  case 3: CellText=FloatToStrF(t->angle, ffFixed, 5, 2); break;
				}
				break;
	 }
   }
}
Ejemplo n.º 22
0
//---------------------------------------------------------------------------
void __fastcall TToolsForm::ComboEdit1ButtonClick(TObject *Sender)
{
  try {
    rxCalculator1->Value = StrToFloat(ComboEdit1->Text);
  }
  catch(...) {
    ComboEdit1->Text = "0";
  }
  if (rxCalculator1->Execute()) {
    ComboEdit1->Text = FloatToStrF(rxCalculator1->Value, ffGeneral,
      Max(2, rxCalculator1->Precision), 0);
  }
}
Ejemplo n.º 23
0
//===========================================================================
void __fastcall Tform_Main::Timer2Timer(TObject *Sender)
{
    if ( isChildMomEnabled == false ) return;

    if ( TimeElapsed <= 0 )
    {
        Timer1->Interval = 60;
        Timer2->Interval = 60000;

        STRMessage = "На сьогоднi iгри закiнченнi";

        CheckSofts( true );

        TimeElapsed = 0.0;
        return;
    }

    if ( CheckSofts( false ) == true )
    {
        Timer1->Interval = TIMER_DRAW;

        TimeElapsed = TimeElapsed - Timer2->Interval * Time_coef;
        if ( TimeElapsed <= 35000 && TimeElapsed > 1000) Timer1->Interval = 40;
    }
    else
        // ---- Если нету софта, отрисовка медленная ----
        Timer1->Interval = 60000;

    if ( TimeElapsed <= 0.0 ) TimeElapsed = 0.0;
    STRMessage = "Залишилось " + FloatToStrF(TimeElapsed *0.001, ffFixed, 20, 0) + " сек";
    Label7->Caption = FloatToStrF(TimeElapsed *0.001, ffFixed, 20, 0) + " сек";

    Reg->RootKey = HKEY_LOCAL_MACHINE;
    Reg->OpenKey("Software\\Home\\GameTimer", true);
        Reg->WriteFloat  ("TimeElapsed" , TimeElapsed );
        Reg->WriteInteger("LastGameDate", LastGameDate);
    Reg->CloseKey();
}
Ejemplo n.º 24
0
bool
save_vmat(const String& proj_name, const String& fn, size_t xdim, size_t ydim, int map_cnt, bool compress)
{
  // String vmat_fp = /*outdir +*/ proj_name + "." + fn;
  // if (compress)
  //   vmat_fp += comp_suffix;
  String vmat_fp = make_vmat_output_name(outgridfn, fn, compress);
  Form1->Memo1->Lines->Add("Saving vmat into: " + vmat_fp);
  std::ofstream f(vmat_fp.toUtf8().constData(), std::ios::out | std::ios::binary);
  if (!f) {
    Form1->Memo1->Lines->Add(" FATAL ERROR: failed to open vmat dump file for writing" + vmat_fp);
    return false;
  }

  Form1->Memo1->Lines->Add("Dimensions: columns: "+IntToStr(xdim)+
			   ", rows: "+IntToStr(ydim) +
			   ", features: "+IntToStr(map_cnt));
  bool r = false;
  time_t ti = time(NULL);
  if (!compress) {
    r = write_vmat_raw(f, xdim, ydim, map_cnt);
    struct stat results;
    if (r && 0 == stat(vmat_fp.toUtf8().constData(), &results))
      Form1->Memo1->Lines->Add("Finished writing vmat dump file, size: " + 
			       FloatToStrF((float)results.st_size/(1024.0*1024.0), ffFixed, 7,4)+" MB");
  } else {
    f.close();
    r = write_vmat_compressed(vmat_fp, xdim, ydim, map_cnt);
    struct stat results;
    if (r && 0 == stat(fn.toUtf8().constData(), &results))
      Form1->Memo1->Lines->Add("Finished writing compressed vmat dump file "+fn+", size: " + 
			       FloatToStrF((float)results.st_size/(1024.0*1024.0), ffFixed, 7,4)+" MB");
  }

  time_t tf = time(NULL);
  Form1->Memo1->Lines->Add("Time required to dump vmat: "+IntToStr(tf-ti) + " seconds.");
  return r;
}
Ejemplo n.º 25
0
void __fastcall TfrmMain::ListBox1Click(TObject *Sender)
{
   if ( ListBox1->ItemIndex == -1 ) return;

   TEspec *es = (TEspec *) ListBox1->Items->Objects[ListBox1->ItemIndex];

   rbRamp->Checked = es->Ramp;
   //rbSoak->Checked = es->Soak;
   eTempr->Text = FloatToStrF( es->temper, ffFixed, 20, 1 );
   eTime->Text = IntToStr( es->hi*60 + es->mi );


   UpdateChart(ListBox1->ItemIndex);
}
Ejemplo n.º 26
0
//---------------------------------------------------------------------------
bool ValidaClienteAtraso(String CodCliente) {
   double nAtraso = 0;
   if (Date() >= (QuintoDiaUtil + 1)) {
      nAtraso = VerificaClientAtraso(CodCliente);
      if (nAtraso > 0) {
         String sMsg = "O cliente " + CodCliente + " possui o valor de " +\
                       FloatToStrF(nAtraso, ffCurrency, 15, 2) + " em atraso.";
         TCFin1003B *pFin1003B = new TCFin1003B(Application,sMsg);
         int ModalResul = pFin1003B->ShowModal();
         delete pFin1003B;
         return (ModalResul == mrOk);
      }
   } else
      return true;
}
Ejemplo n.º 27
0
double TfSbornyZakaz::Sum() {
	LockWindowUpdate(Handle);
	double sum = 0;

	// здесь сбрасываем использование принтеров
	for (int i = 0; i < listOfTools->Count; i++) {
		TTool *tool = (TTool*)listOfTools->Items[i];
		tool->SetUse(false);
	}

	// чистим
	slgoods->Clear();
	Memo1->Clear();
	sldescription->Clear();

	if (sbForSelFrame->ControlCount == 0) {
		sum = 0;
	}
	else {
		// поищем что есть посчитать, все фреймы, виртуальная функция Sum
		for (int i = 0; i < listOfIzdelies->Count; i++) {
			TfrSelectable *izdelie =
				dynamic_cast<TfrSelectable*>(listOfIzdelies->Items[i]);
			sum += izdelie->Sum();
		}

		double zakazCount = spCount->Value;
		// подсчитаем использование оборудования
		for (int i = 0; i < listOfTools->Count; i++) {
			TToolPrepareTool *tool =
				dynamic_cast<TToolPrepareTool*>(listOfTools->Items[i]);
			if (tool && tool->GetUse() == true) {
				Memo1->Lines->Add(tool->prepareTool->myToString(zakazCount));
				sum += Ceil(tool->prepareTool->price * zakazCount);
			}
		}

	}

	lbAllPrice->Caption = "Сумма: " + FloatToStrF(sum, ffFixed, 10, 2) +
		" руб.";

	allsum = sum;

	LockWindowUpdate(NULL);
	return sum;
}
Ejemplo n.º 28
0
//===========================================================================
void __fastcall TfrmSetupAngleNet::ListBox1Click(TObject *Sender)
{
     if (ListBox1->ItemIndex == -1) return;

     CurAngleTick = (TAnglesTick*)ListBox1->Items->Objects[ListBox1->ItemIndex];

     Edit1    ->Text    = FloatToStrF(CurAngleTick->Value, ffFixed, 20, 2);
     CheckBox1->Checked = CurAngleTick->Visible;

     bool flag = false;

     Label2->Enabled = !flag;
     Edit1 ->Enabled = !flag;
     Label3->Enabled = !flag;
     CheckBox1->Enabled = !flag;

     tbDeleteTick->Enabled = true;
}
Ejemplo n.º 29
0
}
//---------------------------------------------------------------------------------------------------------------------------
void __fastcall TFrBlockProduceCost::DiscountEdChange(TObject *Sender)
{
  if (DiscountEd->Value == 0)
	 {WithDiscEd->Text = CostBlockEd->Text;}

  if (DiscountEd->Value == 0 && StrToFloat(CostBlockEd->Text) == 0 ||
	  DiscountEd->Value == 0 && StrToFloat(CostBlockEd->Text) != 0 ||
	  DiscountEd->Value != 0 && StrToFloat(CostBlockEd->Text) == 0)
	 {return;}

  if (DiscountEd->Value != 0 && StrToFloat(CostBlockEd->Text) != 0)
	 {
	  float a = StrToFloat(CostBlockEd->Text);
	  float b = DiscountEd->Value;
	  float c = a - ((a/100)*b);
	  WithDiscEd->Text = FloatToStrF(c, ffFixed, 10,2);
Ejemplo n.º 30
0
//===========================================================================
void TfrmSetupAngleNet::AddAndSortItemsListBox()
{
  CurAngleTick = NULL;

  ListBox1->Items->Clear();
  ListBox1->Items->BeginUpdate();
     // -------------
        for (int i = 0; i < AnglesTickCount; i ++){
             for (int k = i; k < AnglesTickCount; k ++){
                  if (AnglesTick[i].Value > AnglesTick[k].Value) {
                      TAnglesTick TempTick = AnglesTick[i];
                      AnglesTick[i]        = AnglesTick[k];
                      AnglesTick[k]        = TempTick;
                  }
             }
             ListBox1->Items->AddObject(FloatToStrF(AnglesTick[i].Value, ffFixed, 20, 2), (TObject*)&AnglesTick[i]);
        }
     // -------------
  ListBox1->Items->EndUpdate();
}