You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.3 KiB
45 lines
1.3 KiB
using System;
|
|
|
|
namespace marking_gui.Models
|
|
{
|
|
public class MeasurementLimits
|
|
{
|
|
public double MinVoltage { get; set; }
|
|
public double MaxVoltage { get; set; }
|
|
public double MinCurrent { get; set; }
|
|
public double MaxCurrent { get; set; }
|
|
|
|
public MeasurementLimits(double minVoltage = 4.0, double maxVoltage = 6.0, double minCurrent = 8.0, double maxCurrent = 10.0)
|
|
{
|
|
MinVoltage = minVoltage;
|
|
MaxVoltage = maxVoltage;
|
|
MinCurrent = minCurrent;
|
|
MaxCurrent = maxCurrent;
|
|
}
|
|
|
|
public bool Validate(out string errorMessage)
|
|
{
|
|
errorMessage = string.Empty;
|
|
|
|
if (MinVoltage < 0 || MaxVoltage < 0 || MinCurrent < 0 || MaxCurrent < 0)
|
|
{
|
|
errorMessage = "기준 범위 설정 값은 0 이상의 값이어야 합니다.";
|
|
return false;
|
|
}
|
|
|
|
if (MinVoltage >= MaxVoltage)
|
|
{
|
|
errorMessage = "전압 최소값은 최대값보다 작아야 합니다.";
|
|
return false;
|
|
}
|
|
|
|
if (MinCurrent >= MaxCurrent)
|
|
{
|
|
errorMessage = "전류 최소값은 최대값보다 작아야 합니다.";
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|