更新
This commit is contained in:
@@ -29,6 +29,8 @@ namespace TabletTester2025
|
||||
// 溶出度
|
||||
await LoadPlcFloatToTextBoxAsync(ResolveDissolution1SpeedRegister(), Dissolution1SpeedBox);
|
||||
await LoadPlcFloatToTextBoxAsync(ResolveDissolution2SpeedRegister(), Dissolution2SpeedBox);
|
||||
await LoadPlcIntToTextBoxAsync(ResolveDissolution1TimeRegister(), Dissolution1TimeBox);
|
||||
await LoadPlcIntToTextBoxAsync(ResolveDissolution2TimeRegister(), Dissolution2TimeBox);
|
||||
await LoadPlcFloatToTextBoxAsync(ResolveDissolution1IntervalRegister(), Dissolution1IntervalBox);
|
||||
await LoadPlcFloatToTextBoxAsync(ResolveDissolution2IntervalRegister(), Dissolution2IntervalBox);
|
||||
}
|
||||
@@ -44,6 +46,8 @@ namespace TabletTester2025
|
||||
DisintegrationTimeMinBox.Text = ResolveDisintegrationTimeMin(p).ToString("0.###");
|
||||
//DisintegrationTempBox.Text = p.DisintegrationTemperatureC.ToString();
|
||||
//DissolutionTempBox.Text = p.DissolutionTemperatureC.ToString();
|
||||
Dissolution1TimeBox.Text = p.Dissolution1TimeMin.ToString();
|
||||
Dissolution2TimeBox.Text = p.Dissolution2TimeMin.ToString();
|
||||
Dissolution1IntervalBox.Text = p.Dissolution1SampleIntervalMin.ToString();
|
||||
Dissolution2IntervalBox.Text = p.Dissolution2SampleIntervalMin.ToString();
|
||||
}
|
||||
@@ -83,6 +87,8 @@ namespace TabletTester2025
|
||||
//p.DissolutionTemperatureC = ParseFiniteDouble(DissolutionTempBox.Text, "溶出介质温度");
|
||||
double dissolution1Speed = ParsePositiveDouble(Dissolution1SpeedBox.Text, "溶出速度1");
|
||||
double dissolution2Speed = ParsePositiveDouble(Dissolution2SpeedBox.Text, "溶出速度2");
|
||||
p.Dissolution1TimeMin = ParsePositiveInt(Dissolution1TimeBox.Text, "溶出1时间");
|
||||
p.Dissolution2TimeMin = ParsePositiveInt(Dissolution2TimeBox.Text, "溶出2时间");
|
||||
p.Dissolution1SampleIntervalMin = ParsePositiveDouble(Dissolution1IntervalBox.Text, "溶出1取样间隔");
|
||||
p.Dissolution2SampleIntervalMin = ParsePositiveDouble(Dissolution2IntervalBox.Text, "溶出2取样间隔");
|
||||
|
||||
@@ -94,6 +100,8 @@ namespace TabletTester2025
|
||||
await WriteDisintegrationTimeAsync(disintegrationTimeMin);
|
||||
await WriteDissolution1SpeedAsync(dissolution1Speed);
|
||||
await WriteDissolution2SpeedAsync(dissolution2Speed);
|
||||
await WriteDissolution1TimeAsync(p.Dissolution1TimeMin);
|
||||
await WriteDissolution2TimeAsync(p.Dissolution2TimeMin);
|
||||
await WriteDissolution1IntervalAsync(p.Dissolution1SampleIntervalMin);
|
||||
await WriteDissolution2IntervalAsync(p.Dissolution2SampleIntervalMin);
|
||||
App.CurrentPharmaParams = p;
|
||||
@@ -351,6 +359,24 @@ namespace TabletTester2025
|
||||
await App.PlcService.WriteFloatAsync(registerAddress, (float)value);
|
||||
}
|
||||
|
||||
private static async Task WriteDissolution1TimeAsync(int value)
|
||||
{
|
||||
ushort registerAddress = ResolveDissolution1TimeRegister();
|
||||
if (registerAddress == 0)
|
||||
throw new InvalidOperationException("溶出1时间PLC寄存器地址未配置。");
|
||||
|
||||
await App.PlcService.WriteRegisterAsync(registerAddress, (ushort)Math.Clamp(value, 1, ushort.MaxValue));
|
||||
}
|
||||
|
||||
private static async Task WriteDissolution2TimeAsync(int value)
|
||||
{
|
||||
ushort registerAddress = ResolveDissolution2TimeRegister();
|
||||
if (registerAddress == 0)
|
||||
throw new InvalidOperationException("溶出2时间PLC寄存器地址未配置。");
|
||||
|
||||
await App.PlcService.WriteRegisterAsync(registerAddress, (ushort)Math.Clamp(value, 1, ushort.MaxValue));
|
||||
}
|
||||
|
||||
private static async Task WriteDissolution1IntervalAsync(double value)
|
||||
{
|
||||
ushort registerAddress = ResolveDissolution1IntervalRegister();
|
||||
@@ -379,6 +405,16 @@ namespace TabletTester2025
|
||||
return App.PlcConfig.Dissolution2Speed != 0 ? App.PlcConfig.Dissolution2Speed : (ushort)350;
|
||||
}
|
||||
|
||||
private static ushort ResolveDissolution1TimeRegister()
|
||||
{
|
||||
return App.PlcConfig.Dissolution1Time != 0 ? App.PlcConfig.Dissolution1Time : (ushort)430;
|
||||
}
|
||||
|
||||
private static ushort ResolveDissolution2TimeRegister()
|
||||
{
|
||||
return App.PlcConfig.Dissolution2Time != 0 ? App.PlcConfig.Dissolution2Time : (ushort)440;
|
||||
}
|
||||
|
||||
private static ushort ResolveDissolution1IntervalRegister()
|
||||
{
|
||||
return App.PlcConfig.Dissolution1SampleInterval != 0 ? App.PlcConfig.Dissolution1SampleInterval : (ushort)432;
|
||||
|
||||
Reference in New Issue
Block a user