항목 추가

master
DESKTOP-999R8N3\CJY 2022-02-18 18:13:11 +09:00
parent 4e7c54112a
commit 5a17337872
10 changed files with 2998 additions and 709 deletions

View File

@ -55,6 +55,8 @@
this.labelTitleCommunicationLog = new SmartX.SmartLabel();
this.buttonCommunicationLog = new SmartX.SmartButton();
this.labelTitleEquipmentType = new SmartX.SmartLabel();
this.labelMotorNum = new SmartX.SmartLabel();
this.labelTitleMotorNum = new SmartX.SmartLabel();
this.smartGroupBox1.SuspendLayout();
this.SuspendLayout();
//
@ -63,6 +65,8 @@
this.smartGroupBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(46)))), ((int)(((byte)(46)))), ((int)(((byte)(46)))));
this.smartGroupBox1.BackPictureBox = null;
this.smartGroupBox1.BackPictureBox1 = null;
this.smartGroupBox1.Controls.Add(this.labelMotorNum);
this.smartGroupBox1.Controls.Add(this.labelTitleMotorNum);
this.smartGroupBox1.Controls.Add(this.labelTitleBLDC);
this.smartGroupBox1.Controls.Add(this.buttonBLDCUsing);
this.smartGroupBox1.Controls.Add(this.labelMovingAverage);
@ -111,7 +115,7 @@
this.labelTitleBLDC.ForeColor = System.Drawing.Color.White;
this.labelTitleBLDC.InitVisible = true;
this.labelTitleBLDC.LineSpacing = 0F;
this.labelTitleBLDC.Location = new System.Drawing.Point(115, 220);
this.labelTitleBLDC.Location = new System.Drawing.Point(115, 193);
this.labelTitleBLDC.Name = "labelTitleBLDC";
this.labelTitleBLDC.Size = new System.Drawing.Size(260, 28);
this.labelTitleBLDC.TabIndex = 214;
@ -132,7 +136,7 @@
this.buttonBLDCUsing.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonBLDCUsing.DownImage")));
this.buttonBLDCUsing.GroupID = 0;
this.buttonBLDCUsing.InitVisible = true;
this.buttonBLDCUsing.Location = new System.Drawing.Point(381, 220);
this.buttonBLDCUsing.Location = new System.Drawing.Point(381, 193);
this.buttonBLDCUsing.Mode = SmartX.SmartButton.BUTTONMODE.PUSH;
this.buttonBLDCUsing.Name = "buttonBLDCUsing";
this.buttonBLDCUsing.NestedClickEventPrevent = false;
@ -162,7 +166,7 @@
this.labelMovingAverage.Font = new System.Drawing.Font("Arial", 14F, System.Drawing.FontStyle.Bold);
this.labelMovingAverage.InitVisible = true;
this.labelMovingAverage.LineSpacing = 0F;
this.labelMovingAverage.Location = new System.Drawing.Point(381, 177);
this.labelMovingAverage.Location = new System.Drawing.Point(381, 159);
this.labelMovingAverage.Name = "labelMovingAverage";
this.labelMovingAverage.Size = new System.Drawing.Size(120, 28);
this.labelMovingAverage.TabIndex = 212;
@ -182,7 +186,7 @@
this.labelTitleMovingAverage.ForeColor = System.Drawing.Color.White;
this.labelTitleMovingAverage.InitVisible = true;
this.labelTitleMovingAverage.LineSpacing = 0F;
this.labelTitleMovingAverage.Location = new System.Drawing.Point(115, 177);
this.labelTitleMovingAverage.Location = new System.Drawing.Point(115, 159);
this.labelTitleMovingAverage.Name = "labelTitleMovingAverage";
this.labelTitleMovingAverage.Size = new System.Drawing.Size(260, 28);
this.labelTitleMovingAverage.TabIndex = 211;
@ -202,7 +206,7 @@
this.labelFilter.Font = new System.Drawing.Font("Arial", 14F, System.Drawing.FontStyle.Bold);
this.labelFilter.InitVisible = true;
this.labelFilter.LineSpacing = 0F;
this.labelFilter.Location = new System.Drawing.Point(381, 143);
this.labelFilter.Location = new System.Drawing.Point(381, 125);
this.labelFilter.Name = "labelFilter";
this.labelFilter.Size = new System.Drawing.Size(120, 28);
this.labelFilter.TabIndex = 210;
@ -222,7 +226,7 @@
this.labelTitleFilter.ForeColor = System.Drawing.Color.White;
this.labelTitleFilter.InitVisible = true;
this.labelTitleFilter.LineSpacing = 0F;
this.labelTitleFilter.Location = new System.Drawing.Point(115, 143);
this.labelTitleFilter.Location = new System.Drawing.Point(115, 125);
this.labelTitleFilter.Name = "labelTitleFilter";
this.labelTitleFilter.Size = new System.Drawing.Size(260, 28);
this.labelTitleFilter.TabIndex = 209;
@ -242,7 +246,7 @@
this.labelConveyorLength.Font = new System.Drawing.Font("Arial", 14F, System.Drawing.FontStyle.Bold);
this.labelConveyorLength.InitVisible = true;
this.labelConveyorLength.LineSpacing = 0F;
this.labelConveyorLength.Location = new System.Drawing.Point(381, 98);
this.labelConveyorLength.Location = new System.Drawing.Point(381, 91);
this.labelConveyorLength.Name = "labelConveyorLength";
this.labelConveyorLength.Size = new System.Drawing.Size(120, 28);
this.labelConveyorLength.TabIndex = 208;
@ -263,7 +267,7 @@
this.labelTitleConveyorLength.ForeColor = System.Drawing.Color.White;
this.labelTitleConveyorLength.InitVisible = true;
this.labelTitleConveyorLength.LineSpacing = 0F;
this.labelTitleConveyorLength.Location = new System.Drawing.Point(115, 98);
this.labelTitleConveyorLength.Location = new System.Drawing.Point(115, 91);
this.labelTitleConveyorLength.Name = "labelTitleConveyorLength";
this.labelTitleConveyorLength.Size = new System.Drawing.Size(260, 28);
this.labelTitleConveyorLength.TabIndex = 207;
@ -447,7 +451,7 @@
this.labelTitleCommunicationOption.ForeColor = System.Drawing.Color.White;
this.labelTitleCommunicationOption.InitVisible = true;
this.labelTitleCommunicationOption.LineSpacing = 0F;
this.labelTitleCommunicationOption.Location = new System.Drawing.Point(115, 64);
this.labelTitleCommunicationOption.Location = new System.Drawing.Point(115, 57);
this.labelTitleCommunicationOption.Name = "labelTitleCommunicationOption";
this.labelTitleCommunicationOption.Size = new System.Drawing.Size(260, 28);
this.labelTitleCommunicationOption.TabIndex = 196;
@ -468,7 +472,7 @@
this.buttonCommunicationOption.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonCommunicationOption.DownImage")));
this.buttonCommunicationOption.GroupID = 0;
this.buttonCommunicationOption.InitVisible = true;
this.buttonCommunicationOption.Location = new System.Drawing.Point(381, 64);
this.buttonCommunicationOption.Location = new System.Drawing.Point(381, 57);
this.buttonCommunicationOption.Mode = SmartX.SmartButton.BUTTONMODE.PUSH;
this.buttonCommunicationOption.Name = "buttonCommunicationOption";
this.buttonCommunicationOption.NestedClickEventPrevent = false;
@ -490,7 +494,7 @@
// comboBoxEquipmentType
//
this.comboBoxEquipmentType.Font = new System.Drawing.Font("새굴림", 14F, System.Drawing.FontStyle.Bold);
this.comboBoxEquipmentType.Location = new System.Drawing.Point(381, 30);
this.comboBoxEquipmentType.Location = new System.Drawing.Point(381, 23);
this.comboBoxEquipmentType.Name = "comboBoxEquipmentType";
this.comboBoxEquipmentType.Size = new System.Drawing.Size(180, 28);
this.comboBoxEquipmentType.TabIndex = 190;
@ -589,7 +593,7 @@
this.labelTitleEquipmentType.ForeColor = System.Drawing.Color.White;
this.labelTitleEquipmentType.InitVisible = true;
this.labelTitleEquipmentType.LineSpacing = 0F;
this.labelTitleEquipmentType.Location = new System.Drawing.Point(115, 30);
this.labelTitleEquipmentType.Location = new System.Drawing.Point(115, 23);
this.labelTitleEquipmentType.Name = "labelTitleEquipmentType";
this.labelTitleEquipmentType.Size = new System.Drawing.Size(260, 28);
this.labelTitleEquipmentType.TabIndex = 117;
@ -599,6 +603,46 @@
this.labelTitleEquipmentType.Visible = false;
this.labelTitleEquipmentType.Wordwrap = false;
//
// labelMotorNum
//
this.labelMotorNum.BackColor = System.Drawing.SystemColors.Window;
this.labelMotorNum.BackPictureBox = null;
this.labelMotorNum.BackPictureBox1 = null;
this.labelMotorNum.BackPictureBox2 = null;
this.labelMotorNum.BorderColor = System.Drawing.Color.Black;
this.labelMotorNum.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelMotorNum.Font = new System.Drawing.Font("Arial", 14F, System.Drawing.FontStyle.Bold);
this.labelMotorNum.InitVisible = true;
this.labelMotorNum.LineSpacing = 0F;
this.labelMotorNum.Location = new System.Drawing.Point(381, 227);
this.labelMotorNum.Name = "labelMotorNum";
this.labelMotorNum.Size = new System.Drawing.Size(120, 28);
this.labelMotorNum.TabIndex = 216;
this.labelMotorNum.Text = "0";
this.labelMotorNum.TextHAlign = SmartX.SmartLabel.TextHorAlign.Right;
this.labelMotorNum.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle;
this.labelMotorNum.Wordwrap = true;
this.labelMotorNum.Click += new System.EventHandler(this.labelMotorNum_Click);
//
// labelTitleMotorNum
//
this.labelTitleMotorNum.BackPictureBox1 = null;
this.labelTitleMotorNum.BackPictureBox2 = this.smartGroupBox1;
this.labelTitleMotorNum.BorderColor = System.Drawing.Color.Black;
this.labelTitleMotorNum.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.labelTitleMotorNum.Font = new System.Drawing.Font("새굴림", 11F, System.Drawing.FontStyle.Bold);
this.labelTitleMotorNum.ForeColor = System.Drawing.Color.White;
this.labelTitleMotorNum.InitVisible = true;
this.labelTitleMotorNum.LineSpacing = 0F;
this.labelTitleMotorNum.Location = new System.Drawing.Point(115, 227);
this.labelTitleMotorNum.Name = "labelTitleMotorNum";
this.labelTitleMotorNum.Size = new System.Drawing.Size(260, 28);
this.labelTitleMotorNum.TabIndex = 215;
this.labelTitleMotorNum.Text = "모터개수(1~4)";
this.labelTitleMotorNum.TextHAlign = SmartX.SmartLabel.TextHorAlign.Left;
this.labelTitleMotorNum.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle;
this.labelTitleMotorNum.Wordwrap = true;
//
// ControlCenterEquipEngineer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -639,5 +683,7 @@
private SmartX.SmartLabel labelTitleFilter;
private SmartX.SmartLabel labelTitleBLDC;
private SmartX.SmartButton buttonBLDCUsing;
public SmartX.SmartLabel labelMotorNum;
private SmartX.SmartLabel labelTitleMotorNum;
}
}

