查询返回数据转double
This commit is contained in:
@@ -212,10 +212,10 @@ namespace DeviceCommand.Devices
|
||||
/// <param name="ct">取消令牌</param>
|
||||
/// <returns>实测直流电流值 (单位: A)</returns>
|
||||
[Monitorable("低压直流电源电流")]
|
||||
public virtual async Task<string> 查询实际电流(CancellationToken ct = default)
|
||||
public virtual async Task<double> 查询实际电流(CancellationToken ct = default)
|
||||
{
|
||||
// 修正:去除前缀冒号,改用标准 MEAS:CURR?
|
||||
return await WriteReadAsync($"MEAS:CURR?{SCPIDelimiter}", SCPIDelimiter, ct);
|
||||
string response = await WriteReadAsync($"MEAS:CURR?{SCPIDelimiter}", SCPIDelimiter, ct);
|
||||
return double.TryParse(response, out double result) ? result : double.NaN;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -224,10 +224,10 @@ namespace DeviceCommand.Devices
|
||||
/// <param name="ct">取消令牌</param>
|
||||
/// <returns>实测直流功率值 (单位: W)</returns>
|
||||
[Monitorable("低压直流电源功率")]
|
||||
public virtual async Task<string> 查询实际功率(CancellationToken ct = default)
|
||||
public virtual async Task<double> 查询实际功率(CancellationToken ct = default)
|
||||
{
|
||||
// 修正:去除前缀冒号,改用标准 MEAS:POW?
|
||||
return await WriteReadAsync($"MEAS:POW?{SCPIDelimiter}", SCPIDelimiter, ct);
|
||||
string response = await WriteReadAsync($"MEAS:POW?{SCPIDelimiter}", SCPIDelimiter, ct);
|
||||
return double.TryParse(response, out double result) ? result : double.NaN;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -236,10 +236,10 @@ namespace DeviceCommand.Devices
|
||||
/// <param name="ct">取消令牌</param>
|
||||
/// <returns>实测直流电压值 (单位: V)</returns>
|
||||
[Monitorable("低压直流电源电压")]
|
||||
public virtual async Task<string> 查询实际电压(CancellationToken ct = default)
|
||||
public virtual async Task<double> 查询实际电压(CancellationToken ct = default)
|
||||
{
|
||||
// 修正:去除前缀冒号,改用标准 MEAS:VOLT?
|
||||
return await WriteReadAsync($"MEAS:VOLT?{SCPIDelimiter}", SCPIDelimiter, ct);
|
||||
string response = await WriteReadAsync($"MEAS:VOLT?{SCPIDelimiter}", SCPIDelimiter, ct);
|
||||
return double.TryParse(response, out double result) ? result : double.NaN;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -253,16 +253,15 @@ namespace DeviceCommand.Devices
|
||||
return await WriteReadAsync($"MEAS:VAP?{SCPIDelimiter}", SCPIDelimiter, ct);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 3.5.5 查询通道输出端子上测得的输出时间长度
|
||||
/// </summary>
|
||||
/// <param name="ct">取消令牌</param>
|
||||
/// <returns>输出时间长度</returns>
|
||||
public virtual async Task<string> 查询总输出时间长度(CancellationToken ct = default)
|
||||
public virtual async Task<double> 查询总输出时间长度(CancellationToken ct = default)
|
||||
{
|
||||
// 修正:去除前缀冒号
|
||||
return await WriteReadAsync($"MEAS:TIME:OUTP?{SCPIDelimiter}", SCPIDelimiter, ct);
|
||||
string response = await WriteReadAsync($"MEAS:TIME:OUTP?{SCPIDelimiter}", SCPIDelimiter, ct);
|
||||
return double.TryParse(response, out double result) ? result : double.NaN;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -435,6 +434,7 @@ namespace DeviceCommand.Devices
|
||||
string cmd = string.Format(CultureInfo.InvariantCulture, "VOLT:LIM {0:F3}{1}", 电压, SCPIDelimiter);
|
||||
await SendAsync(cmd, ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 3.7.2.9 清除电压上限限制(恢复为设备物理允许的最大电压值)
|
||||
/// </summary>
|
||||
@@ -444,6 +444,7 @@ namespace DeviceCommand.Devices
|
||||
// 发送 MAXimum 设为最大值以达到"清除限制"的效果
|
||||
await SendAsync($"VOLT:LIMIT MAX{SCPIDelimiter}", ct); // 对应手册 3.7.2.8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 3.7.3.1 设置输出功率值 (W)
|
||||
/// </summary>
|
||||
@@ -548,4 +549,4 @@ namespace DeviceCommand.Devices
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user