View File

@ -325,6 +325,11 @@ namespace ITC81DB_0H.Controls
else
this.buttonBLDCUsing.ButtonDown();
// BLDC 모터 개수
value = item2.BLDCMotorNum.ToString();
if (this.labelMotorNum.Text != value)
this.labelMotorNum.Text = value;
// 옵션보드
index = int.Parse(parameter.OptionBoard.Trim());
if (this.comboBoxOptionBoard.SelectedIndex != index)
@ -497,6 +502,32 @@ namespace ITC81DB_0H.Controls
this.ParentForm.ParentForm.SaveSystemConfigurationFile1(this.ParentForm.ParentForm.SystemConfig1);
}
private void labelMotorNum_Click(object sender, EventArgs e)
{
string value = "", message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelMotorNum.Text, 1, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.IntValue < 1 || myKeyPad.IntValue > 4)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.labelMotorNum.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.ChildFormMenu.CenterSystemBLDCMotorSetting.VisibleMotorNum(myKeyPad.IntValue);
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.SystemConfig2.BLDCMotorNum = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2);
}
}
}
private void comboBoxOptionBoard_SelectedIndexChanged(object sender, EventArgs e)
{
string value = "";

View File

@ -19,6 +19,9 @@ namespace ITC81DB_0H.Controls
{
#region Field
private FormMenu m_ParentForm;
private string CommID;
private int MotorIndex;
#endregion
#region Constructor
@ -72,22 +75,47 @@ namespace ITC81DB_0H.Controls
}
private void DefaultSetting()
{
this.MotorIndex = 0;
this.CommID = "A";
this.comboBoxMotorPoleNum.Items.Clear();
this.comboBoxMotorPoleNum.Items.Add("3");
this.comboBoxMotorPoleNum.Items.Add("6");
this.comboBoxMotorPoleNum.Items.Add("9");
this.comboBoxMotorPoleNum.Items.Add("12");
this.comboBoxMotorPoleNum.Items.Add("15");
this.VisibleMotorNum(this.ParentForm.ParentForm.SystemConfig2.BLDCMotorNum);
}
public void UpdateParameter(BLDCMotorParameter item)
private void RefreshDisplay()
{
this.labelVersionMajor.Text = item.VersionMajor + ".";
this.labelVersionMinor.Text = item.VersionMinor + ".";
this.labelVersionBuild.Text = item.VersionBuild;
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, this.CommID,
CommunicationAddress.BLDCMotorParameterRead, "");
}
this.labelMotorRPM.Text = item.MotorRPM.ToString();
switch (item.MotorDirection)
public void VisibleMotorNum(int num)
{
Collection<SmartX.SmartButton> button = new Collection<SmartButton>();
button.Clear();
button.Add(this.buttonMotor1);
button.Add(this.buttonMotor2);
button.Add(this.buttonMotor3);
button.Add(this.buttonMotor4);
for (int i = num; i < FormMain.BLDCMotorNum; i++)
button[i].Visible = false;
}
public void UpdateParameter(int index, Collection<BLDCMotorParameter> items)
{
this.labelVersionMajor.Text = items[index].VersionMajor + ".";
this.labelVersionMinor.Text = items[index].VersionMinor + ".";
this.labelVersionBuild.Text = items[index].VersionBuild;
this.labelMotorRPM.Text = items[index].MotorRPM.ToString();
switch (items[index].MotorDirection)
{
case 0:
this.labelMotorDirectionRead.Text = "None";
@ -102,7 +130,7 @@ namespace ITC81DB_0H.Controls
this.labelMotorDirectionRead.Text = "None";
break;
}
switch (item.SelectOperMode)
switch (items[index].SelectOperMode)
{
case 0:
this.labelSelectOperMode.Text = "MCU";
@ -115,31 +143,88 @@ namespace ITC81DB_0H.Controls
break;
}
}
public void DisplayParameter(int index, Collection<BLDCMotorParameter> items)
{
this.labelMotorID.Text = items[index].MotorID.ToString();
this.labelMotorSpeed.Text = items[index].MotorSpeed.ToString();
this.comboBoxMotorPoleNum.SelectedIndex = items[index].PoleNum;
this.labelAttenuatorRatio.Text = items[index].AttenuatorRatio.ToString();
if (items[index].OperDirection == 1)
this.buttonMotorDirectionWrite.ButtonDown();
else
this.buttonMotorDirectionWrite.ButtonUp();
}
public void DisplayRefresh(SystemStatus status)
public void DisplayRefresh(SystemStatus status, Collection<BLDCMotorParameter> items)
{
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.SystemBLDCMotorSetting;
this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.Menu);
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.BLDCMotorParameterRead, "");
this.MotorIndex = 0;
this.CommID = "A";
this.labelMotorSpeed.Text = this.ParentForm.ParentForm.BLDCParameter.MotorSpeed.ToString();
this.comboBoxMotorPoleNum.SelectedIndex = this.ParentForm.ParentForm.BLDCParameter.PoleNum;
this.labelAttenuatorRatio.Text = this.ParentForm.ParentForm.BLDCParameter.AttenuatorRatio.ToString();
if (this.ParentForm.ParentForm.BLDCParameter.OperDirection == 1)
this.buttonMotorDirectionWrite.ButtonDown();
else
this.buttonMotorDirectionWrite.ButtonUp();
this.buttonMotor1.ButtonDown();
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, this.CommID,
CommunicationAddress.BLDCMotorParameterRead, "");
this.DisplayParameter(0, items);
}
#endregion
#region Event Handler
private void buttonRefresh_Click(object sender, EventArgs e)
private void buttonMotor_Click(object sender, EventArgs e)
{
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.BLDCMotorParameterRead, "");
SmartX.SmartButton button = sender as SmartX.SmartButton;
this.MotorIndex = int.Parse(button.Tag.ToString());
this.CommID = this.ParentForm.ParentForm.CurrentCommunicationID
(this.ParentForm.ParentForm.CollectionBLDCParameter[this.MotorIndex].MotorID);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, this.CommID,
CommunicationAddress.BLDCMotorParameterRead, "");
this.DisplayParameter(this.MotorIndex, this.ParentForm.ParentForm.CollectionBLDCParameter);
}
private void buttonRefresh_Click(object sender, EventArgs e)
{
this.RefreshDisplay();
}
private void buttonStart_Click(object sender, EventArgs e)
{
if(this.buttonStart.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
this.ParentForm.ParentForm.TransferData(CommunicationCommand.Start, this.CommID);
else
this.ParentForm.ParentForm.TransferData(CommunicationCommand.Stop, this.CommID);
}
private void labelMotorID_Click(object sender, EventArgs e)
{
string value = "", message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelMotorID.Text, 2, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.IntValue < 1 || myKeyPad.IntValue > 16)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, message);
myMsg.ShowDialog();
}
else
{
this.labelMotorID.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CollectionBLDCParameter[this.MotorIndex].MotorID = myKeyPad.IntValue;
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.SaveBLDCMotorFile(this.ParentForm.ParentForm.CollectionBLDCParameter);
this.ParentForm.ParentForm.TransferBLDCMotorData
(this.CommID, this.ParentForm.ParentForm.CollectionBLDCParameter[this.MotorIndex]);
}
}
}
private void labelMotorSpeed_Click(object sender, EventArgs e)
{
string value = "", message = "";
@ -157,11 +242,11 @@ namespace ITC81DB_0H.Controls
else
{
this.labelMotorSpeed.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.BLDCParameter.MotorSpeed = myKeyPad.IntValue;
this.ParentForm.ParentForm.CollectionBLDCParameter[this.MotorIndex].MotorSpeed = myKeyPad.IntValue;
value = Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.BLDCParameter.MotorSpeed.ToString());
this.ParentForm.ParentForm.SaveBLDCMotorFile(this.ParentForm.ParentForm.BLDCParameter);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard,
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.SaveBLDCMotorFile(this.ParentForm.ParentForm.CollectionBLDCParameter);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, this.CommID,
CommunicationAddress.BLDCMotorSpeed, value);
}
}
@ -170,11 +255,11 @@ namespace ITC81DB_0H.Controls
{
string value = "";
this.ParentForm.ParentForm.BLDCParameter.PoleNum = this.comboBoxMotorPoleNum.SelectedIndex;
this.ParentForm.ParentForm.CollectionBLDCParameter[this.MotorIndex].PoleNum = this.comboBoxMotorPoleNum.SelectedIndex;
value = Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.BLDCParameter.PoleNum.ToString());
this.ParentForm.ParentForm.SaveBLDCMotorFile(this.ParentForm.ParentForm.BLDCParameter);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.BLDCPoleNum, value);
value = Helper.StringZeroFillDigits4(this.comboBoxMotorPoleNum.SelectedIndex.ToString());
this.ParentForm.ParentForm.SaveBLDCMotorFile(this.ParentForm.ParentForm.CollectionBLDCParameter);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, this.CommID, CommunicationAddress.BLDCPoleNum, value);
}
private void labelAttenuatorRatio_Click(object sender, EventArgs e)
{
@ -193,11 +278,11 @@ namespace ITC81DB_0H.Controls
else
{
this.labelAttenuatorRatio.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.BLDCParameter.AttenuatorRatio = myKeyPad.IntValue;
this.ParentForm.ParentForm.CollectionBLDCParameter[this.MotorIndex].AttenuatorRatio = myKeyPad.IntValue;
value = Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.BLDCParameter.AttenuatorRatio.ToString());
this.ParentForm.ParentForm.SaveBLDCMotorFile(this.ParentForm.ParentForm.BLDCParameter);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.BLDCAttenuatorRatio, value);
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.SaveBLDCMotorFile(this.ParentForm.ParentForm.CollectionBLDCParameter);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, this.CommID, CommunicationAddress.BLDCAttenuatorRatio, value);
}
}
}
@ -206,14 +291,30 @@ namespace ITC81DB_0H.Controls
string value = "";
if (this.buttonMotorDirectionWrite.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
this.ParentForm.ParentForm.BLDCParameter.OperDirection = 1; // CCW
this.ParentForm.ParentForm.CollectionBLDCParameter[this.MotorIndex].OperDirection = 1; // CCW
else
this.ParentForm.ParentForm.BLDCParameter.OperDirection = 0; // CW
this.ParentForm.ParentForm.CollectionBLDCParameter[this.MotorIndex].OperDirection = 0; // CW
this.ParentForm.ParentForm.SaveBLDCMotorFile(this.ParentForm.ParentForm.BLDCParameter);
value = Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.BLDCParameter.OperDirection.ToString());
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.BLDCOperDirection, value);
}
this.ParentForm.ParentForm.SaveBLDCMotorFile(this.ParentForm.ParentForm.CollectionBLDCParameter);
value = Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CollectionBLDCParameter[this.MotorIndex].OperDirection.ToString());
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, this.CommID, CommunicationAddress.BLDCOperDirection, value);
this.RefreshDisplay();
}
private void buttonAlarmRead_Click(object sender, EventArgs e)
{
}
private void buttonAlarmReset_Click(object sender, EventArgs e)
{
this.ParentForm.ParentForm.TransferData(CommunicationCommand.MotorAlarmReset, this.CommID);
}
private void timer_Tick(object sender, EventArgs e)
{
}
#endregion
}
}

View File

@ -537,6 +537,10 @@ namespace ITC81DB_0H
public static readonly string SubBoard10 = "J";
public static readonly string SubBoard11 = "K";
public static readonly string SubBoard12 = "L";
public static readonly string SubBoard13 = "M";
public static readonly string SubBoard14 = "N";
public static readonly string SubBoard15 = "O";
public static readonly string SubBoard16 = "P";
public static readonly string SubBoardAll = "Z";
}
public class CommunicationAddress
@ -1294,6 +1298,8 @@ namespace ITC81DB_0H
private int m_FileNameExtension;
private int m_BLDCMotorNum;
private int m_HitachiRoomNumberEthernet;
private int m_MarkoprintLineNumberEthernet;
private bool m_IsMarkoprintDatePrintEthernet;
@ -1525,6 +1531,11 @@ namespace ITC81DB_0H
set { this.m_FileNameExtension = value; }
}
public int BLDCMotorNum
{
get { return this.m_BLDCMotorNum; }
set { this.m_BLDCMotorNum = value; }
}
public int HitachiRoomNumberEthernet
{
get { return this.m_HitachiRoomNumberEthernet; }
@ -1684,6 +1695,7 @@ namespace ITC81DB_0H
this.IsGroup5UsingRandomMode = false;
this.FileNameExtension = 0;
this.BLDCMotorNum = 3;
this.HitachiRoomNumberEthernet = 1;
this.MarkoprintLineNumberEthernet = 0;
@ -1759,7 +1771,7 @@ namespace ITC81DB_0H
public int DummyInt7;
public int DummyInt8;
public int DummyInt9;
public int DummyInt10;
public int BLDCMotorNum;
public int ModbusRTUSelectFunction;
public int ModbusRTUSlaveIDCOM1;
public int ModbusRTUSlaveIDCOM3;
@ -2909,6 +2921,8 @@ namespace ITC81DB_0H
public class BLDCMotorParameter
{
#region Field
private int m_MotorID;
private int m_CommBaudrate;
private int m_CommParityBit;
private int m_PWMDelay;
@ -2917,6 +2931,13 @@ namespace ITC81DB_0H
private int m_PoleNum;
private int m_AttenuatorRatio;
private int m_BootingStart;
private int m_PortUse;
private int m_Feedback;
private int m_InitDirection;
private int m_OperDirection;
private int m_SelectOperMode;
private string m_VersionMajor;
private string m_VersionMinor;
private string m_VersionBuild;
@ -2925,12 +2946,6 @@ namespace ITC81DB_0H
private int m_MotorDirection;
private string m_AttenuatorRPM;
private int m_BootingStart;
private int m_PortUse;
private int m_Feedback;
private int m_InitDirection;
private int m_OperDirection;
private int m_SelectOperMode;
#endregion
#region Constructor
@ -2941,6 +2956,12 @@ namespace ITC81DB_0H
#endregion
#region Property
public int MotorID
{
get { return this.m_MotorID; }
set { this.m_MotorID = value; }
}
public int CommBaudrate
{
get { return this.m_CommBaudrate; }
@ -2977,6 +2998,37 @@ namespace ITC81DB_0H
set { this.m_AttenuatorRatio = value; }
}
public int BootingStart
{
get { return this.m_BootingStart; }
set { this.m_BootingStart = value; }
}
public int PortUse
{
get { return this.m_PortUse; }
set { this.m_PortUse = value; }
}
public int Feedback
{
get { return this.m_Feedback; }
set { this.m_Feedback = value; }
}
public int InitDirection
{
get { return this.m_InitDirection; }
set { this.m_InitDirection = value; }
}
public int OperDirection
{
get { return this.m_OperDirection; }
set { this.m_OperDirection = value; }
}
public int SelectOperMode
{
get { return this.m_SelectOperMode; }
set { this.m_SelectOperMode = value; }
}
public string VersionMajor
{
get { return this.m_VersionMajor; }
@ -3012,42 +3064,13 @@ namespace ITC81DB_0H
get { return this.m_AttenuatorRPM; }
set { this.m_AttenuatorRPM = value; }
}
public int BootingStart
{
get { return this.m_BootingStart; }
set { this.m_BootingStart = value; }
}
public int PortUse
{
get { return this.m_PortUse; }
set { this.m_PortUse = value; }
}
public int Feedback
{
get { return this.m_Feedback; }
set { this.m_Feedback = value; }
}
public int InitDirection
{
get { return this.m_InitDirection; }
set { this.m_InitDirection = value; }
}
public int OperDirection
{
get { return this.m_OperDirection; }
set { this.m_OperDirection = value; }
}
public int SelectOperMode
{
get { return this.m_SelectOperMode; }
set { this.m_SelectOperMode = value; }
}
#endregion
#region Method
public void Initialization()
{
this.MotorID = 0;
this.CommBaudrate = 0;
this.CommParityBit = 0;
this.PWMDelay = 5;
@ -3056,6 +3079,13 @@ namespace ITC81DB_0H
this.PoleNum = 1;
this.AttenuatorRatio = 5;
this.BootingStart = 0;
this.PortUse = 1;
this.Feedback = 0;
this.InitDirection = 0;
this.OperDirection = 0;
this.SelectOperMode = 0;
this.VersionMajor = "01";
this.VersionMinor = "00";
this.VersionBuild = "00";
@ -3063,21 +3093,16 @@ namespace ITC81DB_0H
this.MotorRPM = "0";
this.MotorDirection = 1;
this.AttenuatorRPM = "0";
this.BootingStart = 0;
this.PortUse = 1;
this.Feedback = 0;
this.InitDirection = 0;
this.OperDirection = 0;
this.SelectOperMode = 0;
}
#endregion
}
#endregion
#region StructBLDCMotorParameter1 - Holding Register
#region StructBLDCMotorParameter
[StructLayout(LayoutKind.Sequential)]
public struct StructBLDCMotorParameter1
public struct StructBLDCMotorParameter
{
public int MotorID;
public int CommBaudrate;
public int CommParityBit;
public int PWMDelay;
@ -3101,11 +3126,6 @@ namespace ITC81DB_0H
public int DummyInt13;
public int DummyInt14;
public int DummyInt15;
public int DummyInt16;
public int DummyInt17;
public int DummyInt18;
public int DummyInt19;
public int DummyInt20;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString1;
@ -3127,59 +3147,49 @@ namespace ITC81DB_0H
public string DummyString9;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString10;
}
#endregion
#region StructBLDCMotorParameter2 - Coils
[StructLayout(LayoutKind.Sequential)]
public struct StructBLDCMotorParameter2
{
public int BootingStart;
public int PortUse;
public int Feedback;
public int InitDirection;
public int OperDirection;
public int DummyInt1;
public int DummyInt2;
public int DummyInt3;
public int DummyInt4;
public int DummyInt5;
public int DummyInt6;
public int DummyInt7;
public int DummyInt8;
public int DummyInt9;
public int DummyInt10;
public int DummyInt11;
public int DummyInt12;
public int DummyInt13;
public int DummyInt14;
public int DummyInt15;
public int DummyInt16;
public int DummyInt17;
public int DummyInt18;
public int DummyInt19;
public int DummyInt20;
public int DummyInt21;
public int DummyInt22;
public int DummyInt23;
public int DummyInt24;
public int DummyInt25;
public int DummyInt26;
public int DummyInt27;
public int DummyInt28;
public int DummyInt29;
public int DummyInt30;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString1;
public string DummyString11;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString2;
public string DummyString12;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString3;
public string DummyString13;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString4;
public string DummyString14;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString5;
public string DummyString15;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString6;
public string DummyString16;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString7;
public string DummyString17;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString8;
public string DummyString18;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString9;
public string DummyString19;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string DummyString10;
public string DummyString20;
}
#endregion

View File

@ -35,6 +35,8 @@ namespace ITC81DB_0H.Forms
public bool IsCurrentKeyKorean;
public int SensorDetectingTime;
public double OverloadWeight;
public static readonly int BLDCMotorNum = 4;
private int BLDCMotorIndex;
#region 통신관련
// OPT2
@ -108,8 +110,6 @@ namespace ITC81DB_0H.Forms
public SystemParameter3 CurrentSystemParameter3;
// 시스템파라미터4
public SystemParameter4 CurrentSystemParameter4;
// BLDC 파라미터
public BLDCMotorParameter BLDCParameter;
// 시스템정보 파라미터
public SystemInformation2 SystemInfo2;
@ -142,6 +142,8 @@ namespace ITC81DB_0H.Forms
public Collection<WeightData> CollectionWeightData;
// 종근당 중량 데이터 버퍼
private Collection<DataBackupOPT1> CollectionBufferWeightData;
// BLDC 파라미터
public Collection<BLDCMotorParameter> CollectionBLDCParameter;
// 리젝데이터
private JudgmentResult CurrentJudgmentResult;
@ -279,6 +281,7 @@ namespace ITC81DB_0H.Forms
this.FlagThreadMessage1 = false;
this.IsCurrentKeyKorean = false;
this.OverloadWeight = 700.00;
this.BLDCMotorIndex = 0;
#region 통신관련
this.CurrentOPT2COM1 = new SerialOPT2();
@ -335,7 +338,6 @@ namespace ITC81DB_0H.Forms
this.CurrentSystemParameter2 = new SystemParameter2();
this.CurrentSystemParameter3 = new SystemParameter3();
this.CurrentSystemParameter4 = new SystemParameter4();
this.BLDCParameter = new BLDCMotorParameter();
//this.CurrentAutoZeroItem = new SystemParameter4();
this.SystemInfo2 = new SystemInformation2();
this.SystemInfo3 = new SystemInformation3();
@ -344,12 +346,15 @@ namespace ITC81DB_0H.Forms
this.CollectionBufferWeightData = new Collection<DataBackupOPT1>();
this.UpdateForMain = new UpdateForMainBoard();
this.CurrentJudgmentResult = new JudgmentResult();
this.CollectionBLDCParameter = new Collection<BLDCMotorParameter>();
for (int i = 0; i < BLDCMotorNum; i++)
this.CollectionBLDCParameter.Add(new BLDCMotorParameter());
this.CollectionProductItem = new Collection<ProductItem>();
this.CollectionJudgmentItem = new Collection<JudgmentSetItem>();
this.CollectionWeightData = new Collection<WeightData>();
this.CurrentJudgmentResult = new JudgmentResult();
for (int i = 0; i < this.ProductCount; i++)
{
this.CollectionProductItem.Add(new ProductItem());
@ -2035,7 +2040,7 @@ namespace ITC81DB_0H.Forms
// 파라미터 읽기 응답
private int ReceiveCommandPR0(string lane, string address, string receiveData)
{
int ret = 0, iValue = 0;
int ret = 0, iValue = 0, index = 0;
string sValue = "";
try
@ -2260,18 +2265,24 @@ namespace ITC81DB_0H.Forms
break;
case "9516":
#region Value Assign
this.BLDCParameter.VersionMajor = receiveData.Substring(0, 4);
this.BLDCParameter.VersionMinor = receiveData.Substring(4, 4);
this.BLDCParameter.VersionBuild = receiveData.Substring(8, 4);
this.BLDCParameter.Frequency = receiveData.Substring(12, 4);
this.BLDCParameter.MotorRPM = receiveData.Substring(16, 4);
this.BLDCParameter.MotorDirection = int.Parse(receiveData.Substring(20, 4));
this.BLDCParameter.AttenuatorRPM = receiveData.Substring(24, 4);
this.BLDCParameter.SelectOperMode = int.Parse(receiveData.Substring(28, 4));
for (int i = 0; i < BLDCMotorNum; i++)
{
if (this.CurrentMotorID(lane) == this.CollectionBLDCParameter[i].MotorID)
index = i;
}
this.CollectionBLDCParameter[index].VersionMajor = receiveData.Substring(0, 4);
this.CollectionBLDCParameter[index].VersionMinor = receiveData.Substring(4, 4);
this.CollectionBLDCParameter[index].VersionBuild = receiveData.Substring(8, 4);
this.CollectionBLDCParameter[index].Frequency = receiveData.Substring(12, 4);
this.CollectionBLDCParameter[index].MotorRPM = receiveData.Substring(16, 4);
this.CollectionBLDCParameter[index].MotorDirection = int.Parse(receiveData.Substring(20, 4));
this.CollectionBLDCParameter[index].AttenuatorRPM = receiveData.Substring(24, 4);
this.CollectionBLDCParameter[index].SelectOperMode = int.Parse(receiveData.Substring(28, 4));
#endregion
if (this.ChildFormMenu.CenterSystemBLDCMotorSetting != null)
this.ChildFormMenu.CenterSystemBLDCMotorSetting.UpdateParameter(this.BLDCParameter);
this.ChildFormMenu.CenterSystemBLDCMotorSetting.UpdateParameter(index, this.CollectionBLDCParameter);
break;
default:
break;
@ -2389,7 +2400,11 @@ namespace ITC81DB_0H.Forms
break;
case "9023":
if (response == DataStore.ResponseData.ACK)
this.TransferBLDCMotorData();
{
this.TransferBLDCMotorData(this.CurrentCommunicationID(this.BLDCMotorIndex),
this.CollectionBLDCParameter[this.BLDCMotorIndex]);
this.BLDCMotorIndex++;
}
break;
case "9033":
if (response == DataStore.ResponseData.ACK)
@ -2400,9 +2415,19 @@ namespace ITC81DB_0H.Forms
case "9040":
if (response == DataStore.ResponseData.ACK)
{
if (this.SystemConfig2.IsUsingRandomMode == true)
this.SystemConfig1.ProductNumber = 996;
this.TransferProductParameter(this.SystemConfig1.ProductNumber);
if (this.BLDCMotorIndex < BLDCMotorNum)
{
this.TransferBLDCMotorData(this.CurrentCommunicationID(this.BLDCMotorIndex),
this.CollectionBLDCParameter[this.BLDCMotorIndex]);
this.BLDCMotorIndex++;
}
else
{
this.BLDCMotorIndex = 0;
if (this.SystemConfig2.IsUsingRandomMode == true)
this.SystemConfig1.ProductNumber = 996;
this.TransferProductParameter(this.SystemConfig1.ProductNumber);
}
}
break;
default:
@ -7040,7 +7065,7 @@ namespace ITC81DB_0H.Forms
structItem.DummyInt7 = 0;
structItem.DummyInt8 = 0;
structItem.DummyInt9 = 0;
structItem.DummyInt10 = 0;
structItem.BLDCMotorNum = this.SystemConfig2.BLDCMotorNum;
structItem.ModbusRTUSelectFunction = this.SystemConfig2.ModbusRTUSelectFunction;
structItem.ModbusRTUSlaveIDCOM1 = this.SystemConfig2.ModbusRTUSlaveIDCOM1;
structItem.ModbusRTUSlaveIDCOM3 = this.SystemConfig2.ModbusRTUSlaveIDCOM3;
@ -7145,7 +7170,7 @@ namespace ITC81DB_0H.Forms
structItem.DummyInt7 = 0;
structItem.DummyInt8 = 0;
structItem.DummyInt9 = 0;
structItem.DummyInt10 = 0;
structItem.BLDCMotorNum = item.BLDCMotorNum;
structItem.ModbusRTUSelectFunction = item.ModbusRTUSelectFunction;
structItem.ModbusRTUSlaveIDCOM1 = item.ModbusRTUSlaveIDCOM1;
structItem.ModbusRTUSlaveIDCOM3 = item.ModbusRTUSlaveIDCOM3;
@ -7257,6 +7282,7 @@ namespace ITC81DB_0H.Forms
this.SystemConfig2.Barcode = structItem.Barcode;
this.SystemConfig2.FileNameExtension = structItem.FileNameExtension;
this.SystemConfig2.BLDCMotorNum = structItem.BLDCMotorNum;
this.SystemConfig2.EthernetPort = structItem.EthernetPort;
this.SystemConfig2.EthernetCommMode = structItem.EthernetCommMode;
this.SystemConfig2.EthernetOperationMode = structItem.EthernetOperationMode;
@ -7292,101 +7318,216 @@ namespace ITC81DB_0H.Forms
#endregion
#region BLDCMotorParameter
public int CurrentMotorID(string lane)
{
int motorID = 0;
switch (lane)
{
case "A":
motorID = 1;
break;
case "B":
motorID = 2;
break;
case "C":
motorID = 3;
break;
case "D":
motorID = 4;
break;
case "E":
motorID = 5;
break;
case "F":
motorID = 6;
break;
case "G":
motorID = 7;
break;
case "H":
motorID = 8;
break;
case "I":
motorID = 9;
break;
case "J":
motorID = 10;
break;
case "K":
motorID = 11;
break;
case "L":
motorID = 12;
break;
case "M":
motorID =13;
break;
case "N":
motorID = 14;
break;
case "O":
motorID = 15;
break;
case "P":
motorID = 16;
break;
default:
motorID = 1;
break;
}
return motorID;
}
public string CurrentCommunicationID(int num)
{
string ID = "A";
switch (num)
{
case 1:
ID = "A";
break;
case 2:
ID = "B";
break;
case 3:
ID = "C";
break;
case 4:
ID = "D";
break;
case 5:
ID = "E";
break;
case 6:
ID = "F";
break;
case 7:
ID = "G";
break;
case 8:
ID = "H";
break;
case 9:
ID = "I";
break;
case 10:
ID = "J";
break;
case 11:
ID = "K";
break;
case 12:
ID = "L";
break;
case 13:
ID = "M";
break;
case 14:
ID = "N";
break;
case 15:
ID = "O";
break;
case 16:
ID = "P";
break;
default:
ID = "A";
break;
}
return ID;
}
private void CreateBLDCMotorParameter()
{
StructBLDCMotorParameter1 structItem1;
StructBLDCMotorParameter2 structItem2;
StructBLDCMotorParameter structItem;
this.BLDCParameter.Initialization();
structItem1.CommBaudrate = this.BLDCParameter.CommBaudrate;
structItem1.CommParityBit = this.BLDCParameter.CommParityBit;
structItem1.PWMDelay = this.BLDCParameter.PWMDelay;
structItem1.FeedbackDeviation = this.BLDCParameter.FeedbackDeviation;
structItem1.MotorSpeed = this.BLDCParameter.MotorSpeed;
structItem1.PoleNum = this.BLDCParameter.PoleNum;
structItem1.AttenuatorRatio = this.BLDCParameter.AttenuatorRatio;
for (int i = 0; i < BLDCMotorNum; i++)
{
this.CollectionBLDCParameter[i].Initialization();
structItem1.DummyInt1 = 0;
structItem1.DummyInt2 = 0;
structItem1.DummyInt3 = 0;
structItem1.DummyInt4 = 0;
structItem1.DummyInt5 = 0;
structItem1.DummyInt6 = 0;
structItem1.DummyInt7 = 0;
structItem1.DummyInt8 = 0;
structItem1.DummyInt9 = 0;
structItem1.DummyInt10 = 0;
structItem1.DummyInt11 = 0;
structItem1.DummyInt12 = 0;
structItem1.DummyInt13 = 0;
structItem1.DummyInt14 = 0;
structItem1.DummyInt15 = 0;
structItem1.DummyInt16 = 0;
structItem1.DummyInt17 = 0;
structItem1.DummyInt18 = 0;
structItem1.DummyInt19 = 0;
structItem1.DummyInt20 = 0;
structItem.MotorID = this.CollectionBLDCParameter[i].MotorID;
structItem1.DummyString1 = "0";
structItem1.DummyString2 = "0";
structItem1.DummyString3 = "0";
structItem1.DummyString4 = "0";
structItem1.DummyString5 = "0";
structItem1.DummyString6 = "0";
structItem1.DummyString7 = "0";
structItem1.DummyString8 = "0";
structItem1.DummyString9 = "0";
structItem1.DummyString10 = "0";
this.smartFileIO.WriteStructure(structItem1, 0);
structItem.CommBaudrate = this.CollectionBLDCParameter[i].CommBaudrate;
structItem.CommParityBit = this.CollectionBLDCParameter[i].CommParityBit;
structItem.PWMDelay = this.CollectionBLDCParameter[i].PWMDelay;
structItem.FeedbackDeviation = this.CollectionBLDCParameter[i].FeedbackDeviation;
structItem.MotorSpeed = this.CollectionBLDCParameter[i].MotorSpeed;
structItem.PoleNum = this.CollectionBLDCParameter[i].PoleNum;
structItem.AttenuatorRatio = this.CollectionBLDCParameter[i].AttenuatorRatio;
structItem2.BootingStart = this.BLDCParameter.BootingStart;
structItem2.PortUse = this.BLDCParameter.PortUse;
structItem2.Feedback = this.BLDCParameter.Feedback;
structItem2.InitDirection = this.BLDCParameter.InitDirection;
structItem2.OperDirection = this.BLDCParameter.OperDirection;
structItem.DummyInt1 = 0;
structItem.DummyInt2 = 0;
structItem.DummyInt3 = 0;
structItem.DummyInt4 = 0;
structItem.DummyInt5 = 0;
structItem.DummyInt6 = 0;
structItem.DummyInt7 = 0;
structItem.DummyInt8 = 0;
structItem.DummyInt9 = 0;
structItem.DummyInt10 = 0;
structItem.DummyInt11 = 0;
structItem.DummyInt12 = 0;
structItem.DummyInt13 = 0;
structItem.DummyInt14 = 0;
structItem.DummyInt15 = 0;
structItem2.DummyInt1 = 0;
structItem2.DummyInt2 = 0;
structItem2.DummyInt3 = 0;
structItem2.DummyInt4 = 0;
structItem2.DummyInt5 = 0;
structItem2.DummyInt6 = 0;
structItem2.DummyInt7 = 0;
structItem2.DummyInt8 = 0;
structItem2.DummyInt9 = 0;
structItem2.DummyInt10 = 0;
structItem2.DummyInt11 = 0;
structItem2.DummyInt12 = 0;
structItem2.DummyInt13 = 0;
structItem2.DummyInt14 = 0;
structItem2.DummyInt15 = 0;
structItem2.DummyInt16 = 0;
structItem2.DummyInt17 = 0;
structItem2.DummyInt18 = 0;
structItem2.DummyInt19 = 0;
structItem2.DummyInt20 = 0;
structItem.DummyString1 = "0";
structItem.DummyString2 = "0";
structItem.DummyString3 = "0";
structItem.DummyString4 = "0";
structItem.DummyString5 = "0";
structItem.DummyString6 = "0";
structItem.DummyString7 = "0";
structItem.DummyString8 = "0";
structItem.DummyString9 = "0";
structItem.DummyString10 = "0";
structItem2.DummyString1 = "0";
structItem2.DummyString2 = "0";
structItem2.DummyString3 = "0";
structItem2.DummyString4 = "0";
structItem2.DummyString5 = "0";
structItem2.DummyString6 = "0";
structItem2.DummyString7 = "0";
structItem2.DummyString8 = "0";
structItem2.DummyString9 = "0";
structItem2.DummyString10 = "0";
structItem.BootingStart = this.CollectionBLDCParameter[i].BootingStart;
structItem.PortUse = this.CollectionBLDCParameter[i].PortUse;
structItem.Feedback = this.CollectionBLDCParameter[i].Feedback;
structItem.InitDirection = this.CollectionBLDCParameter[i].InitDirection;
structItem.OperDirection = this.CollectionBLDCParameter[i].OperDirection;
this.smartFileIO.WriteStructure(structItem2, 1);
structItem.DummyInt16 = 0;
structItem.DummyInt17 = 0;
structItem.DummyInt18 = 0;
structItem.DummyInt19 = 0;
structItem.DummyInt20 = 0;
structItem.DummyInt21 = 0;
structItem.DummyInt22 = 0;
structItem.DummyInt23 = 0;
structItem.DummyInt24 = 0;
structItem.DummyInt25 = 0;
structItem.DummyInt26 = 0;
structItem.DummyInt27 = 0;
structItem.DummyInt28 = 0;
structItem.DummyInt29 = 0;
structItem.DummyInt30 = 0;
structItem.DummyString11 = "0";
structItem.DummyString12 = "0";
structItem.DummyString13 = "0";
structItem.DummyString14 = "0";
structItem.DummyString15 = "0";
structItem.DummyString16 = "0";
structItem.DummyString17 = "0";
structItem.DummyString18 = "0";
structItem.DummyString19 = "0";
structItem.DummyString20 = "0";
this.smartFileIO.WriteStructure(structItem, i);
}
}
public void SaveBLDCMotorFile(BLDCMotorParameter item)
public void SaveBLDCMotorFile(BLDCMotorParameter item, int index)
{
string fullFilePath = "";
bool fileCheck = false;
StructBLDCMotorParameter1 structItem1;
StructBLDCMotorParameter2 structItem2;
StructBLDCMotorParameter structItem;
fullFilePath = this.PathSDCardSystemFile1Folder + "BLDCMotorItem.cfg";
this.smartFileIO.FilePathName = fullFilePath;
@ -7403,95 +7544,185 @@ namespace ITC81DB_0H.Forms
this.CreateBLDCMotorParameter();
}
structItem1.CommBaudrate = item.CommBaudrate;
structItem1.CommParityBit = item.CommParityBit;
structItem1.PWMDelay = item.PWMDelay;
structItem1.FeedbackDeviation = item.FeedbackDeviation;
structItem1.MotorSpeed = item.MotorSpeed;
structItem1.PoleNum = item.PoleNum;
structItem1.AttenuatorRatio = item.AttenuatorRatio;
structItem.MotorID = item.MotorID;
structItem1.DummyInt1 = 0;
structItem1.DummyInt2 = 0;
structItem1.DummyInt3 = 0;
structItem1.DummyInt4 = 0;
structItem1.DummyInt5 = 0;
structItem1.DummyInt6 = 0;
structItem1.DummyInt7 = 0;
structItem1.DummyInt8 = 0;
structItem1.DummyInt9 = 0;
structItem1.DummyInt10 = 0;
structItem1.DummyInt11 = 0;
structItem1.DummyInt12 = 0;
structItem1.DummyInt13 = 0;
structItem1.DummyInt14 = 0;
structItem1.DummyInt15 = 0;
structItem1.DummyInt16 = 0;
structItem1.DummyInt17 = 0;
structItem1.DummyInt18 = 0;
structItem1.DummyInt19 = 0;
structItem1.DummyInt20 = 0;
structItem.CommBaudrate = item.CommBaudrate;
structItem.CommParityBit = item.CommParityBit;
structItem.PWMDelay = item.PWMDelay;
structItem.FeedbackDeviation = item.FeedbackDeviation;
structItem.MotorSpeed = item.MotorSpeed;
structItem.PoleNum = item.PoleNum;
structItem.AttenuatorRatio = item.AttenuatorRatio;
structItem1.DummyString1 = "0";
structItem1.DummyString2 = "0";
structItem1.DummyString3 = "0";
structItem1.DummyString4 = "0";
structItem1.DummyString5 = "0";
structItem1.DummyString6 = "0";
structItem1.DummyString7 = "0";
structItem1.DummyString8 = "0";
structItem1.DummyString9 = "0";
structItem1.DummyString10 = "0";
structItem.DummyInt1 = 0;
structItem.DummyInt2 = 0;
structItem.DummyInt3 = 0;
structItem.DummyInt4 = 0;
structItem.DummyInt5 = 0;
structItem.DummyInt6 = 0;
structItem.DummyInt7 = 0;
structItem.DummyInt8 = 0;
structItem.DummyInt9 = 0;
structItem.DummyInt10 = 0;
structItem.DummyInt11 = 0;
structItem.DummyInt12 = 0;
structItem.DummyInt13 = 0;
structItem.DummyInt14 = 0;
structItem.DummyInt15 = 0;
this.smartFileIO.WriteStructure(structItem1, 0);
structItem.DummyString1 = "0";
structItem.DummyString2 = "0";
structItem.DummyString3 = "0";
structItem.DummyString4 = "0";
structItem.DummyString5 = "0";
structItem.DummyString6 = "0";
structItem.DummyString7 = "0";
structItem.DummyString8 = "0";
structItem.DummyString9 = "0";
structItem.DummyString10 = "0";
structItem2.BootingStart = item.BootingStart;
structItem2.PortUse = item.PortUse;
structItem2.Feedback = item.Feedback;
structItem2.InitDirection = item.InitDirection;
structItem2.OperDirection = item.OperDirection;
structItem.BootingStart = item.BootingStart;
structItem.PortUse = item.PortUse;
structItem.Feedback = item.Feedback;
structItem.InitDirection = item.InitDirection;
structItem.OperDirection = item.OperDirection;
structItem2.DummyInt1 = 0;
structItem2.DummyInt2 = 0;
structItem2.DummyInt3 = 0;
structItem2.DummyInt4 = 0;
structItem2.DummyInt5 = 0;
structItem2.DummyInt6 = 0;
structItem2.DummyInt7 = 0;
structItem2.DummyInt8 = 0;
structItem2.DummyInt9 = 0;
structItem2.DummyInt10 = 0;
structItem2.DummyInt11 = 0;
structItem2.DummyInt12 = 0;
structItem2.DummyInt13 = 0;
structItem2.DummyInt14 = 0;
structItem2.DummyInt15 = 0;
structItem2.DummyInt16 = 0;
structItem2.DummyInt17 = 0;
structItem2.DummyInt18 = 0;
structItem2.DummyInt19 = 0;
structItem2.DummyInt20 = 0;
structItem.DummyInt16 = 0;
structItem.DummyInt17 = 0;
structItem.DummyInt18 = 0;
structItem.DummyInt19 = 0;
structItem.DummyInt20 = 0;
structItem.DummyInt21 = 0;
structItem.DummyInt22 = 0;
structItem.DummyInt23 = 0;
structItem.DummyInt24 = 0;
structItem.DummyInt25 = 0;
structItem.DummyInt26 = 0;
structItem.DummyInt27 = 0;
structItem.DummyInt28 = 0;
structItem.DummyInt29 = 0;
structItem.DummyInt30 = 0;
structItem2.DummyString1 = "0";
structItem2.DummyString2 = "0";
structItem2.DummyString3 = "0";
structItem2.DummyString4 = "0";
structItem2.DummyString5 = "0";
structItem2.DummyString6 = "0";
structItem2.DummyString7 = "0";
structItem2.DummyString8 = "0";
structItem2.DummyString9 = "0";
structItem2.DummyString10 = "0";
structItem.DummyString11 = "0";
structItem.DummyString12 = "0";
structItem.DummyString13 = "0";
structItem.DummyString14 = "0";
structItem.DummyString15 = "0";
structItem.DummyString16 = "0";
structItem.DummyString17 = "0";
structItem.DummyString18 = "0";
structItem.DummyString19 = "0";
structItem.DummyString20 = "0";
this.smartFileIO.WriteStructure_Begin(structItem, index);
this.smartFileIO.WriteStructure_End();
this.smartFileIO.WriteStructure(structItem2, 1);
this.smartFileIO.Close();
}
public void LoadBLDCMotorFile()
public void SaveBLDCMotorFile(Collection<BLDCMotorParameter> items)
{
string fullFilePath = "";
bool fileCheck = false;
StructBLDCMotorParameter structItem;
fullFilePath = this.PathSDCardSystemFile1Folder + "BLDCMotorItem.cfg";
this.smartFileIO.FilePathName = fullFilePath;
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
this.smartFileIO.Open(this.BufferSmartUart);
else
{
this.smartFileIO.Open(this.BufferSmartUart);
this.CreateBLDCMotorParameter();
}
for (int i = 0; i < BLDCMotorNum; i++)
{
structItem.MotorID = items[i].MotorID;
structItem.CommBaudrate = items[i].CommBaudrate;
structItem.CommParityBit = items[i].CommParityBit;
structItem.PWMDelay = items[i].PWMDelay;
structItem.FeedbackDeviation = items[i].FeedbackDeviation;
structItem.MotorSpeed = items[i].MotorSpeed;
structItem.PoleNum = items[i].PoleNum;
structItem.AttenuatorRatio = items[i].AttenuatorRatio;
structItem.DummyInt1 = 0;
structItem.DummyInt2 = 0;
structItem.DummyInt3 = 0;
structItem.DummyInt4 = 0;
structItem.DummyInt5 = 0;
structItem.DummyInt6 = 0;
structItem.DummyInt7 = 0;
structItem.DummyInt8 = 0;
structItem.DummyInt9 = 0;
structItem.DummyInt10 = 0;
structItem.DummyInt11 = 0;
structItem.DummyInt12 = 0;
structItem.DummyInt13 = 0;
structItem.DummyInt14 = 0;
structItem.DummyInt15 = 0;
structItem.DummyString1 = "0";
structItem.DummyString2 = "0";
structItem.DummyString3 = "0";
structItem.DummyString4 = "0";
structItem.DummyString5 = "0";
structItem.DummyString6 = "0";
structItem.DummyString7 = "0";
structItem.DummyString8 = "0";
structItem.DummyString9 = "0";
structItem.DummyString10 = "0";
structItem.BootingStart = items[i].BootingStart;
structItem.PortUse = items[i].PortUse;
structItem.Feedback = items[i].Feedback;
structItem.InitDirection = items[i].InitDirection;
structItem.OperDirection = items[i].OperDirection;
structItem.DummyInt16 = 0;
structItem.DummyInt17 = 0;
structItem.DummyInt18 = 0;
structItem.DummyInt19 = 0;
structItem.DummyInt20 = 0;
structItem.DummyInt21 = 0;
structItem.DummyInt22 = 0;
structItem.DummyInt23 = 0;
structItem.DummyInt24 = 0;
structItem.DummyInt25 = 0;
structItem.DummyInt26 = 0;
structItem.DummyInt27 = 0;
structItem.DummyInt28 = 0;
structItem.DummyInt29 = 0;
structItem.DummyInt30 = 0;
structItem.DummyString11 = "0";
structItem.DummyString12 = "0";
structItem.DummyString13 = "0";
structItem.DummyString14 = "0";
structItem.DummyString15 = "0";
structItem.DummyString16 = "0";
structItem.DummyString17 = "0";
structItem.DummyString18 = "0";
structItem.DummyString19 = "0";
structItem.DummyString20 = "0";
this.smartFileIO.WriteStructure_Begin(structItem, i);
}
this.smartFileIO.WriteStructure_End();
this.smartFileIO.Close();
}
public void LoadBLDCMotorFile(ref Collection<BLDCMotorParameter> items)
{
string fullFilePath = "", value = "";
bool fileCheck = false;
StructBLDCMotorParameter1 structItem1;
StructBLDCMotorParameter2 structItem2;
StructBLDCMotorParameter structItem;
fullFilePath = this.PathSDCardSystemFile1Folder + "BLDCMotorItem.cfg";
this.smartFileIO.FilePathName = fullFilePath;
@ -7510,23 +7741,29 @@ namespace ITC81DB_0H.Forms
try
{
structItem1 = (StructBLDCMotorParameter1)this.smartFileIO.ReadStructure(0, typeof(StructBLDCMotorParameter1));
if (this.smartFileIO.ReadStructureAllBuffer() == true)
{
for (int i = 0; i < BLDCMotorNum; i++)
{
structItem = (StructBLDCMotorParameter)this.smartFileIO.ReadStructureBuffer(typeof(StructBLDCMotorParameter), i);
this.BLDCParameter.CommBaudrate = structItem1.CommBaudrate;
this.BLDCParameter.CommParityBit = structItem1.CommParityBit;
this.BLDCParameter.PWMDelay = structItem1.PWMDelay;
this.BLDCParameter.FeedbackDeviation = structItem1.FeedbackDeviation;
this.BLDCParameter.MotorSpeed = structItem1.MotorSpeed;
this.BLDCParameter.PoleNum = structItem1.PoleNum;
this.BLDCParameter.AttenuatorRatio = structItem1.AttenuatorRatio;
items[i].MotorID = structItem.MotorID;
structItem2 = (StructBLDCMotorParameter2)this.smartFileIO.ReadStructure(1, typeof(StructBLDCMotorParameter2));
items[i].CommBaudrate = structItem.CommBaudrate;
items[i].CommParityBit = structItem.CommParityBit;
items[i].PWMDelay = structItem.PWMDelay;
items[i].FeedbackDeviation = structItem.FeedbackDeviation;
items[i].MotorSpeed = structItem.MotorSpeed;
items[i].PoleNum = structItem.PoleNum;
items[i].AttenuatorRatio = structItem.AttenuatorRatio;
this.BLDCParameter.BootingStart = structItem2.BootingStart;
this.BLDCParameter.PortUse = structItem2.PortUse;
this.BLDCParameter.Feedback = structItem2.Feedback;
this.BLDCParameter.InitDirection = structItem2.InitDirection;
this.BLDCParameter.OperDirection = structItem2.OperDirection;
items[i].BootingStart = structItem.BootingStart;
items[i].PortUse = structItem.PortUse;
items[i].Feedback = structItem.Feedback;
items[i].InitDirection = structItem.InitDirection;
items[i].OperDirection = structItem.OperDirection;
}
}
}
catch
{
@ -7797,22 +8034,22 @@ namespace ITC81DB_0H.Forms
this.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.ParameterCount, sb.ToString());
}
public void TransferBLDCMotorData()
public void TransferBLDCMotorData(string ID, BLDCMotorParameter item)
{
StringBuilder sb = new StringBuilder();
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.CommBaudrate)); // 메인보드와의 통신 Baudrate(4)
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.CommParityBit)); // 메인보드와의 통신 Parity bit(4)
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.PWMDelay)); // PWM 변화 속도(4)
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.FeedbackDeviation)); // Feedback 구동을 위한 변화 편차(4)
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.MotorSpeed)); // Motor 속도(4)
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.PoleNum)); // BLDC 모터 Pole 수(4)
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.AttenuatorRatio)); // 감속기 비율(4)
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.BootingStart)); // 부팅 시 자동 구동 여부(4)
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.PortUse)); // 타 Port 모터 사용 여부(4)
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.Feedback)); // 모터 구동 중 피드백 제어 여부(4)
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.InitDirection)); // 초기 모터 방향(4)
sb.Append(Helper.StringZeroFillDigits4(this.BLDCParameter.OperDirection)); // 구동 중 모터 방향(4)
sb.Append(Helper.StringZeroFillDigits4(item.CommBaudrate)); // 메인보드와의 통신 Baudrate(4)
sb.Append(Helper.StringZeroFillDigits4(item.CommParityBit)); // 메인보드와의 통신 Parity bit(4)
sb.Append(Helper.StringZeroFillDigits4(item.PWMDelay)); // PWM 변화 속도(4)
sb.Append(Helper.StringZeroFillDigits4(item.FeedbackDeviation)); // Feedback 구동을 위한 변화 편차(4)
sb.Append(Helper.StringZeroFillDigits4(item.MotorSpeed)); // Motor 속도(4)
sb.Append(Helper.StringZeroFillDigits4(item.PoleNum)); // BLDC 모터 Pole 수(4)
sb.Append(Helper.StringZeroFillDigits4(item.AttenuatorRatio)); // 감속기 비율(4)
sb.Append(Helper.StringZeroFillDigits4(item.BootingStart)); // 부팅 시 자동 구동 여부(4)
sb.Append(Helper.StringZeroFillDigits4(item.PortUse)); // 타 Port 모터 사용 여부(4)
sb.Append(Helper.StringZeroFillDigits4(item.Feedback)); // 모터 구동 중 피드백 제어 여부(4)
sb.Append(Helper.StringZeroFillDigits4(item.InitDirection)); // 초기 모터 방향(4)
sb.Append(Helper.StringZeroFillDigits4(item.OperDirection)); // 구동 중 모터 방향(4)
sb.Append("0000"); // Dummy1(4)
sb.Append("0000"); // Dummy2(4)
sb.Append("0000"); // Dummy3(4)
@ -7837,7 +8074,7 @@ namespace ITC81DB_0H.Forms
sb.Append("0000"); // Dummy22(4)
sb.Append("0000"); // Dummy23(4)
this.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.BLDCMotorSetting, sb.ToString());
this.TransferDataStream(CommunicationCommand.Write, ID, CommunicationAddress.BLDCMotorSetting, sb.ToString());
}
#endregion
#region SystemParameter1
@ -10238,7 +10475,7 @@ namespace ITC81DB_0H.Forms
this.LoadUserGroupPasswordFile();
// BLDC Motor Settings 파일 읽기
this.LoadBLDCMotorFile();
this.LoadBLDCMotorFile(ref this.CollectionBLDCParameter);
// UserGroup 파일 읽기
this.LoadUserGroupFile(ref this.CurrentUserGroup);

View File

@ -723,7 +723,7 @@ namespace ITC81DB_0H.Forms
this.CenterSystemExternalOutput.BringToFront();
break;
case DataStore.MenuBottomSystem.BLDCMotorSetting:
this.CenterSystemBLDCMotorSetting.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
this.CenterSystemBLDCMotorSetting.DisplayRefresh(this.ParentForm.CurrentSystemStatus, this.ParentForm.CollectionBLDCParameter);
this.CenterSystemBLDCMotorSetting.BringToFront();
break;
default: