add single relay , fix bugs
This commit is contained in:
parent
0df5b3bf51
commit
2f2ee5b6c5
@ -22,6 +22,7 @@ SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
pointname.cpp \
|
||||
pressure_pulsation.cpp \
|
||||
radial_vibration.cpp \
|
||||
rangeslider.cpp \
|
||||
relaysetting.cpp \
|
||||
@ -54,6 +55,7 @@ HEADERS += \
|
||||
macconfig.h \
|
||||
mainwindow.h \
|
||||
pointname.h \
|
||||
pressure_pulsation.h \
|
||||
radial_vibration.h \
|
||||
rangeslider.h \
|
||||
relaysetting.h \
|
||||
@ -74,12 +76,14 @@ HEADERS += \
|
||||
|
||||
FORMS += \
|
||||
acceleration.ui \
|
||||
axialdisplacement.ui \
|
||||
connect.ui \
|
||||
ethconfig.ui \
|
||||
keyphase.ui \
|
||||
macconfig.ui \
|
||||
mainwindow.ui \
|
||||
pointname.ui \
|
||||
pressure_pulsation.ui \
|
||||
radial_vibration.ui \
|
||||
relaysetting.ui \
|
||||
seismic_monitor.ui \
|
||||
|
781
axialdisplacement.ui
Normal file
781
axialdisplacement.ui
Normal file
@ -0,0 +1,781 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AxialDisplacement</class>
|
||||
<widget class="QWidget" name="AxialDisplacement">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>690</width>
|
||||
<height>532</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>21</x>
|
||||
<y>10</y>
|
||||
<width>105</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_58">
|
||||
<property name="text">
|
||||
<string>通道:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_channel">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_active">
|
||||
<property name="text">
|
||||
<string>(启用)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>341</x>
|
||||
<y>10</y>
|
||||
<width>63</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_57">
|
||||
<property name="text">
|
||||
<string>槽位号:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_slot">
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>651</width>
|
||||
<height>381</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
<string>传感器和滤波配置</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>353</width>
|
||||
<height>116</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>滤波</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_high_pass">
|
||||
<property name="text">
|
||||
<string>高通:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_high_pass_low">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_33">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_high_pass_high">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_32">
|
||||
<property name="text">
|
||||
<string>3 - 3000Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_low_pass">
|
||||
<property name="text">
|
||||
<string>低通:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_low_pass_low">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_low_pass_high">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="text">
|
||||
<string>30 - 30000Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_band_pass">
|
||||
<property name="text">
|
||||
<string>带通:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_band_pass_low">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_34">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_band_pass_high">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_35">
|
||||
<property name="text">
|
||||
<string>3 - 3000Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_6">
|
||||
<attribute name="title">
|
||||
<string>特征值和警报配置</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>471</width>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>采样频率</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>30</y>
|
||||
<width>397</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_fixed">
|
||||
<property name="text">
|
||||
<string>固定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>采样率:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_sample_rate">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>带宽:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_bandwidth">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>70</y>
|
||||
<width>118</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>FFT 点数:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_fft_points">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8192</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>100</y>
|
||||
<width>122</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>频率范围:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>5000 Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>130</y>
|
||||
<width>92</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>线数:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>1250 Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>160</y>
|
||||
<width>104</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>频率分辨率:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>4 Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>219</y>
|
||||
<width>471</width>
|
||||
<height>121</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>测量</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>最小:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>最大:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>20</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 测量值</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>20</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>对应值</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_measuring_value_min">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>40</y>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_scale_value_min">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>40</y>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_measuring_value_max">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>80</y>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_scale_value_max">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>80</y>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>40</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mbar</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>80</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mbar</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>40</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mV</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>80</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mV</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>450</y>
|
||||
<width>632</width>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_set_default">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>设置为默认值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_print">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打印</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_help">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>帮助</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
18
cardbase.h
18
cardbase.h
@ -25,6 +25,7 @@ class VariableBase {
|
||||
VibChannelType type_;
|
||||
Filter filter_[3];
|
||||
DirectImpl direct_;
|
||||
GapRange gap_range;
|
||||
XImpl x1_;
|
||||
XImpl x2_;
|
||||
RecorderOut recorder_out_;
|
||||
@ -49,11 +50,26 @@ class AccVelVariable : public VariableBase {
|
||||
bool rms_active_;
|
||||
bool integrate_active_;
|
||||
};
|
||||
// 加速度与速度
|
||||
// 轴向位移
|
||||
class ThrustVariable : public VariableBase {
|
||||
public:
|
||||
bool alert_latching_;
|
||||
bool danger_latching_;
|
||||
bool timed_ok_;
|
||||
ZeroPosition zero_position;
|
||||
};
|
||||
// 动态压力脉动
|
||||
class PressurePulsationVariable : public VariableBase {
|
||||
public:
|
||||
bool fixed;
|
||||
int sample_rate;
|
||||
int bandwidth;
|
||||
int fft_points;
|
||||
bool spectral_synchron;
|
||||
int measuring_min;
|
||||
int measuring_max;
|
||||
int scale_min;
|
||||
int scale_max;
|
||||
bool inherited;
|
||||
};
|
||||
#endif // CARDBASE_H
|
||||
|
177
config_mgr.cpp
177
config_mgr.cpp
@ -66,27 +66,43 @@ void ConfigMgr::Save(QString & file_path) {
|
||||
channel_item["power"] = ptr->base_config_[cid].power;
|
||||
channel_item["point_name"] = ptr->base_config_[cid].point_name;
|
||||
channel_item["chan_id"] = ptr->base_config_[cid].chan_id;
|
||||
channel_item["keyphase"] = ptr->base_config_[cid].keyphase;
|
||||
channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot;
|
||||
channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch;
|
||||
|
||||
QJsonArray voltage_range;
|
||||
voltage_range.append(ptr->base_config_[cid].normal_voltage_low);
|
||||
voltage_range.append(ptr->base_config_[cid].normal_voltage_high);
|
||||
channel_item["normal_voltage_range"] = voltage_range;
|
||||
QJsonObject setpoint_data;
|
||||
if(ptr->base_config_[cid].channel_type != kVibThrust){
|
||||
setpoint_data["1x_ampl_upper"] = qRound(ptr->alert_danger[cid].x1_ampl_upper * 10)/10.0;
|
||||
setpoint_data["1x_ampl_lower"] = qRound(ptr->alert_danger[cid].x1_ampl_lower * 10)/10.0;
|
||||
setpoint_data["1x_ampl_enable"] = ptr->alert_danger[cid].x1_ampl_enable;
|
||||
setpoint_data["2x_ampl_upper"] = qRound(ptr->alert_danger[cid].x2_ampl_upper * 10)/10.0;
|
||||
setpoint_data["2x_ampl_lower"] = qRound(ptr->alert_danger[cid].x2_ampl_lower * 10)/10.0;
|
||||
setpoint_data["2x_ampl_enable"] = ptr->alert_danger[cid].x2_ampl_enable;
|
||||
if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust ||
|
||||
ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){
|
||||
if(ptr->base_config_[cid].channel_type != kVibThrust){
|
||||
setpoint_data["1x_ampl_upper"] = qRound(ptr->alert_danger[cid].x1_ampl_upper * 10)/10.0;
|
||||
setpoint_data["1x_ampl_lower"] = qRound(ptr->alert_danger[cid].x1_ampl_lower * 10)/10.0;
|
||||
setpoint_data["1x_ampl_enable"] = ptr->alert_danger[cid].x1_ampl_enable;
|
||||
setpoint_data["2x_ampl_upper"] = qRound(ptr->alert_danger[cid].x2_ampl_upper * 10)/10.0;
|
||||
setpoint_data["2x_ampl_lower"] = qRound(ptr->alert_danger[cid].x2_ampl_lower * 10)/10.0;
|
||||
setpoint_data["2x_ampl_enable"] = ptr->alert_danger[cid].x2_ampl_enable;
|
||||
channel_item["keyphase"] = ptr->base_config_[cid].keyphase;
|
||||
channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot;
|
||||
channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch;
|
||||
}
|
||||
setpoint_data["direct_upper"] = qRound(ptr->alert_danger[cid].direct_upper * 10)/10.0;
|
||||
setpoint_data["direct_enable"] = ptr->alert_danger[cid].direct_enable;
|
||||
setpoint_data["danger_param"] = ptr->alert_danger[cid].danger_param;
|
||||
setpoint_data["danger_upper"] = qRound(ptr->alert_danger[cid].danger_upper * 10)/10.0;
|
||||
setpoint_data["danger_enable"] = ptr->alert_danger[cid].danger_enable;
|
||||
|
||||
}
|
||||
if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){
|
||||
setpoint_data["low_upper"] = qRound(ptr->alert_danger_press[cid].low_upper * 10)/10.0;
|
||||
setpoint_data["low_enable"] = ptr->alert_danger_press[cid].low_enable;
|
||||
setpoint_data["mid1_upper"] = qRound(ptr->alert_danger_press[cid].mid1_upper * 10)/10.0;
|
||||
setpoint_data["mid1_enable"] = ptr->alert_danger_press[cid].mid1_enable;
|
||||
setpoint_data["mid2_upper"] = qRound(ptr->alert_danger_press[cid].mid2_upper * 10)/10.0;
|
||||
setpoint_data["mid2_enable"] = ptr->alert_danger_press[cid].mid2_enable;
|
||||
setpoint_data["danger_param"] = ptr->alert_danger_press[cid].danger_param;
|
||||
setpoint_data["danger_upper"] = qRound(ptr->alert_danger_press[cid].danger_upper * 10)/10.0;
|
||||
setpoint_data["danger_enable"] = ptr->alert_danger_press[cid].danger_enable;
|
||||
}
|
||||
setpoint_data["direct_upper"] = qRound(ptr->alert_danger[cid].direct_upper * 10)/10.0;
|
||||
setpoint_data["direct_enable"] = ptr->alert_danger[cid].direct_enable;
|
||||
setpoint_data["danger_param"] = ptr->alert_danger[cid].danger_param;
|
||||
setpoint_data["danger_upper"] = qRound(ptr->alert_danger[cid].danger_upper * 10)/10.0;
|
||||
setpoint_data["danger_enable"] = ptr->alert_danger[cid].danger_enable;
|
||||
channel_item["setpoint"] = setpoint_data;
|
||||
// variables
|
||||
QJsonObject variables;
|
||||
@ -175,7 +191,7 @@ void ConfigMgr::Save(QString & file_path) {
|
||||
band_pass["checked"] = thrust_ptr->filter_[2].checked;
|
||||
filter.append(band_pass);
|
||||
variables["filter"] = filter;
|
||||
QJsonObject direct;
|
||||
QJsonObject direct,gap;
|
||||
QJsonObject recorder_out;
|
||||
QJsonObject delay;
|
||||
QJsonArray latching;
|
||||
@ -183,6 +199,9 @@ void ConfigMgr::Save(QString & file_path) {
|
||||
direct["clamp_value"] = thrust_ptr->direct_.clamp_value;
|
||||
direct["custom"] = thrust_ptr->direct_.custom;
|
||||
variables["direct"] = direct;
|
||||
gap["full_scale_range"] = thrust_ptr->gap_range.full_scale_range;
|
||||
gap["custom"] = thrust_ptr->gap_range.custom;
|
||||
variables["gap"] = gap;
|
||||
recorder_out["recorder_output"] = thrust_ptr->recorder_out_.recorder_output;
|
||||
recorder_out["two_ma_clamp"] = thrust_ptr->recorder_out_.two_ma_clamp;
|
||||
recorder_out["trip_multiply"] = thrust_ptr->recorder_out_.trip_multiply;
|
||||
@ -196,7 +215,46 @@ void ConfigMgr::Save(QString & file_path) {
|
||||
latching.append(thrust_ptr->alert_latching_);
|
||||
latching.append(thrust_ptr->danger_latching_);
|
||||
latching.append(thrust_ptr->timed_ok_);
|
||||
variables["zero_position"] = thrust_ptr->zero_position.value;
|
||||
variables["latching"] = latching;
|
||||
}else if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){
|
||||
std::shared_ptr<PressurePulsationVariable> pressure_ptr = std::dynamic_pointer_cast<PressurePulsationVariable>(base_channel_ptr);
|
||||
if(pressure_ptr == nullptr){
|
||||
continue;
|
||||
}
|
||||
// filter
|
||||
QJsonArray filter;
|
||||
QJsonObject low_pass;
|
||||
low_pass["low"] = pressure_ptr->filter_[0].low;
|
||||
low_pass["high"] = pressure_ptr->filter_[0].high;
|
||||
low_pass["checked"] = pressure_ptr->filter_[0].checked;
|
||||
filter.append(low_pass);
|
||||
QJsonObject high_pass;
|
||||
high_pass["low"] = pressure_ptr->filter_[1].low;
|
||||
high_pass["high"] = pressure_ptr->filter_[1].high;
|
||||
high_pass["checked"] = pressure_ptr->filter_[1].checked;
|
||||
filter.append(high_pass);
|
||||
QJsonObject band_pass;
|
||||
band_pass["low"] = pressure_ptr->filter_[2].low;
|
||||
band_pass["high"] = pressure_ptr->filter_[2].high;
|
||||
band_pass["checked"] = pressure_ptr->filter_[2].checked;
|
||||
filter.append(band_pass);
|
||||
variables["filter"] = filter;
|
||||
QJsonObject sampling;
|
||||
QJsonObject scaling;
|
||||
sampling["fixed"] = pressure_ptr->fixed;
|
||||
sampling["sample_rate"] = pressure_ptr->sample_rate;
|
||||
sampling["band_width"] = pressure_ptr->bandwidth;
|
||||
sampling["fft_points"] = pressure_ptr->fft_points;
|
||||
sampling["spectral_synchron"] = pressure_ptr->spectral_synchron;
|
||||
scaling["measuring_min"] = pressure_ptr->measuring_min;
|
||||
scaling["measuring_max"] = pressure_ptr->measuring_max;
|
||||
scaling["scale_min"] = pressure_ptr->scale_min;
|
||||
scaling["scale_max"] = pressure_ptr->scale_max;
|
||||
scaling["inherited"] = pressure_ptr->inherited;
|
||||
variables["sampling"] = sampling;
|
||||
variables["scaling"] = scaling;
|
||||
|
||||
} else {
|
||||
std::shared_ptr<AccVelVariable> av_ptr = std::dynamic_pointer_cast<AccVelVariable>(base_channel_ptr);
|
||||
if(av_ptr == nullptr){
|
||||
@ -319,10 +377,10 @@ void ConfigMgr::Save(QString & file_path) {
|
||||
if (base_ptr == nullptr) {
|
||||
continue;
|
||||
}
|
||||
std::shared_ptr<SingleRelayDataNOK> ptr = std::dynamic_pointer_cast<SingleRelayDataNOK>(base_ptr);
|
||||
if(ptr->single_relay_nok[ch].logic_expression != ""){
|
||||
qDebug() << "ch" << ch << ptr->single_relay_nok[ch].logic_expression;
|
||||
channel_item.insert("logic_expression", ptr->single_relay_nok[ch].logic_expression);
|
||||
std::shared_ptr<SingleRelayData> ptr = std::dynamic_pointer_cast<SingleRelayData>(base_ptr);
|
||||
if(ptr->single_relay[ch].logic_expression != ""){
|
||||
qDebug() << "ch" << ch << ptr->single_relay[ch].logic_expression;
|
||||
channel_item.insert("logic_expression", ptr->single_relay[ch].logic_expression);
|
||||
}
|
||||
|
||||
}else if(card_type_[i] == kCardRelaySingle){
|
||||
@ -430,22 +488,37 @@ void ConfigMgr::Load(QString filename) {
|
||||
vib_data->base_config_[j].power = channel["power"].toBool();
|
||||
vib_data->base_config_[j].point_name = channel["point_name"].toString();
|
||||
vib_data->base_config_[j].chan_id = channel["chan_id"].toString();
|
||||
vib_data->base_config_[j].keyphase = channel["keyphase"].toBool();
|
||||
vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt();
|
||||
vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt();
|
||||
|
||||
//setpoint
|
||||
QJsonObject setpoint_data = channel["setpoint"].toObject();
|
||||
vib_data->alert_danger[j].direct_upper = setpoint_data["direct_upper"].toDouble();
|
||||
vib_data->alert_danger[j].direct_enable = setpoint_data["direct_enable"].toBool();
|
||||
vib_data->alert_danger[j].x1_ampl_upper = setpoint_data["1x_ampl_upper"].toDouble();
|
||||
vib_data->alert_danger[j].x1_ampl_lower = setpoint_data["1x_ampl_lower"].toDouble();
|
||||
vib_data->alert_danger[j].x1_ampl_enable = setpoint_data["1x_ampl_enable"].toBool();
|
||||
vib_data->alert_danger[j].x2_ampl_upper = setpoint_data["2x_ampl_upper"].toDouble();
|
||||
vib_data->alert_danger[j].x2_ampl_lower = setpoint_data["2x_ampl_lower"].toDouble();
|
||||
vib_data->alert_danger[j].x2_ampl_enable = setpoint_data["2x_ampl_enable"].toBool();
|
||||
vib_data->alert_danger[j].danger_param = setpoint_data["danger_param"].toInt();
|
||||
vib_data->alert_danger[j].danger_upper = setpoint_data["danger_upper"].toDouble();
|
||||
vib_data->alert_danger[j].danger_enable = setpoint_data["danger_enable"].toBool();
|
||||
if(vib_data->base_config_[j].channel_type == kVibRadial || vib_data->base_config_[j].channel_type == kVibThrust ||
|
||||
vib_data->base_config_[j].channel_type == kVibAcc ||vib_data->base_config_[j].channel_type == kVibVelocity ){
|
||||
vib_data->alert_danger[j].direct_upper = setpoint_data["direct_upper"].toDouble();
|
||||
vib_data->alert_danger[j].direct_enable = setpoint_data["direct_enable"].toBool();
|
||||
vib_data->alert_danger[j].x1_ampl_upper = setpoint_data["1x_ampl_upper"].toDouble();
|
||||
vib_data->alert_danger[j].x1_ampl_lower = setpoint_data["1x_ampl_lower"].toDouble();
|
||||
vib_data->alert_danger[j].x1_ampl_enable = setpoint_data["1x_ampl_enable"].toBool();
|
||||
vib_data->alert_danger[j].x2_ampl_upper = setpoint_data["2x_ampl_upper"].toDouble();
|
||||
vib_data->alert_danger[j].x2_ampl_lower = setpoint_data["2x_ampl_lower"].toDouble();
|
||||
vib_data->alert_danger[j].x2_ampl_enable = setpoint_data["2x_ampl_enable"].toBool();
|
||||
vib_data->alert_danger[j].danger_param = setpoint_data["danger_param"].toInt();
|
||||
vib_data->alert_danger[j].danger_upper = setpoint_data["danger_upper"].toDouble();
|
||||
vib_data->alert_danger[j].danger_enable = setpoint_data["danger_enable"].toBool();
|
||||
vib_data->base_config_[j].keyphase = channel["keyphase"].toBool();
|
||||
vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt();
|
||||
vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt();
|
||||
}
|
||||
if(vib_data->base_config_[j].channel_type == kVibPressurePulsation){
|
||||
vib_data->alert_danger_press[j].low_upper = setpoint_data["low_upper"].toDouble();
|
||||
vib_data->alert_danger_press[j].low_enable = setpoint_data["low_enable"].toBool();
|
||||
vib_data->alert_danger_press[j].mid1_upper = setpoint_data["mid1_upper"].toDouble();
|
||||
vib_data->alert_danger_press[j].mid1_enable = setpoint_data["mid1_enable"].toBool();
|
||||
vib_data->alert_danger_press[j].mid2_upper = setpoint_data["mid2_upper"].toDouble();
|
||||
vib_data->alert_danger_press[j].mid2_enable = setpoint_data["mid2_enable"].toBool();
|
||||
vib_data->alert_danger_press[j].danger_param = setpoint_data["danger_param"].toInt();
|
||||
vib_data->alert_danger_press[j].danger_upper = setpoint_data["danger_upper"].toDouble();
|
||||
vib_data->alert_danger_press[j].danger_enable = setpoint_data["danger_enable"].toBool();
|
||||
}
|
||||
// variables
|
||||
QJsonObject tmp_variable = channel["variable"].toObject();
|
||||
switch (vib_data->base_config_[j].channel_type) {
|
||||
@ -508,6 +581,10 @@ void ConfigMgr::Load(QString filename) {
|
||||
variable->direct_.clamp_value = direct["clamp_value"].toDouble();
|
||||
variable->direct_.custom = direct["custom"].toDouble();
|
||||
|
||||
QJsonObject gap = tmp_variable["gap"].toObject();
|
||||
variable->gap_range.full_scale_range = direct["full_scale_range"].toInt();
|
||||
variable->gap_range.custom = direct["custom"].toDouble();
|
||||
|
||||
QJsonObject recorder_out = tmp_variable["recorder_out"].toObject();
|
||||
variable->recorder_out_.recorder_output = recorder_out["recorder_output"].toInt();
|
||||
variable->recorder_out_.two_ma_clamp = recorder_out["two_ma_clamp"].toBool();
|
||||
@ -519,6 +596,34 @@ void ConfigMgr::Load(QString filename) {
|
||||
variable->alert_latching_ = latching["alert"].toBool();
|
||||
variable->danger_latching_ = latching["danger"].toBool();
|
||||
variable->timed_ok_ = latching["timed_ok"].toBool();
|
||||
variable->zero_position.value = tmp_variable["zero_position"].toDouble();
|
||||
vib_data->variables_.push_back(variable);
|
||||
break;
|
||||
}
|
||||
case kVibPressurePulsation:{
|
||||
std::shared_ptr<PressurePulsationVariable> variable = std::make_shared<PressurePulsationVariable>();
|
||||
// filter
|
||||
QJsonArray filter_array = tmp_variable["filter"].toArray();
|
||||
for (int k = 0; k < filter_array.size(); k++) {
|
||||
QJsonObject filter_ele = filter_array[k].toObject();
|
||||
variable->filter_[k].low = filter_ele["low"].toInt();
|
||||
variable->filter_[k].high = filter_ele["high"].toInt();
|
||||
variable->filter_[k].checked = filter_ele["checked"].toBool();
|
||||
}
|
||||
variable->id_ = j + 1;
|
||||
QJsonObject sampling,scaling;
|
||||
sampling = tmp_variable["sampling"].toObject();
|
||||
scaling = tmp_variable["scaling"].toObject();
|
||||
variable->fixed = sampling["fixed"].toBool();
|
||||
variable->sample_rate = sampling["sample_rate"].toInt();
|
||||
variable->bandwidth = sampling["band_width"].toInt();
|
||||
variable->fft_points = sampling["fft_points"].toInt();
|
||||
variable->spectral_synchron = sampling["spectral_synchron"].toBool();
|
||||
variable->measuring_min = scaling["measuring_min"].toInt();
|
||||
variable->measuring_max = scaling["measuring_max"].toInt();
|
||||
variable->scale_min = scaling["scale_min"].toInt();
|
||||
variable->scale_max = scaling["scale_max"].toInt();
|
||||
variable->inherited = scaling["inherited"].toBool();
|
||||
vib_data->variables_.push_back(variable);
|
||||
break;
|
||||
}
|
||||
@ -624,13 +729,13 @@ void ConfigMgr::Load(QString filename) {
|
||||
}
|
||||
cards_.push_back(keyphase_data);
|
||||
}else if (card_type_[i] == kCardRelaySingleNOK ){
|
||||
std::shared_ptr<SingleRelayDataNOK> singlerelay_data = std::make_shared<SingleRelayDataNOK>();
|
||||
std::shared_ptr<SingleRelayData> singlerelay_data = std::make_shared<SingleRelayData>();
|
||||
singlerelay_data->slot_ = slot;
|
||||
singlerelay_data->card_type_ = static_cast<CardType>(card_type_[i]);
|
||||
singlerelay_data->version_ = temp_obj["version"].toInt();
|
||||
for (int j = 0; j < RELAY_COUNT; ++j) {
|
||||
channel = temp_obj[QString::number(j + 1)].toObject();
|
||||
singlerelay_data->single_relay_nok[j].logic_expression = channel["logic_expression"].toString();
|
||||
singlerelay_data->single_relay[j].logic_expression = channel["logic_expression"].toString();
|
||||
}
|
||||
cards_.push_back(singlerelay_data);
|
||||
}else if(card_type_[i] == kCardRelaySingle){
|
||||
|
@ -14,7 +14,15 @@ extern QString g_version;
|
||||
#define SLOT_NUM 15
|
||||
#define CHANNEL_COUNT 4
|
||||
#define RELAY_COUNT 16
|
||||
|
||||
struct ExprNode {
|
||||
QString value;
|
||||
QList<ExprNode*> children;
|
||||
};
|
||||
struct ExprValidationResult {
|
||||
bool isValid;
|
||||
int errorPos;
|
||||
QString errorMsg;
|
||||
};
|
||||
typedef enum {
|
||||
kCardNone = 0,
|
||||
kCardCpu = 1,
|
||||
@ -161,6 +169,11 @@ typedef struct {
|
||||
float custom;
|
||||
} DirectImpl;
|
||||
|
||||
typedef struct{
|
||||
int full_scale_range;
|
||||
float custom;
|
||||
}GapRange;
|
||||
|
||||
typedef struct {
|
||||
bool checked;
|
||||
int full_scale_range;
|
||||
@ -182,6 +195,10 @@ typedef struct {
|
||||
bool active_100ms;
|
||||
} Delay;
|
||||
|
||||
typedef struct {
|
||||
float value;
|
||||
} ZeroPosition;
|
||||
|
||||
typedef struct {
|
||||
bool rms_active;
|
||||
bool integrate_active;
|
||||
@ -262,6 +279,28 @@ typedef struct VibAlertDanger_{
|
||||
}
|
||||
} VibAlertDanger;
|
||||
|
||||
typedef struct VibAlertDangerPress_{
|
||||
float low_upper;
|
||||
bool low_enable;
|
||||
float mid1_upper;
|
||||
bool mid1_enable;
|
||||
float mid2_upper;
|
||||
bool mid2_enable;
|
||||
int danger_param; //0: 全频段OA
|
||||
float danger_upper;
|
||||
bool danger_enable;
|
||||
VibAlertDangerPress_(){
|
||||
low_upper = 0.0;
|
||||
low_enable = false;
|
||||
mid1_upper = 0.0;
|
||||
mid1_enable = false;
|
||||
mid2_upper = 0.0;
|
||||
mid2_enable = false;
|
||||
danger_upper = 0.0;
|
||||
danger_enable = false;
|
||||
}
|
||||
} VibAlertDangerPress;
|
||||
|
||||
typedef struct SpeedAlert_{
|
||||
int speed_upper;
|
||||
int speed_lower;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "ethconfig.h"
|
||||
#include "macconfig.h"
|
||||
#include <QDateTime>
|
||||
#include "setpoint_pressure.h"
|
||||
|
||||
QString g_strServerIp;
|
||||
QString g_version;
|
||||
@ -503,6 +504,12 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
// if(ptr->base_config_[button_id].channel_type == kVibPressurePulsation){
|
||||
// SetpointPressure *setpoint_press = new SetpointPressure(button_id,ConfigMgr::Instance()->card_type_[button_id - 1]);
|
||||
// setpoint_press->setWindowModality(Qt::ApplicationModal);
|
||||
// setpoint_press->show();
|
||||
// }
|
||||
}
|
||||
if(slot_btn != NULL && ui->pushButton_point_name->isChecked()){
|
||||
QString object_name = slot_btn->objectName();
|
||||
|
142
pressure_pulsation.cpp
Normal file
142
pressure_pulsation.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
#include "pressure_pulsation.h"
|
||||
#include "ui_pressure_pulsation.h"
|
||||
#include <QDebug>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "config_mgr.h"
|
||||
|
||||
PressurePulsation::PressurePulsation(int slot_no_, int channel_, bool active,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::PressurePulsation)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
slot_no = slot_no_;
|
||||
channel = channel_;
|
||||
QString chan = QString("%1").arg(channel);
|
||||
QString slot = QString("%1").arg(slot_no);
|
||||
ui->label_channel->setText(chan);
|
||||
ui->label_slot->setText(slot);
|
||||
if (active) {
|
||||
ui->label_active->setText("(启用)");
|
||||
} else {
|
||||
ui->label_active->setText("(停用)");
|
||||
}
|
||||
Init();
|
||||
}
|
||||
|
||||
PressurePulsation::~PressurePulsation()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void PressurePulsation::Init() {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[Radial::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if (ptr->base_config_[channel - 1].channel_type != kVibPressurePulsation) {
|
||||
qDebug() << "[Radial::Init] channel type changes";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "[Radial::Init] no channel ptr";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<PressurePulsationVariable> variable_ptr = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
|
||||
ui->checkBox_low_pass->setChecked(variable_ptr->filter_[0].checked);
|
||||
ui->spinBox_low_pass_low->setValue(variable_ptr->filter_[0].low);
|
||||
ui->spinBox_low_pass_high->setValue(variable_ptr->filter_[0].high);
|
||||
ui->checkBox_high_pass->setChecked(variable_ptr->filter_[1].checked);
|
||||
ui->spinBox_high_pass_low->setValue(variable_ptr->filter_[1].low);
|
||||
ui->spinBox_high_pass_high->setValue(variable_ptr->filter_[1].high);
|
||||
ui->checkBox_band_pass->setChecked(variable_ptr->filter_[2].checked);
|
||||
ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low);
|
||||
ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high);
|
||||
ui->radioButton_fixed->setChecked(variable_ptr->fixed);
|
||||
ui->lineEdit_sample_rate->setText(QString::number(variable_ptr->sample_rate));
|
||||
ui->lineEdit_bandwidth->setText(QString::number(variable_ptr->bandwidth));
|
||||
ui->comboBox_fft_points->setCurrentText(QString::number(variable_ptr->fft_points));
|
||||
ui->checkBox_spectral->setCheckable(variable_ptr->spectral_synchron);
|
||||
ui->lineEdit_measuring_value_min->setText(QString::number(variable_ptr->measuring_min));
|
||||
ui->lineEdit_measuring_value_max->setText(QString::number(variable_ptr->measuring_max));
|
||||
ui->lineEdit_scale_value_min->setText(QString::number(variable_ptr->scale_min));
|
||||
ui->lineEdit_scale_value_max->setText(QString::number(variable_ptr->scale_max));
|
||||
ui->checkBox_inherited->setCheckable(variable_ptr->inherited);
|
||||
}
|
||||
void PressurePulsation::on_pushButton_confirm_clicked()
|
||||
{
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[Radial::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
|
||||
if (variable_base == nullptr || variable_base->type_ != kVibThrust) {
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "no channel ptr";
|
||||
} else {
|
||||
ptr->RemoveChannel(channel);
|
||||
qDebug() << "channel type change";
|
||||
}
|
||||
std::shared_ptr<PressurePulsationVariable> variable = std::make_shared<PressurePulsationVariable>();
|
||||
variable->id_ = channel;
|
||||
variable->type_ = kVibPressurePulsation;
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->checkState();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
variable->filter_[1].checked = ui->checkBox_high_pass->checkState();
|
||||
variable->filter_[1].low = ui->spinBox_high_pass_low->value();
|
||||
variable->filter_[1].high = ui->spinBox_high_pass_high->value();
|
||||
variable->filter_[2].checked = ui->checkBox_band_pass->checkState();
|
||||
variable->filter_[2].low = ui->spinBox_band_pass_low->value();
|
||||
variable->filter_[2].high = ui->spinBox_band_pass_high->value();
|
||||
variable->fixed = ui->radioButton_fixed->isChecked();
|
||||
variable->sample_rate = ui->lineEdit_sample_rate->text().toUInt();
|
||||
variable->bandwidth = ui->lineEdit_bandwidth->text().toInt();
|
||||
variable->fft_points = ui->comboBox_fft_points->currentText().toInt();
|
||||
variable->spectral_synchron = ui->checkBox_inherited->checkState();
|
||||
variable->measuring_min = ui->lineEdit_measuring_value_min->text().toInt();
|
||||
variable->measuring_max = ui->lineEdit_measuring_value_max->text().toInt();
|
||||
variable->scale_min = ui->lineEdit_scale_value_min->text().toInt();
|
||||
variable->scale_max = ui->lineEdit_scale_value_max->text().toInt();
|
||||
|
||||
ptr->variables_.push_back(variable);
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<PressurePulsationVariable> variable = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
|
||||
variable->filter_[0].checked = ui->checkBox_low_pass->checkState();
|
||||
variable->filter_[0].low = ui->spinBox_low_pass_low->value();
|
||||
variable->filter_[0].high = ui->spinBox_low_pass_high->value();
|
||||
variable->filter_[1].checked = ui->checkBox_high_pass->checkState();
|
||||
variable->filter_[1].low = ui->spinBox_high_pass_low->value();
|
||||
variable->filter_[1].high = ui->spinBox_high_pass_high->value();
|
||||
variable->filter_[2].checked = ui->checkBox_band_pass->checkState();
|
||||
variable->filter_[2].low = ui->spinBox_band_pass_low->value();
|
||||
variable->filter_[2].high = ui->spinBox_band_pass_high->value();
|
||||
variable->fixed = ui->radioButton_fixed->isChecked();
|
||||
variable->sample_rate = ui->lineEdit_sample_rate->text().toUInt();
|
||||
variable->bandwidth = ui->lineEdit_bandwidth->text().toInt();
|
||||
variable->fft_points = ui->comboBox_fft_points->currentText().toInt();
|
||||
variable->spectral_synchron = ui->checkBox_inherited->checkState();
|
||||
variable->measuring_min = ui->lineEdit_measuring_value_min->text().toInt();
|
||||
variable->measuring_max = ui->lineEdit_measuring_value_max->text().toInt();
|
||||
variable->scale_min = ui->lineEdit_scale_value_min->text().toInt();
|
||||
variable->scale_max = ui->lineEdit_scale_value_max->text().toInt();
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void PressurePulsation::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
30
pressure_pulsation.h
Normal file
30
pressure_pulsation.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef PRESSURE_PULSATION_H
|
||||
#define PRESSURE_PULSATION_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class PressurePulsation;
|
||||
}
|
||||
|
||||
class PressurePulsation : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PressurePulsation(int slot_no_, int channel_, bool active,QWidget *parent = nullptr);
|
||||
~PressurePulsation();
|
||||
int slot_no;
|
||||
int channel;
|
||||
|
||||
private slots:
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
private:
|
||||
Ui::PressurePulsation *ui;
|
||||
void Init();
|
||||
};
|
||||
|
||||
#endif // PRESSURE_PULSATION_H
|
807
pressure_pulsation.ui
Normal file
807
pressure_pulsation.ui
Normal file
@ -0,0 +1,807 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PressurePulsation</class>
|
||||
<widget class="QWidget" name="PressurePulsation">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>701</width>
|
||||
<height>519</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>351</x>
|
||||
<y>10</y>
|
||||
<width>63</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_57">
|
||||
<property name="text">
|
||||
<string>槽位号:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_slot">
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>31</x>
|
||||
<y>10</y>
|
||||
<width>105</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_58">
|
||||
<property name="text">
|
||||
<string>通道:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_channel">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_active">
|
||||
<property name="text">
|
||||
<string>(启用)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>450</y>
|
||||
<width>632</width>
|
||||
<height>37</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_set_default">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>设置为默认值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_print">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打印</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_help">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>帮助</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>651</width>
|
||||
<height>381</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
<string>传感器和滤波配置</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>353</width>
|
||||
<height>116</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>滤波</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_high_pass">
|
||||
<property name="text">
|
||||
<string>高通:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_high_pass_low">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_33">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_high_pass_high">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_32">
|
||||
<property name="text">
|
||||
<string>3 - 3000Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_low_pass">
|
||||
<property name="text">
|
||||
<string>低通:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_low_pass_low">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_low_pass_high">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="text">
|
||||
<string>30 - 30000Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_band_pass">
|
||||
<property name="text">
|
||||
<string>带通:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_band_pass_low">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_34">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_band_pass_high">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_35">
|
||||
<property name="text">
|
||||
<string>3 - 3000Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_6">
|
||||
<attribute name="title">
|
||||
<string>特征值和警报配置</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>471</width>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>采样频率</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>30</y>
|
||||
<width>397</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_fixed">
|
||||
<property name="text">
|
||||
<string>固定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>采样率:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_sample_rate">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>带宽:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_bandwidth">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>70</y>
|
||||
<width>118</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>FFT 点数:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_fft_points">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8192</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>100</y>
|
||||
<width>122</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>频率范围:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>5000 Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>130</y>
|
||||
<width>92</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>线数:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>1250 Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>160</y>
|
||||
<width>104</width>
|
||||
<height>14</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>频率分辨率:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>4 Hz</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_spectral">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<y>70</y>
|
||||
<width>141</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>光谱同步时间值</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>219</y>
|
||||
<width>471</width>
|
||||
<height>121</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>测量</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>最小:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>最大:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>20</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> 测量值</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>20</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>对应值</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_measuring_value_min">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>40</y>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_scale_value_min">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>40</y>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_measuring_value_max">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>80</y>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_scale_value_max">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>80</y>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>40</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mbar</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>80</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mbar</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>40</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mV</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>80</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mV</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_inherited">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>50</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>继承</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -13,6 +13,8 @@
|
||||
#include "config_mgr.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "trust.h"
|
||||
#include <QMessageBox>
|
||||
#include "pressure_pulsation.h"
|
||||
|
||||
Seismic_monitor::Seismic_monitor(int slot,int cardtype, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@ -49,7 +51,6 @@ void Seismic_monitor::Init() {
|
||||
// ui->comboBox_transducer_name_3->addItem(vec_transducer[var].transducer_name);
|
||||
// ui->comboBox_transducer_name_4->addItem(vec_transducer[var].transducer_name);
|
||||
// }
|
||||
int slot = 0;
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qDebug() << "base_ptr";
|
||||
@ -61,18 +62,7 @@ void Seismic_monitor::Init() {
|
||||
UpdateData(vib_data);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < SLOT_NUM; ++i) {
|
||||
if (ConfigMgr::Instance()->card_type_[i] == kCardNone) {
|
||||
continue;
|
||||
}
|
||||
QJsonObject card_item;
|
||||
slot = i + 1;
|
||||
card_item["type"] = ConfigMgr::Instance()->card_type_[i];
|
||||
card_item["slot"] = slot;
|
||||
if (ConfigMgr::Instance()->card_type_[i] == kCardKeyphaseSingle ) {
|
||||
ui->comboBox_keyphase_slot->addItem(QString::number(slot));
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
if (i + 1 == 1) {
|
||||
@ -193,6 +183,25 @@ void Seismic_monitor::on_pushButton_confirm_clicked() {
|
||||
// UpdateData(vib_data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase->isChecked()) {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "第一通道键相槽位选择错误!");
|
||||
return;
|
||||
}
|
||||
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_2->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase_2->isChecked()) {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "第二通道键相槽位选择错误!");
|
||||
return;
|
||||
}
|
||||
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_3->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase_3->isChecked()) {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "第三通道键相槽位选择错误!");
|
||||
return;
|
||||
}
|
||||
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_4->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase_4->isChecked()) {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "第四通道键相槽位选择错误!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
UpdateData(vib_data);
|
||||
this->close();
|
||||
@ -219,6 +228,10 @@ void Seismic_monitor::on_pushButton_config_1_clicked() {
|
||||
Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_1->isChecked());
|
||||
trust->setWindowModality(Qt::ApplicationModal);
|
||||
trust->show();
|
||||
}else if (ui->comboBox_chan_type_1->currentIndex() == kVibPressurePulsation) {
|
||||
PressurePulsation *pressure_pulsation = new PressurePulsation(slot_no, channel, ui->checkBox_enable_1->isChecked());
|
||||
pressure_pulsation->setWindowModality(Qt::ApplicationModal);
|
||||
pressure_pulsation->show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,9 +250,13 @@ void Seismic_monitor::on_pushButton_config_2_clicked() {
|
||||
velocity->setWindowModality(Qt::ApplicationModal);
|
||||
velocity->show();
|
||||
}else if (ui->comboBox_chan_type_2->currentIndex() == kVibThrust) {
|
||||
Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_1->isChecked());
|
||||
Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_2->isChecked());
|
||||
trust->setWindowModality(Qt::ApplicationModal);
|
||||
trust->show();
|
||||
}else if (ui->comboBox_chan_type_2->currentIndex() == kVibPressurePulsation) {
|
||||
PressurePulsation *pressure_pulsation = new PressurePulsation(slot_no, channel, ui->checkBox_enable_2->isChecked());
|
||||
pressure_pulsation->setWindowModality(Qt::ApplicationModal);
|
||||
pressure_pulsation->show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,9 +275,13 @@ void Seismic_monitor::on_pushButton_config_3_clicked() {
|
||||
velocity->setWindowModality(Qt::ApplicationModal);
|
||||
velocity->show();
|
||||
}else if (ui->comboBox_chan_type_3->currentIndex() == kVibThrust) {
|
||||
Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_1->isChecked());
|
||||
Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_3->isChecked());
|
||||
trust->setWindowModality(Qt::ApplicationModal);
|
||||
trust->show();
|
||||
}else if (ui->comboBox_chan_type_3->currentIndex() == kVibPressurePulsation) {
|
||||
PressurePulsation *pressure_pulsation = new PressurePulsation(slot_no, channel, ui->checkBox_enable_3->isChecked());
|
||||
pressure_pulsation->setWindowModality(Qt::ApplicationModal);
|
||||
pressure_pulsation->show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,9 +300,13 @@ void Seismic_monitor::on_pushButton_config_4_clicked() {
|
||||
velocity->setWindowModality(Qt::ApplicationModal);
|
||||
velocity->show();
|
||||
}else if (ui->comboBox_chan_type_4->currentIndex() == kVibThrust) {
|
||||
Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_1->isChecked());
|
||||
Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_4->isChecked());
|
||||
trust->setWindowModality(Qt::ApplicationModal);
|
||||
trust->show();
|
||||
}else if (ui->comboBox_chan_type_4->currentIndex() == kVibPressurePulsation) {
|
||||
PressurePulsation *pressure_pulsation = new PressurePulsation(slot_no, channel, ui->checkBox_enable_4->isChecked());
|
||||
pressure_pulsation->setWindowModality(Qt::ApplicationModal);
|
||||
pressure_pulsation->show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,15 +314,22 @@ void Seismic_monitor::on_comboBox_chan_type_1_currentTextChanged(const QString &
|
||||
switch (ui->comboBox_chan_type_1->currentIndex()) {
|
||||
case kVibRadial:
|
||||
ui->label_unit_1->setText("mV / mm");
|
||||
EnableKeyphase();
|
||||
break;
|
||||
case kVibAcc:
|
||||
ui->label_unit_1->setText("mV / m/s^2");
|
||||
EnableKeyphase();
|
||||
break;
|
||||
case kVibVelocity:
|
||||
ui->label_unit_1->setText("mV / mm/s");
|
||||
EnableKeyphase();
|
||||
break;
|
||||
case kVibThrust:
|
||||
ui->label_unit_1->setText("mV / mil");
|
||||
DisableKeyphase();
|
||||
break;
|
||||
case kVibPressurePulsation:
|
||||
DisableKeyphase();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -306,15 +338,22 @@ void Seismic_monitor::on_comboBox_chan_type_2_currentTextChanged(const QString &
|
||||
switch (ui->comboBox_chan_type_2->currentIndex()) {
|
||||
case kVibRadial:
|
||||
ui->label_unit_2->setText("mV / mm");
|
||||
EnableKeyphase();
|
||||
break;
|
||||
case kVibAcc:
|
||||
ui->label_unit_2->setText("mV / m/s^2");
|
||||
EnableKeyphase2();
|
||||
break;
|
||||
case kVibVelocity:
|
||||
ui->label_unit_2->setText("mV / mm/s");
|
||||
EnableKeyphase2();
|
||||
break;
|
||||
case kVibThrust:
|
||||
ui->label_unit_2->setText("mV / mil");
|
||||
DisableKeyphase2();
|
||||
break;
|
||||
case kVibPressurePulsation:
|
||||
DisableKeyphase2();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -323,15 +362,22 @@ void Seismic_monitor::on_comboBox_chan_type_3_currentTextChanged(const QString &
|
||||
switch (ui->comboBox_chan_type_3->currentIndex()) {
|
||||
case kVibRadial:
|
||||
ui->label_unit_3->setText("mV / mm");
|
||||
EnableKeyphase();
|
||||
break;
|
||||
case kVibAcc:
|
||||
ui->label_unit_3->setText("mV / m/s^2");
|
||||
EnableKeyphase3();
|
||||
break;
|
||||
case kVibVelocity:
|
||||
ui->label_unit_3->setText("mV / mm/s");
|
||||
EnableKeyphase3();
|
||||
break;
|
||||
case kVibThrust:
|
||||
ui->label_unit_3->setText("mV / mil");
|
||||
DisableKeyphase3();
|
||||
break;
|
||||
case kVibPressurePulsation:
|
||||
DisableKeyphase3();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -340,15 +386,22 @@ void Seismic_monitor::on_comboBox_chan_type_4_currentTextChanged(const QString &
|
||||
switch (ui->comboBox_chan_type_4->currentIndex()) {
|
||||
case kVibRadial:
|
||||
ui->label_unit_4->setText("mV / mm");
|
||||
EnableKeyphase4();
|
||||
break;
|
||||
case kVibAcc:
|
||||
ui->label_unit_4->setText("mV / m/s^2");
|
||||
EnableKeyphase4();
|
||||
break;
|
||||
case kVibVelocity:
|
||||
ui->label_unit_4->setText("mV / mm/s");
|
||||
EnableKeyphase4();
|
||||
break;
|
||||
case kVibThrust:
|
||||
ui->label_unit_4->setText("mV / mil");
|
||||
DisableKeyphase4();
|
||||
break;
|
||||
case kVibPressurePulsation:
|
||||
DisableKeyphase4();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -393,17 +446,20 @@ void Seismic_monitor::EnableKeyphase(){
|
||||
ui->checkBox_keyphase->setEnabled(true);
|
||||
ui->comboBox_keyphase_ch->setEnabled(true);
|
||||
ui->comboBox_keyphase_slot->setEnabled(true);
|
||||
|
||||
}
|
||||
void Seismic_monitor::EnableKeyphase2(){
|
||||
ui->checkBox_keyphase_2->setCheckable(true);
|
||||
ui->checkBox_keyphase_2->setEnabled(true);
|
||||
ui->comboBox_keyphase_ch_2->setEnabled(true);
|
||||
ui->comboBox_keyphase_slot_2->setEnabled(true);
|
||||
|
||||
}
|
||||
void Seismic_monitor::EnableKeyphase3(){
|
||||
ui->checkBox_keyphase_3->setCheckable(true);
|
||||
ui->checkBox_keyphase_3->setEnabled(true);
|
||||
ui->comboBox_keyphase_ch_3->setEnabled(true);
|
||||
ui->comboBox_keyphase_slot_3->setEnabled(true);
|
||||
|
||||
}
|
||||
void Seismic_monitor::EnableKeyphase4(){
|
||||
ui->checkBox_keyphase_4->setCheckable(true);
|
||||
ui->checkBox_keyphase_4->setEnabled(true);
|
||||
ui->comboBox_keyphase_ch_4->setEnabled(true);
|
||||
@ -414,17 +470,21 @@ void Seismic_monitor::DisableKeyphase(){
|
||||
ui->checkBox_keyphase->setEnabled(false);
|
||||
ui->comboBox_keyphase_ch->setEnabled(false);
|
||||
ui->comboBox_keyphase_slot->setEnabled(false);
|
||||
|
||||
}
|
||||
void Seismic_monitor::DisableKeyphase2(){
|
||||
ui->checkBox_keyphase_2->setCheckable(false);
|
||||
ui->checkBox_keyphase_2->setEnabled(false);
|
||||
ui->comboBox_keyphase_ch_2->setEnabled(false);
|
||||
ui->comboBox_keyphase_slot_2->setEnabled(false);
|
||||
|
||||
}
|
||||
void Seismic_monitor::DisableKeyphase3(){
|
||||
ui->checkBox_keyphase_3->setCheckable(false);
|
||||
ui->checkBox_keyphase_3->setEnabled(false);
|
||||
ui->comboBox_keyphase_ch_3->setEnabled(false);
|
||||
ui->comboBox_keyphase_slot_3->setEnabled(false);
|
||||
|
||||
}
|
||||
void Seismic_monitor::DisableKeyphase4(){
|
||||
ui->checkBox_keyphase_4->setCheckable(false);
|
||||
ui->checkBox_keyphase_4->setEnabled(false);
|
||||
ui->comboBox_keyphase_ch_4->setEnabled(false);
|
||||
|
@ -58,7 +58,13 @@ class Seismic_monitor : public QWidget {
|
||||
QVector<Transducer> vec_transducer;
|
||||
void Init();
|
||||
void EnableKeyphase();
|
||||
void EnableKeyphase2();
|
||||
void EnableKeyphase3();
|
||||
void EnableKeyphase4();
|
||||
void DisableKeyphase();
|
||||
void DisableKeyphase2();
|
||||
void DisableKeyphase3();
|
||||
void DisableKeyphase4();
|
||||
};
|
||||
|
||||
#endif // SEISMIC_MONITOR_H
|
||||
|
@ -402,6 +402,11 @@
|
||||
<string>轴向位移</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>动态压力脉动</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -658,7 +663,83 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_keyphase_slot"/>
|
||||
<widget class="QComboBox" name="comboBox_keyphase_slot">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>7</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>11</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>12</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>13</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>14</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>15</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
@ -876,6 +957,11 @@
|
||||
<string>轴向位移</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>动态压力脉动</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -1129,7 +1215,83 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_keyphase_slot_2"/>
|
||||
<widget class="QComboBox" name="comboBox_keyphase_slot_2">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>7</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>11</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>12</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>13</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>14</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>15</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_25">
|
||||
@ -1547,6 +1709,11 @@
|
||||
<string>轴向位移</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>动态压力脉动</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -1797,7 +1964,83 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_keyphase_slot_3"/>
|
||||
<widget class="QComboBox" name="comboBox_keyphase_slot_3">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>7</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>11</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>12</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>13</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>14</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>15</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_34">
|
||||
@ -2015,6 +2258,11 @@
|
||||
<string>轴向位移</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>动态压力脉动</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -2265,7 +2513,83 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_keyphase_slot_4"/>
|
||||
<widget class="QComboBox" name="comboBox_keyphase_slot_4">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>7</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>11</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>12</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>13</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>14</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>15</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_36">
|
||||
|
404
setpoint.cpp
404
setpoint.cpp
@ -26,12 +26,12 @@ Setpoint::Setpoint(int slot_no_,int cardtype,QWidget *parent) :
|
||||
|
||||
Setpoint::~Setpoint()
|
||||
{
|
||||
if(slider_direct != nullptr)
|
||||
delete slider_direct;
|
||||
if(slider_1x_ampl != nullptr)
|
||||
delete slider_1x_ampl;
|
||||
if(slider_2x_ampl != nullptr)
|
||||
delete slider_2x_ampl;
|
||||
if(slider_1st != nullptr)
|
||||
delete slider_1st;
|
||||
if(slider_2nd != nullptr)
|
||||
delete slider_2nd;
|
||||
if(slider_3rd != nullptr)
|
||||
delete slider_3rd;
|
||||
if(slider_danger != nullptr)
|
||||
delete slider_danger;
|
||||
delete ui;
|
||||
@ -39,57 +39,55 @@ Setpoint::~Setpoint()
|
||||
void Setpoint::Init(){
|
||||
|
||||
QVBoxLayout *layout_direct = new QVBoxLayout(ui->widget_direct);
|
||||
slider_direct = new RangeSlider;
|
||||
layout_direct->addWidget(slider_direct);
|
||||
slider_1st = new RangeSlider;
|
||||
layout_direct->addWidget(slider_1st);
|
||||
|
||||
QVBoxLayout *layout_1x_ampl = new QVBoxLayout(ui->widget_1x_ampl);
|
||||
slider_1x_ampl = new RangeSlider;
|
||||
layout_1x_ampl->addWidget(slider_1x_ampl);
|
||||
slider_2nd = new RangeSlider;
|
||||
layout_1x_ampl->addWidget(slider_2nd);
|
||||
|
||||
QVBoxLayout *layout_2x_ampl = new QVBoxLayout(ui->widget_2x_ampl);
|
||||
slider_2x_ampl = new RangeSlider;
|
||||
layout_2x_ampl->addWidget(slider_2x_ampl);
|
||||
slider_3rd = new RangeSlider;
|
||||
layout_2x_ampl->addWidget(slider_3rd);
|
||||
|
||||
QVBoxLayout *layout_danger = new QVBoxLayout(ui->widget_danger);
|
||||
slider_danger = new RangeSlider(1);
|
||||
layout_danger->addWidget(slider_danger);
|
||||
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
vib_alert_ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
|
||||
|
||||
switch (car_type) {
|
||||
case kCardVibSingle:{
|
||||
update();
|
||||
update();
|
||||
}break;
|
||||
}
|
||||
QObject::connect(ui->lineEdit_direct_upper, &QLineEdit::editingFinished, [&]() {
|
||||
slider_direct->setUpperValue(ui->lineEdit_direct_upper->text().toFloat());
|
||||
QObject::connect(ui->lineEdit_1st_upper, &QLineEdit::editingFinished, [&]() {
|
||||
slider_1st->setUpperValue(ui->lineEdit_1st_upper->text().toFloat());
|
||||
});
|
||||
QObject::connect(slider_direct, &RangeSlider::rangeChanged, [&](float low,float high) {
|
||||
ui->lineEdit_direct_upper->setText(QString::number(high));
|
||||
QObject::connect(slider_1st, &RangeSlider::rangeChanged, [&](float low,float high) {
|
||||
ui->lineEdit_1st_upper->setText(QString::number(high));
|
||||
});
|
||||
|
||||
QObject::connect(slider_1x_ampl, &RangeSlider::rangeChanged, [&](float low, float high) {
|
||||
ui->lineEdit_1x_ampl_upper->setText(QString::number(high));
|
||||
ui->lineEdit_1x_ampl_lower->setText(QString::number(low));
|
||||
QObject::connect(slider_2nd, &RangeSlider::rangeChanged, [&](float low, float high) {
|
||||
ui->lineEdit_2nd_upper->setText(QString::number(high));
|
||||
ui->lineEdit_2nd_lower->setText(QString::number(low));
|
||||
});
|
||||
QObject::connect(ui->lineEdit_1x_ampl_upper, &QLineEdit::editingFinished, [&]() {
|
||||
slider_1x_ampl->setUpperValue(ui->lineEdit_1x_ampl_upper->text().toFloat());
|
||||
QObject::connect(ui->lineEdit_2nd_upper, &QLineEdit::editingFinished, [&]() {
|
||||
slider_2nd->setUpperValue(ui->lineEdit_2nd_upper->text().toFloat());
|
||||
});
|
||||
QObject::connect(ui->lineEdit_1x_ampl_lower, &QLineEdit::editingFinished, [&]() {
|
||||
slider_1x_ampl->setLowerValue(ui->lineEdit_1x_ampl_lower->text().toFloat());
|
||||
QObject::connect(ui->lineEdit_2nd_lower, &QLineEdit::editingFinished, [&]() {
|
||||
slider_2nd->setLowerValue(ui->lineEdit_2nd_lower->text().toFloat());
|
||||
});
|
||||
|
||||
QObject::connect(slider_2x_ampl, &RangeSlider::rangeChanged, [&](float low, float high) {
|
||||
ui->lineEdit_2x_ampl_upper->setText(QString::number(high));
|
||||
ui->lineEdit_2x_ampl_lower->setText(QString::number(low));
|
||||
QObject::connect(slider_3rd, &RangeSlider::rangeChanged, [&](float low, float high) {
|
||||
ui->lineEdit_3rd_upper->setText(QString::number(high));
|
||||
ui->lineEdit_3rd_lower->setText(QString::number(low));
|
||||
});
|
||||
QObject::connect(ui->lineEdit_2x_ampl_upper, &QLineEdit::editingFinished, [&]() {
|
||||
slider_1x_ampl->setUpperValue(ui->lineEdit_2x_ampl_upper->text().toFloat());
|
||||
QObject::connect(ui->lineEdit_3rd_upper, &QLineEdit::editingFinished, [&]() {
|
||||
slider_2nd->setUpperValue(ui->lineEdit_3rd_upper->text().toFloat());
|
||||
});
|
||||
QObject::connect(ui->lineEdit_2x_ampl_lower, &QLineEdit::editingFinished, [&]() {
|
||||
slider_1x_ampl->setLowerValue(ui->lineEdit_2x_ampl_lower->text().toFloat());
|
||||
QObject::connect(ui->lineEdit_3rd_lower, &QLineEdit::editingFinished, [&]() {
|
||||
slider_2nd->setLowerValue(ui->lineEdit_3rd_lower->text().toFloat());
|
||||
});
|
||||
|
||||
QObject::connect(slider_danger, &RangeSlider::rangeChanged, [&](float low,float high) {
|
||||
@ -102,22 +100,32 @@ void Setpoint::Init(){
|
||||
|
||||
void Setpoint::on_pushButton_confirm_clicked()
|
||||
{
|
||||
if (vib_alert_ptr == nullptr) {
|
||||
qCritical() << "[Setpoint::confirm] should not be here";
|
||||
return;
|
||||
}
|
||||
|
||||
vib_alert_ptr->alert_danger[current_index].direct_upper = ui->lineEdit_direct_upper->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].direct_enable = ui->checkBox_direct->checkState();
|
||||
vib_alert_ptr->alert_danger[current_index].x1_ampl_upper = ui->lineEdit_1x_ampl_upper->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].x1_ampl_lower = ui->lineEdit_1x_ampl_lower->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].x1_ampl_enable = ui->checkBox_1x_ampl->checkState();
|
||||
vib_alert_ptr->alert_danger[current_index].x2_ampl_upper = ui->lineEdit_2x_ampl_upper->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].x2_ampl_lower = ui->lineEdit_2x_ampl_lower->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].x2_ampl_enable = ui->checkBox_2x_ampl->checkState();
|
||||
vib_alert_ptr->alert_danger[current_index].danger_param = ui->comboBox_danger->currentIndex();
|
||||
vib_alert_ptr->alert_danger[current_index].danger_upper = ui->lineEdit_danger_upper->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].danger_enable = ui->checkBox_danger->checkState();
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
std::shared_ptr<VibrationData> setpoint_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if(setpoint_data->base_config_[current_index].channel_type == kVibPressurePulsation){
|
||||
setpoint_data->alert_danger_press[current_index].low_upper = ui->lineEdit_1st_upper->text().toFloat();
|
||||
setpoint_data->alert_danger_press[current_index].low_enable = ui->checkBox_1st->checkState();
|
||||
setpoint_data->alert_danger_press[current_index].mid1_upper = ui->lineEdit_2nd_upper->text().toFloat();
|
||||
setpoint_data->alert_danger_press[current_index].mid1_enable = ui->checkBox_2nd->checkState();
|
||||
setpoint_data->alert_danger_press[current_index].mid2_upper = ui->lineEdit_3rd_upper->text().toFloat();
|
||||
setpoint_data->alert_danger_press[current_index].mid2_enable = ui->checkBox_3rd->checkState();
|
||||
setpoint_data->alert_danger_press[current_index].danger_param = ui->comboBox_danger->currentIndex();
|
||||
setpoint_data->alert_danger_press[current_index].danger_upper = ui->lineEdit_danger_upper->text().toFloat();
|
||||
setpoint_data->alert_danger_press[current_index].danger_enable = ui->checkBox_danger->checkState();
|
||||
}else{
|
||||
setpoint_data->alert_danger[current_index].direct_upper = ui->lineEdit_1st_upper->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].direct_enable = ui->checkBox_1st->checkState();
|
||||
setpoint_data->alert_danger[current_index].x1_ampl_upper = ui->lineEdit_2nd_upper->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].x1_ampl_lower = ui->lineEdit_2nd_lower->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].x1_ampl_enable = ui->checkBox_2nd->checkState();
|
||||
setpoint_data->alert_danger[current_index].x2_ampl_upper = ui->lineEdit_3rd_upper->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].x2_ampl_lower = ui->lineEdit_3rd_lower->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].x2_ampl_enable = ui->checkBox_3rd->checkState();
|
||||
setpoint_data->alert_danger[current_index].danger_param = ui->comboBox_danger->currentIndex();
|
||||
setpoint_data->alert_danger[current_index].danger_upper = ui->lineEdit_danger_upper->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].danger_enable = ui->checkBox_danger->checkState();
|
||||
}
|
||||
this->close();
|
||||
}
|
||||
|
||||
@ -134,20 +142,34 @@ void Setpoint::on_pushButton_set_default_clicked()
|
||||
}
|
||||
void Setpoint::onComboBoxIndexChanged(int index){
|
||||
|
||||
vib_alert_ptr->alert_danger[current_index].direct_upper = ui->lineEdit_direct_upper->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].direct_enable = ui->checkBox_direct->checkState();
|
||||
vib_alert_ptr->alert_danger[current_index].x1_ampl_upper = ui->lineEdit_1x_ampl_upper->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].x1_ampl_lower = ui->lineEdit_1x_ampl_lower->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].x1_ampl_enable = ui->checkBox_1x_ampl->checkState();
|
||||
vib_alert_ptr->alert_danger[current_index].x2_ampl_upper = ui->lineEdit_2x_ampl_upper->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].x2_ampl_lower = ui->lineEdit_2x_ampl_lower->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].x2_ampl_enable = ui->checkBox_2x_ampl->checkState();
|
||||
vib_alert_ptr->alert_danger[current_index].danger_param = ui->comboBox_danger->currentIndex();
|
||||
vib_alert_ptr->alert_danger[current_index].danger_upper = ui->lineEdit_danger_upper->text().toFloat();
|
||||
vib_alert_ptr->alert_danger[current_index].danger_enable = ui->checkBox_danger->checkState();
|
||||
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
std::shared_ptr<VibrationData> setpoint_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if(setpoint_data->base_config_[current_index].channel_type == kVibPressurePulsation){
|
||||
setpoint_data->alert_danger_press[current_index].low_upper = ui->lineEdit_1st_upper->text().toFloat();
|
||||
setpoint_data->alert_danger_press[current_index].low_enable = ui->checkBox_1st->checkState();
|
||||
setpoint_data->alert_danger_press[current_index].mid1_upper = ui->lineEdit_2nd_upper->text().toFloat();
|
||||
setpoint_data->alert_danger_press[current_index].mid1_enable = ui->checkBox_2nd->checkState();
|
||||
setpoint_data->alert_danger_press[current_index].mid2_upper = ui->lineEdit_3rd_upper->text().toFloat();
|
||||
setpoint_data->alert_danger_press[current_index].mid2_enable = ui->checkBox_3rd->checkState();
|
||||
setpoint_data->alert_danger_press[current_index].danger_param = ui->comboBox_danger->currentIndex();
|
||||
setpoint_data->alert_danger_press[current_index].danger_upper = ui->lineEdit_danger_upper->text().toFloat();
|
||||
setpoint_data->alert_danger_press[current_index].danger_enable = ui->checkBox_danger->checkState();
|
||||
}else{
|
||||
setpoint_data->alert_danger[current_index].direct_upper = ui->lineEdit_1st_upper->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].direct_enable = ui->checkBox_1st->checkState();
|
||||
setpoint_data->alert_danger[current_index].x1_ampl_upper = ui->lineEdit_2nd_upper->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].x1_ampl_lower = ui->lineEdit_2nd_lower->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].x1_ampl_enable = ui->checkBox_2nd->checkState();
|
||||
setpoint_data->alert_danger[current_index].x2_ampl_upper = ui->lineEdit_3rd_upper->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].x2_ampl_lower = ui->lineEdit_3rd_lower->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].x2_ampl_enable = ui->checkBox_3rd->checkState();
|
||||
setpoint_data->alert_danger[current_index].danger_param = ui->comboBox_danger->currentIndex();
|
||||
setpoint_data->alert_danger[current_index].danger_upper = ui->lineEdit_danger_upper->text().toFloat();
|
||||
setpoint_data->alert_danger[current_index].danger_enable = ui->checkBox_danger->checkState();
|
||||
}
|
||||
current_index = index;
|
||||
update();
|
||||
|
||||
}
|
||||
void Setpoint::update()
|
||||
{
|
||||
@ -161,218 +183,300 @@ void Setpoint::update()
|
||||
return;
|
||||
}
|
||||
if(!variable_[chan]->x1_.checked){
|
||||
ui->checkBox_1x_ampl->setEnabled(false);
|
||||
ui->lineEdit_1x_ampl_lower->setEnabled(false);
|
||||
ui->lineEdit_1x_ampl_upper->setEnabled(false);
|
||||
ui->checkBox_1st->setEnabled(false);
|
||||
ui->lineEdit_2nd_lower->setEnabled(false);
|
||||
ui->lineEdit_2nd_upper->setEnabled(false);
|
||||
}
|
||||
if(!variable_[chan]->x2_.checked){
|
||||
ui->checkBox_2x_ampl->setEnabled(false);
|
||||
ui->lineEdit_2x_ampl_upper->setEnabled(false);
|
||||
ui->lineEdit_2x_ampl_lower->setEnabled(false);
|
||||
ui->checkBox_2nd->setEnabled(false);
|
||||
ui->lineEdit_3rd_upper->setEnabled(false);
|
||||
ui->lineEdit_3rd_lower->setEnabled(false);
|
||||
}
|
||||
if(setpoint_data->base_config_[chan].channel_type == kVibRadial){
|
||||
|
||||
EnableNormal();
|
||||
ShowSlider();
|
||||
if(variable_[chan]->direct_.full_scale_range == 0){
|
||||
slider_direct->setRange(0,100);
|
||||
slider_1st->setRange(0,100);
|
||||
slider_danger->setRange(0,100);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 1){
|
||||
slider_direct->setRange(0,150);
|
||||
slider_1st->setRange(0,150);
|
||||
slider_danger->setRange(0,150);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 2){
|
||||
slider_direct->setRange(0,200);
|
||||
slider_1st->setRange(0,200);
|
||||
slider_danger->setRange(0,200);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 3){
|
||||
slider_direct->setRange(0,400);
|
||||
slider_1st->setRange(0,400);
|
||||
slider_danger->setRange(0,400);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 4){
|
||||
slider_direct->setRange(0,500);
|
||||
slider_1st->setRange(0,500);
|
||||
slider_danger->setRange(0,500);
|
||||
}
|
||||
ui->label_direct->setText("um");
|
||||
ui->label_unit_1st->setText("um");
|
||||
ui->label_danger->setText("um");
|
||||
|
||||
}
|
||||
if(setpoint_data->base_config_[chan].channel_type == kVibThrust){
|
||||
ui->label_27->hide();
|
||||
ui->label_1x->hide();
|
||||
ui->lineEdit_1x_ampl_upper->hide();
|
||||
EnableNormal();
|
||||
ui->label_2nd->hide();
|
||||
ui->label_unit_2nd->hide();
|
||||
ui->lineEdit_2nd_upper->hide();
|
||||
ui->widget_1x_ampl->hide();
|
||||
ui->lineEdit_1x_ampl_lower->hide();
|
||||
ui->checkBox_1x_ampl->hide();
|
||||
|
||||
ui->label_32->hide();
|
||||
ui->label_2x->hide();
|
||||
ui->lineEdit_2x_ampl_upper->hide();
|
||||
ui->lineEdit_2nd_lower->hide();
|
||||
ui->checkBox_2nd->hide();
|
||||
ui->label_3rd->hide();
|
||||
ui->label_unit_3rd->hide();
|
||||
ui->lineEdit_3rd_upper->hide();
|
||||
ui->widget_2x_ampl->hide();
|
||||
ui->lineEdit_2x_ampl_lower->hide();
|
||||
ui->checkBox_2x_ampl->hide();
|
||||
ui->label_direct->setText("mil");
|
||||
ui->lineEdit_3rd_lower->hide();
|
||||
ui->checkBox_3rd->hide();
|
||||
ui->label_unit_1st->setText("mil");
|
||||
ui->label_danger->setText("mil");
|
||||
if(variable_[chan]->direct_.full_scale_range == 0){
|
||||
slider_direct->setRange(-25,25);
|
||||
slider_1st->setRange(-25,25);
|
||||
slider_danger->setRange(-25,25);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 1){
|
||||
slider_direct->setRange(-30,30);
|
||||
slider_1st->setRange(-30,30);
|
||||
slider_danger->setRange(-30,30);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 2){
|
||||
slider_direct->setRange(-40,40);
|
||||
slider_1st->setRange(-40,40);
|
||||
slider_danger->setRange(-40,40);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 3){
|
||||
ui->label_direct->setText("mm");
|
||||
ui->label_unit_1st->setText("mm");
|
||||
ui->label_danger->setText("mm");
|
||||
slider_direct->setRange(-0.5,0.5);
|
||||
slider_1st->setRange(-0.5,0.5);
|
||||
slider_danger->setRange(-0.5,0.5);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 4){
|
||||
ui->label_direct->setText("mm");
|
||||
ui->label_unit_1st->setText("mm");
|
||||
ui->label_danger->setText("mm");
|
||||
slider_direct->setRange(-1,1);
|
||||
slider_1st->setRange(-1,1);
|
||||
slider_danger->setRange(-1,1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(setpoint_data->base_config_[chan].channel_type == kVibAcc){
|
||||
EnableNormal();
|
||||
ShowSlider();
|
||||
std::shared_ptr<VariableBase> base_channel_ptr = setpoint_data->GetChannelPtr(chan + 1);
|
||||
std::shared_ptr<AccVelVariable> av_ptr = std::dynamic_pointer_cast<AccVelVariable>(base_channel_ptr);
|
||||
if(variable_[chan]->direct_.full_scale_range == 0){
|
||||
slider_direct->setRange(0,20);
|
||||
slider_1st->setRange(0,20);
|
||||
slider_danger->setRange(0,20);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 1){
|
||||
slider_direct->setRange(0,50);
|
||||
slider_1st->setRange(0,50);
|
||||
slider_danger->setRange(0,50);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 2){
|
||||
slider_direct->setRange(0,100);
|
||||
slider_1st->setRange(0,100);
|
||||
slider_danger->setRange(0,100);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 3){
|
||||
slider_direct->setRange(0,200);
|
||||
slider_1st->setRange(0,200);
|
||||
slider_danger->setRange(0,200);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 4){
|
||||
slider_direct->setRange(0,250);
|
||||
slider_1st->setRange(0,250);
|
||||
slider_danger->setRange(0,250);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 5){
|
||||
slider_direct->setRange(0,400);
|
||||
slider_1st->setRange(0,400);
|
||||
slider_danger->setRange(0,400);
|
||||
}
|
||||
ui->label_direct->setText("m/s^2 pk");
|
||||
ui->label_unit_1st->setText("m/s^2 pk");
|
||||
ui->label_danger->setText("m/s^2 pk");
|
||||
|
||||
if(av_ptr->rms_active_){
|
||||
if(variable_[chan]->direct_.full_scale_range == 0){
|
||||
slider_direct->setRange(0,20);
|
||||
slider_1st->setRange(0,20);
|
||||
slider_danger->setRange(0,20);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 1){
|
||||
slider_direct->setRange(0,50);
|
||||
slider_1st->setRange(0,50);
|
||||
slider_danger->setRange(0,50);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 2){
|
||||
slider_direct->setRange(0,100);
|
||||
slider_1st->setRange(0,100);
|
||||
slider_danger->setRange(0,100);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 3){
|
||||
slider_direct->setRange(0,200);
|
||||
slider_1st->setRange(0,200);
|
||||
slider_danger->setRange(0,200);
|
||||
}
|
||||
ui->label_direct->setText("m/s^2 rms");
|
||||
ui->label_unit_1st->setText("m/s^2 rms");
|
||||
ui->label_danger->setText("m/s^2 rms");
|
||||
}
|
||||
|
||||
if(av_ptr->integrate_active_){
|
||||
if(variable_[chan]->direct_.full_scale_range == 0){
|
||||
slider_direct->setRange(0,25);
|
||||
slider_1st->setRange(0,25);
|
||||
slider_danger->setRange(0,25);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 1){
|
||||
slider_direct->setRange(0,50);
|
||||
slider_1st->setRange(0,50);
|
||||
slider_danger->setRange(0,50);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 2){
|
||||
slider_direct->setRange(0,100);
|
||||
slider_1st->setRange(0,100);
|
||||
slider_danger->setRange(0,100);
|
||||
}
|
||||
ui->label_direct->setText("mm/s pk");
|
||||
ui->label_unit_1st->setText("mm/s pk");
|
||||
ui->label_danger->setText("mm/s pk");
|
||||
}
|
||||
|
||||
if(av_ptr->rms_active_ && av_ptr->integrate_active_){
|
||||
if(variable_[chan]->direct_.full_scale_range == 0){
|
||||
slider_direct->setRange(0,25);
|
||||
slider_1st->setRange(0,25);
|
||||
slider_danger->setRange(0,25);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 1){
|
||||
slider_direct->setRange(0,50);
|
||||
slider_1st->setRange(0,50);
|
||||
slider_danger->setRange(0,50);
|
||||
}
|
||||
ui->label_direct->setText("mm/s rms");
|
||||
ui->label_unit_1st->setText("mm/s rms");
|
||||
ui->label_danger->setText("mm/s rms");
|
||||
}
|
||||
|
||||
}
|
||||
if(setpoint_data->base_config_[chan].channel_type == kVibVelocity){
|
||||
EnableNormal();
|
||||
ShowSlider();
|
||||
std::shared_ptr<VariableBase> base_channel_ptr = setpoint_data->GetChannelPtr(chan + 1);
|
||||
std::shared_ptr<AccVelVariable> av_ptr = std::dynamic_pointer_cast<AccVelVariable>(base_channel_ptr);
|
||||
|
||||
if(variable_[chan]->direct_.full_scale_range == 0){
|
||||
slider_direct->setRange(0,10);
|
||||
slider_1st->setRange(0,10);
|
||||
slider_danger->setRange(0,10);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 1){
|
||||
slider_direct->setRange(0,20);
|
||||
slider_1st->setRange(0,20);
|
||||
slider_danger->setRange(0,20);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 2){
|
||||
slider_direct->setRange(0,50);
|
||||
slider_1st->setRange(0,50);
|
||||
slider_danger->setRange(0,50);
|
||||
}
|
||||
ui->label_direct->setText("mm/s pk");
|
||||
ui->label_unit_1st->setText("mm/s pk");
|
||||
ui->label_danger->setText("mm/s pk");
|
||||
|
||||
if(av_ptr->rms_active_){
|
||||
if(variable_[chan]->direct_.full_scale_range == 0){
|
||||
slider_direct->setRange(0,10);
|
||||
slider_1st->setRange(0,10);
|
||||
slider_danger->setRange(0,10);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 1){
|
||||
slider_direct->setRange(0,20);
|
||||
slider_1st->setRange(0,20);
|
||||
slider_danger->setRange(0,20);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 2){
|
||||
slider_direct->setRange(0,50);
|
||||
slider_1st->setRange(0,50);
|
||||
slider_danger->setRange(0,50);
|
||||
}
|
||||
ui->label_direct->setText("mm/s rms");
|
||||
ui->label_unit_1st->setText("mm/s rms");
|
||||
ui->label_danger->setText("mm/s rms");
|
||||
}
|
||||
|
||||
if(av_ptr->integrate_active_){
|
||||
if(variable_[chan]->direct_.full_scale_range == 0){
|
||||
slider_direct->setRange(0,100);
|
||||
slider_1st->setRange(0,100);
|
||||
slider_danger->setRange(0,100);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 1){
|
||||
slider_direct->setRange(0,200);
|
||||
slider_1st->setRange(0,200);
|
||||
slider_danger->setRange(0,200);
|
||||
}else if(variable_[chan]->direct_.full_scale_range == 2){
|
||||
slider_direct->setRange(0,500);
|
||||
slider_1st->setRange(0,500);
|
||||
slider_danger->setRange(0,500);
|
||||
}
|
||||
ui->label_direct->setText("um pp");
|
||||
ui->label_unit_1st->setText("um pp");
|
||||
ui->label_danger->setText("um pp");
|
||||
}
|
||||
}
|
||||
if(setpoint_data->base_config_[chan].channel_type == kVibPressurePulsation){
|
||||
ShowSlider();
|
||||
ui->label_1st->setText("低频段");
|
||||
ui->label_2nd->setText("中1频段");
|
||||
ui->label_3rd->setText("中2频段");
|
||||
ui->comboBox_danger->clear();
|
||||
ui->comboBox_danger->addItem("全频段");
|
||||
ui->checkBox_1st->setEnabled(true);
|
||||
ui->checkBox_2nd->setEnabled(true);
|
||||
ui->checkBox_3rd->setEnabled(true);
|
||||
ui->lineEdit_2nd_lower->hide();
|
||||
ui->lineEdit_2nd_upper->setEnabled(true);
|
||||
ui->lineEdit_3rd_lower->hide();
|
||||
ui->lineEdit_3rd_upper->setEnabled(true);
|
||||
ui->label_unit_1st->setText("kPa");
|
||||
ui->label_unit_2nd->setText("kPa");
|
||||
ui->label_unit_3rd->setText("kPa");
|
||||
ui->label_danger->setText("kPa");
|
||||
slider_1st->setRange(0,10);
|
||||
slider_2nd->setRange(0,10);
|
||||
slider_3rd->setRange(0,10);
|
||||
slider_danger->setRange(0,40);
|
||||
ui->lineEdit_1st_upper->setText(QString::number(setpoint_data->alert_danger_press[chan].low_upper));
|
||||
ui->checkBox_1st->setChecked(setpoint_data->alert_danger_press[chan].low_enable);
|
||||
if(setpoint_data->alert_danger_press[chan].low_upper > 0){
|
||||
slider_1st->m_upper = setpoint_data->alert_danger_press[chan].low_upper;
|
||||
slider_1st->m_lower = 0;
|
||||
}
|
||||
|
||||
}
|
||||
ui->lineEdit_direct_upper->setText(QString::number(setpoint_data->alert_danger[chan].direct_upper));
|
||||
ui->checkBox_direct->setChecked(setpoint_data->alert_danger[chan].direct_enable);
|
||||
if(setpoint_data->alert_danger[chan].direct_upper > 0){
|
||||
slider_direct->m_upper = setpoint_data->alert_danger[chan].direct_upper;
|
||||
}
|
||||
ui->lineEdit_1x_ampl_upper->setText(QString::number(setpoint_data->alert_danger[chan].x1_ampl_upper));
|
||||
ui->lineEdit_1x_ampl_lower->setText(QString::number(setpoint_data->alert_danger[chan].x1_ampl_lower));
|
||||
ui->checkBox_1x_ampl->setChecked(setpoint_data->alert_danger[chan].x1_ampl_enable);
|
||||
if(setpoint_data->alert_danger[chan].x1_ampl_upper > 0 && setpoint_data->alert_danger[chan].x1_ampl_lower > 0){
|
||||
slider_1x_ampl->m_upper = setpoint_data->alert_danger[chan].x1_ampl_upper;
|
||||
slider_1x_ampl->m_lower = setpoint_data->alert_danger[chan].x1_ampl_lower;
|
||||
}
|
||||
ui->lineEdit_2x_ampl_upper->setText(QString::number(setpoint_data->alert_danger[chan].x2_ampl_upper));
|
||||
ui->lineEdit_2x_ampl_lower->setText(QString::number(setpoint_data->alert_danger[chan].x2_ampl_lower));
|
||||
ui->checkBox_2x_ampl->setChecked(setpoint_data->alert_danger[chan].x2_ampl_enable);
|
||||
if(setpoint_data->alert_danger[chan].x2_ampl_upper > 0 && setpoint_data->alert_danger[chan].x2_ampl_lower > 0){
|
||||
slider_2x_ampl->m_upper = setpoint_data->alert_danger[chan].x2_ampl_upper;
|
||||
slider_2x_ampl->m_lower = setpoint_data->alert_danger[chan].x2_ampl_lower;
|
||||
}
|
||||
ui->lineEdit_danger_upper->setText(QString::number(setpoint_data->alert_danger[chan].danger_upper));
|
||||
ui->checkBox_danger->setChecked(setpoint_data->alert_danger[chan].danger_enable);
|
||||
if(setpoint_data->alert_danger[chan].danger_upper > 0){
|
||||
slider_danger->m_upper = setpoint_data->alert_danger[chan].danger_upper;
|
||||
slider_danger->m_lower = 0;
|
||||
ui->lineEdit_2nd_upper->setText(QString::number(setpoint_data->alert_danger_press[chan].mid1_upper));
|
||||
ui->checkBox_2nd->setChecked(setpoint_data->alert_danger_press[chan].mid1_enable);
|
||||
if(setpoint_data->alert_danger_press[chan].mid1_upper > 0){
|
||||
slider_2nd->m_upper = setpoint_data->alert_danger_press[chan].mid1_upper;
|
||||
slider_2nd->m_lower = 0;
|
||||
}
|
||||
ui->lineEdit_3rd_upper->setText(QString::number(setpoint_data->alert_danger_press[chan].mid2_upper));
|
||||
ui->checkBox_3rd->setChecked(setpoint_data->alert_danger_press[chan].mid2_enable);
|
||||
if(setpoint_data->alert_danger_press[chan].mid2_upper > 0){
|
||||
slider_3rd->m_upper = setpoint_data->alert_danger_press[chan].mid2_upper;
|
||||
slider_3rd->m_lower = 0;
|
||||
}
|
||||
ui->lineEdit_danger_upper->setText(QString::number(setpoint_data->alert_danger_press[chan].danger_upper));
|
||||
ui->checkBox_danger->setChecked(setpoint_data->alert_danger_press[chan].danger_enable);
|
||||
if(setpoint_data->alert_danger_press[chan].danger_upper > 0){
|
||||
slider_danger->m_upper = setpoint_data->alert_danger_press[chan].danger_upper;
|
||||
slider_danger->m_lower = 0;
|
||||
}
|
||||
}else{
|
||||
ui->lineEdit_1st_upper->setText(QString::number(setpoint_data->alert_danger[chan].direct_upper));
|
||||
ui->checkBox_1st->setChecked(setpoint_data->alert_danger[chan].direct_enable);
|
||||
if(setpoint_data->alert_danger[chan].direct_upper > 0){
|
||||
slider_1st->m_upper = setpoint_data->alert_danger[chan].direct_upper;
|
||||
slider_1st->m_lower = 0;
|
||||
}
|
||||
ui->lineEdit_2nd_upper->setText(QString::number(setpoint_data->alert_danger[chan].x1_ampl_upper));
|
||||
ui->lineEdit_2nd_lower->setText(QString::number(setpoint_data->alert_danger[chan].x1_ampl_lower));
|
||||
ui->checkBox_2nd->setChecked(setpoint_data->alert_danger[chan].x1_ampl_enable);
|
||||
if(setpoint_data->alert_danger[chan].x1_ampl_upper > 0 && setpoint_data->alert_danger[chan].x1_ampl_lower > 0){
|
||||
slider_2nd->m_upper = setpoint_data->alert_danger[chan].x1_ampl_upper;
|
||||
slider_2nd->m_lower = setpoint_data->alert_danger[chan].x1_ampl_lower;
|
||||
}
|
||||
ui->lineEdit_3rd_upper->setText(QString::number(setpoint_data->alert_danger[chan].x2_ampl_upper));
|
||||
ui->lineEdit_3rd_lower->setText(QString::number(setpoint_data->alert_danger[chan].x2_ampl_lower));
|
||||
ui->checkBox_3rd->setChecked(setpoint_data->alert_danger[chan].x2_ampl_enable);
|
||||
if(setpoint_data->alert_danger[chan].x2_ampl_upper > 0 && setpoint_data->alert_danger[chan].x2_ampl_lower > 0){
|
||||
slider_3rd->m_upper = setpoint_data->alert_danger[chan].x2_ampl_upper;
|
||||
slider_3rd->m_lower = setpoint_data->alert_danger[chan].x2_ampl_lower;
|
||||
}
|
||||
ui->lineEdit_danger_upper->setText(QString::number(setpoint_data->alert_danger[chan].danger_upper));
|
||||
ui->checkBox_danger->setChecked(setpoint_data->alert_danger[chan].danger_enable);
|
||||
if(setpoint_data->alert_danger[chan].danger_upper > 0){
|
||||
slider_danger->m_upper = setpoint_data->alert_danger[chan].danger_upper;
|
||||
slider_danger->m_lower = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Setpoint::EnableNormal(){
|
||||
ui->label_1st->setText("直接值");
|
||||
ui->label_2nd->setText("1倍频幅值");
|
||||
ui->label_3rd->setText("2倍频幅值");
|
||||
ui->comboBox_danger->clear();
|
||||
QStringList items = {"直接值", "1倍频幅值", "2倍频幅值"};
|
||||
ui->comboBox_danger->addItems(items);
|
||||
ui->checkBox_2nd->setChecked(false);
|
||||
ui->checkBox_3rd->setChecked(false);
|
||||
ui->label_unit_2nd->setText("- -");
|
||||
ui->label_unit_3rd->setText("- -");
|
||||
}
|
||||
|
||||
void Setpoint::ShowSlider(){
|
||||
ui->label_2nd->show();
|
||||
ui->label_unit_2nd->show();
|
||||
ui->lineEdit_2nd_upper->show();
|
||||
ui->widget_1x_ampl->show();
|
||||
ui->lineEdit_2nd_lower->show();
|
||||
ui->checkBox_1st->show();
|
||||
|
||||
ui->label_3rd->show();
|
||||
ui->label_unit_3rd->show();
|
||||
ui->lineEdit_3rd_upper->show();
|
||||
ui->widget_2x_ampl->show();
|
||||
ui->lineEdit_3rd_lower->show();
|
||||
ui->checkBox_2nd->show();
|
||||
}
|
||||
|
10
setpoint.h
10
setpoint.h
@ -30,14 +30,16 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui::Setpoint *ui;
|
||||
RangeSlider *slider_direct;
|
||||
RangeSlider *slider_1x_ampl;
|
||||
RangeSlider *slider_2x_ampl;
|
||||
RangeSlider *slider_1st;
|
||||
RangeSlider *slider_2nd;
|
||||
RangeSlider *slider_3rd;
|
||||
RangeSlider *slider_danger;
|
||||
std::shared_ptr<VibrationData> vib_alert_ptr = nullptr;
|
||||
int current_index;
|
||||
void Init();
|
||||
void update();
|
||||
void EnbalePressurePulsation();
|
||||
void EnableNormal();
|
||||
void ShowSlider();
|
||||
};
|
||||
|
||||
#endif // SETPOINT_H
|
||||
|
28
setpoint.ui
28
setpoint.ui
@ -297,7 +297,7 @@
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_27">
|
||||
<widget class="QLabel" name="label_2nd">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>121</x>
|
||||
@ -310,7 +310,7 @@
|
||||
<string>1倍频幅值</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_1x_ampl_upper">
|
||||
<widget class="QLineEdit" name="lineEdit_2nd_upper">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>121</x>
|
||||
@ -332,7 +332,7 @@
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_1x">
|
||||
<widget class="QLabel" name="label_unit_2nd">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
@ -357,7 +357,7 @@
|
||||
<string>- -</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_1x_ampl_lower">
|
||||
<widget class="QLineEdit" name="lineEdit_2nd_lower">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
@ -379,7 +379,7 @@
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_1x_ampl">
|
||||
<widget class="QCheckBox" name="checkBox_2nd">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>121</x>
|
||||
@ -392,7 +392,7 @@
|
||||
<string>启用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_2x_ampl">
|
||||
<widget class="QCheckBox" name="checkBox_3rd">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>221</x>
|
||||
@ -405,7 +405,7 @@
|
||||
<string>启用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_32">
|
||||
<widget class="QLabel" name="label_3rd">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>221</x>
|
||||
@ -418,7 +418,7 @@
|
||||
<string>2倍频幅值</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2x">
|
||||
<widget class="QLabel" name="label_unit_3rd">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
@ -443,7 +443,7 @@
|
||||
<string>- -</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_2x_ampl_upper">
|
||||
<widget class="QLineEdit" name="lineEdit_3rd_upper">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>221</x>
|
||||
@ -487,7 +487,7 @@
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_2x_ampl_lower">
|
||||
<widget class="QLineEdit" name="lineEdit_3rd_lower">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
@ -509,7 +509,7 @@
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_direct_upper">
|
||||
<widget class="QLineEdit" name="lineEdit_1st_upper">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
@ -556,7 +556,7 @@
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_21">
|
||||
<widget class="QLabel" name="label_1st">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
@ -572,7 +572,7 @@
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_direct">
|
||||
<widget class="QLabel" name="label_unit_1st">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>25</x>
|
||||
@ -600,7 +600,7 @@
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_direct">
|
||||
<widget class="QCheckBox" name="checkBox_1st">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
|
329
singlerelay.cpp
329
singlerelay.cpp
@ -1,6 +1,9 @@
|
||||
#include "singlerelay.h"
|
||||
#include "ui_singlerelay.h"
|
||||
#include "vibrationdata.h"
|
||||
#include <QStack>
|
||||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
|
||||
SingleRelay::SingleRelay(int slot,int cardtype,QWidget *parent)
|
||||
: QDialog(parent)
|
||||
@ -47,14 +50,12 @@ SingleRelay::SingleRelay(int slot,int cardtype,QWidget *parent)
|
||||
connect(btnGroup_slot, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(OnButtonGroup(QAbstractButton *)));
|
||||
connect(ui->comboBox_relay_ch, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &SingleRelay::onComboBoxIndexChanged);
|
||||
Init();
|
||||
treeView_relay->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(treeView_relay,&QTreeView::customContextMenuRequested,this,&SingleRelay::on_treeView_Relay_customContextMenuRequested);
|
||||
current_index = ui->comboBox_relay_ch->currentIndex();
|
||||
if(single_relay_nok_data->single_relay_nok[current_index].logic_expression != ""){
|
||||
QString channel_name = channelNameMap[single_relay_nok_data->single_relay_nok[current_index].logic_expression];
|
||||
QStandardItem *item = new QStandardItem(channel_name);
|
||||
item->setData(single_relay_nok_data->single_relay_nok[current_index].logic_expression,Qt::UserRole);
|
||||
model_Relay->appendRow(item);
|
||||
}
|
||||
Init();
|
||||
onComboBoxIndexChanged(current_index);
|
||||
|
||||
}
|
||||
|
||||
SingleRelay::~SingleRelay() {
|
||||
@ -93,29 +94,46 @@ void SingleRelay::Init(){
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
// do nothing or use template to init it.
|
||||
single_relay_nok_data = std::make_shared<SingleRelayDataNOK>();
|
||||
single_relay_nok_data->card_type_ = car_type;
|
||||
single_relay_nok_data->slot_ = slot_no;
|
||||
ConfigMgr::Instance()->AddCard(single_relay_nok_data);
|
||||
relay_data = std::make_shared<SingleRelayData>();
|
||||
relay_data->card_type_ = car_type;
|
||||
relay_data->slot_ = slot_no;
|
||||
ConfigMgr::Instance()->AddCard(relay_data);
|
||||
return;
|
||||
}
|
||||
single_relay_nok_data = std::dynamic_pointer_cast<SingleRelayDataNOK>(base_ptr);
|
||||
relay_data = std::dynamic_pointer_cast<SingleRelayData>(base_ptr);
|
||||
|
||||
qDebug() << "logic" <<relay_data->single_relay[current_index].logic_expression;
|
||||
for(int i = 0 ; i < SLOT_NUM ; i++){
|
||||
std::shared_ptr<CardBase> cardbase_ptr = ConfigMgr::Instance()->GetSlotPtr(i + 1);
|
||||
if(cardbase_ptr != nullptr &&
|
||||
cardbase_ptr->card_type_ == kCardVibSingle){
|
||||
qDebug() << "i" << i;
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(cardbase_ptr);
|
||||
for (int var = 0; var < CHANNEL_COUNT; ++var) {
|
||||
QString item_data,item_str;
|
||||
if(ptr->alert_danger[var].direct_enable ||
|
||||
ptr->alert_danger[var].x1_ampl_enable ||
|
||||
ptr->alert_danger[var].x2_ampl_enable){
|
||||
item_str = QString("%1 (槽位 %2 通道 %3 警报)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2));
|
||||
item_data = QString("%1A1").arg(ptr->base_config_[var].chan_id);
|
||||
}
|
||||
channelNameMap[item_data] = item_str;
|
||||
if(ptr->alert_danger[var].danger_enable){
|
||||
item_str = QString("%1 (槽位 %2 通道 %3 危险)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2));
|
||||
item_data = QString("%1A2").arg(ptr->base_config_[var].chan_id);
|
||||
}
|
||||
channelNameMap[item_data] = item_str;
|
||||
item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2));
|
||||
item_data = QString("%1P##NO").arg(ptr->base_config_[var].chan_id);
|
||||
channelNameMap[item_data] = item_str;
|
||||
}
|
||||
}else if(cardbase_ptr != nullptr &&
|
||||
cardbase_ptr->card_type_ == kCardSpeedSingle){
|
||||
|
||||
}
|
||||
}
|
||||
if(!relay_data->single_relay[current_index].logic_expression.isEmpty()){
|
||||
setExpressionToTreeView(treeView_relay, relay_data->single_relay[current_index].logic_expression);
|
||||
}
|
||||
}
|
||||
void SingleRelay::on_pushButton_cancel_clicked() {
|
||||
this->close();
|
||||
@ -127,19 +145,44 @@ void SingleRelay::OnButtonGroup(QAbstractButton *slot_btn) {
|
||||
QString object_name = slot_btn->objectName();
|
||||
qDebug() << object_name ;
|
||||
int button_id = object_name.right(object_name.length() - 15).toInt();
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id);
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
QListWidgetItem *item_and = new QListWidgetItem("AND");
|
||||
item_and->setData(Qt::UserRole, "*");
|
||||
list_widget_available->addItem(item_and);
|
||||
|
||||
QListWidgetItem *item_or = new QListWidgetItem("OR");
|
||||
item_or->setData(Qt::UserRole, "+");
|
||||
list_widget_available->addItem(item_or);
|
||||
|
||||
for(int var = 0; var < CHANNEL_COUNT ; ++var){
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id);
|
||||
if(base_ptr->card_type_ == kCardVibSingle){
|
||||
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if((vib_data->base_config_[var].standby && (var % 2)))
|
||||
QString item_data;
|
||||
if(ptr->base_config_[var].standby && (var % 2))
|
||||
continue;
|
||||
QString item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(vib_data->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
QListWidgetItem *item = new QListWidgetItem(item_str);
|
||||
QString item_data = QString("S%1C%2P##NO").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
item->setData(Qt::UserRole, item_data);
|
||||
list_widget_available->addItem(item);
|
||||
}else if(base_ptr->card_type_ == kCardSpeedSingle){
|
||||
if(ptr->alert_danger[var].direct_enable ||
|
||||
ptr->alert_danger[var].x1_ampl_enable ||
|
||||
ptr->alert_danger[var].x2_ampl_enable){
|
||||
QString item_str = QString("%1 (槽位 %3 通道 %4 警报)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
QListWidgetItem *item = new QListWidgetItem(item_str);
|
||||
item_data = QString("S%1C%2A1").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
item->setData(Qt::UserRole, item_data);
|
||||
list_widget_available->addItem(item);
|
||||
}
|
||||
|
||||
if(ptr->alert_danger[var].danger_enable){
|
||||
QString item_str = QString("%1 (槽位 %3 通道 %4 危险)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
QListWidgetItem *item = new QListWidgetItem(item_str);
|
||||
item_data = QString("S%1C%2A2").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
item->setData(Qt::UserRole, item_data);
|
||||
list_widget_available->addItem(item);
|
||||
}
|
||||
QString item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
QListWidgetItem *item = new QListWidgetItem(item_str);
|
||||
QString item_data_nok = QString("S%1C%2P##NO").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
|
||||
item->setData(Qt::UserRole, item_data_nok);
|
||||
list_widget_available->addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -152,42 +195,252 @@ void SingleRelay::keyPressEvent(QKeyEvent *event) {
|
||||
// }
|
||||
// QTextEdit::keyPressEvent(event);
|
||||
}
|
||||
QString SingleRelay::buildLogicExpression(QStandardItem *item) {
|
||||
if (!item) return "";
|
||||
|
||||
int childCount = item->rowCount();
|
||||
QVariant userData = item->data(Qt::UserRole);
|
||||
QString text = userData.toString().trimmed();
|
||||
qDebug() << "item" << userData;
|
||||
if (childCount == 0) {
|
||||
// 叶子节点,直接返回表达式,比如 S01C01A1
|
||||
return text;
|
||||
}
|
||||
|
||||
// 判断当前是 +(OR)还是 *(AND)
|
||||
QString opStr = (text == "+") ? "+" :
|
||||
(text == "*") ? "*" : "";
|
||||
|
||||
// 如果不是 +/*,视为叶子节点
|
||||
if (opStr.isEmpty()) {
|
||||
return text;
|
||||
}
|
||||
|
||||
QStringList subExprs;
|
||||
for (int i = 0; i < childCount; ++i) {
|
||||
QStandardItem *child = item->child(i);
|
||||
subExprs << buildLogicExpression(child);
|
||||
}
|
||||
|
||||
return "(" + subExprs.join(" " + opStr + " ") + ")";
|
||||
}
|
||||
void SingleRelay::on_pushButton_confirm_clicked()
|
||||
{
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(treeView_relay->model());
|
||||
if (!model) return;
|
||||
|
||||
QStandardItem *root = model->invisibleRootItem();
|
||||
QStandardItem *topItem = root->child(0);
|
||||
QString finalExpr;
|
||||
QVariant userData = topItem->data(Qt::UserRole);
|
||||
QString user_text = userData.toString().trimmed();
|
||||
single_relay_nok_data->single_relay_nok[current_index].logic_expression = user_text;
|
||||
for (int i = 0; i < root->rowCount(); ++i) {
|
||||
QStandardItem *topItem = root->child(i);
|
||||
QString expr = buildLogicExpression(topItem);
|
||||
finalExpr += expr;
|
||||
}
|
||||
ExprValidationResult result = validateLogicExpression(finalExpr);
|
||||
if (!result.isValid && !finalExpr.isEmpty()) {
|
||||
QMessageBox::warning(this, "表达式错误",
|
||||
QString("错误位置:%1\n错误描述:%2").arg(result.errorPos).arg(result.errorMsg));
|
||||
return;
|
||||
}
|
||||
relay_data->single_relay[current_index].logic_expression = finalExpr;
|
||||
qDebug() << "逻辑表达式:" << finalExpr;
|
||||
this->close();
|
||||
}
|
||||
void SingleRelay::onComboBoxIndexChanged(int index){
|
||||
|
||||
qDebug()<< "[SingleRelay]:index " << index;
|
||||
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(treeView_relay->model());
|
||||
if (!model) return;
|
||||
QStandardItem *root = model->invisibleRootItem();
|
||||
if(root->rowCount() > 0){
|
||||
QStandardItem *topItem = root->child(0);
|
||||
QString finalExpr;
|
||||
QVariant userData = topItem->data(Qt::UserRole);
|
||||
QString user_text = userData.toString().trimmed();
|
||||
single_relay_nok_data->single_relay_nok[current_index].logic_expression = user_text;
|
||||
QString finalExpr;
|
||||
for (int i = 0; i < root->rowCount(); ++i) {
|
||||
QStandardItem *topItem = root->child(i);
|
||||
QString expr = buildLogicExpression(topItem);
|
||||
finalExpr += expr;
|
||||
}
|
||||
ExprValidationResult result = validateLogicExpression(finalExpr);
|
||||
if (!result.isValid && !finalExpr.isEmpty()) {
|
||||
QMessageBox::warning(this, "表达式错误",
|
||||
QString("错误位置:%1\n错误描述:%2").arg(result.errorPos).arg(result.errorMsg));
|
||||
return;
|
||||
}
|
||||
qDebug() << "finalExpr" << finalExpr;
|
||||
relay_data->single_relay[current_index].logic_expression = finalExpr;
|
||||
current_index = index;
|
||||
|
||||
if(single_relay_nok_data->single_relay_nok[index].logic_expression != ""){
|
||||
model_Relay->clear();
|
||||
QString channel_name = channelNameMap[single_relay_nok_data->single_relay_nok[current_index].logic_expression];
|
||||
QStandardItem *item = new QStandardItem(channel_name);
|
||||
item->setData(single_relay_nok_data->single_relay_nok[current_index].logic_expression,Qt::UserRole);
|
||||
model_Relay->appendRow(item);
|
||||
}else{
|
||||
if(relay_data->single_relay[index].logic_expression != "")
|
||||
setExpressionToTreeView(treeView_relay, relay_data->single_relay[index].logic_expression);
|
||||
else
|
||||
model_Relay->clear();
|
||||
}
|
||||
ExprNode* SingleRelay::parseExpression(const QString& expr, int& pos) {
|
||||
auto skipSpaces = [&]() {
|
||||
while (pos < expr.length() && expr[pos].isSpace()) pos++;
|
||||
};
|
||||
|
||||
QStack<ExprNode*> nodeStack;
|
||||
QStack<QString> opStack;
|
||||
|
||||
while (pos < expr.length()) {
|
||||
skipSpaces();
|
||||
if (pos >= expr.length()) break;
|
||||
|
||||
QChar ch = expr[pos];
|
||||
|
||||
if (ch == '(') {
|
||||
pos++;
|
||||
nodeStack.push(parseExpression(expr, pos));
|
||||
} else if (ch == ')') {
|
||||
pos++;
|
||||
break;
|
||||
} else if (ch == '+' || ch == '*') {
|
||||
opStack.push(QString(ch));
|
||||
pos++;
|
||||
} else {
|
||||
QString token;
|
||||
while (pos < expr.length() && !QString("()+* ").contains(expr[pos])) {
|
||||
token += expr[pos++];
|
||||
}
|
||||
if (!token.isEmpty()) {
|
||||
nodeStack.push(new ExprNode{token, {}});
|
||||
}
|
||||
}
|
||||
|
||||
while (opStack.size() > 0 && nodeStack.size() >= 2) {
|
||||
QString op = opStack.pop();
|
||||
ExprNode* right = nodeStack.pop();
|
||||
ExprNode* left = nodeStack.pop();
|
||||
|
||||
if (left->value == op) {
|
||||
left->children.append(right);
|
||||
nodeStack.push(left);
|
||||
} else if (right->value == op) {
|
||||
right->children.prepend(left);
|
||||
nodeStack.push(right);
|
||||
} else {
|
||||
ExprNode* parent = new ExprNode{op, {left, right}};
|
||||
nodeStack.push(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nodeStack.isEmpty() ? nullptr : nodeStack.top();
|
||||
}
|
||||
QStandardItem* SingleRelay::buildItemTree(ExprNode* node) {
|
||||
if (!node) return nullptr;
|
||||
QString displayText;
|
||||
if (node->value == "+" || node->value == "*") {
|
||||
displayText = (node->value == "+") ? "OR" : "AND"; // 运算符显示
|
||||
} else {
|
||||
displayText = channelNameMap.value(node->value, node->value); // 显示名
|
||||
qDebug() << "display" <<displayText << node->value;
|
||||
}
|
||||
QStandardItem* item = new QStandardItem(displayText);
|
||||
item->setData(node->value, Qt::UserRole); // 原始表达式key
|
||||
for (ExprNode* child : node->children) {
|
||||
item->appendRow(buildItemTree(child));
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
ExprValidationResult SingleRelay::validateLogicExpression(const QString& expr) {
|
||||
int bracketCount = 0;
|
||||
bool lastWasOperator = true;
|
||||
bool lastWasOpenParen = false;
|
||||
|
||||
for (int i = 0; i < expr.length(); ++i) {
|
||||
QChar ch = expr[i];
|
||||
|
||||
if (ch.isSpace()) continue;
|
||||
|
||||
if (ch == '(') {
|
||||
bracketCount++;
|
||||
lastWasOpenParen = true;
|
||||
lastWasOperator = true;
|
||||
} else if (ch == ')') {
|
||||
bracketCount--;
|
||||
if (bracketCount < 0) {
|
||||
return {false, i, "多余的右括号 ')'"};
|
||||
}
|
||||
lastWasOpenParen = false;
|
||||
lastWasOperator = false;
|
||||
} else if (ch == '+' || ch == '*') {
|
||||
if (lastWasOperator || lastWasOpenParen) {
|
||||
return {false, i, QString("无效的运算符 '%1' 的位置").arg(ch)};
|
||||
}
|
||||
lastWasOperator = true;
|
||||
lastWasOpenParen = false;
|
||||
} else if (ch.isLetterOrNumber()) {
|
||||
QString token;
|
||||
int start = i;
|
||||
while (i < expr.length() && expr[i].isLetterOrNumber()) {
|
||||
token += expr[i];
|
||||
++i;
|
||||
}
|
||||
--i; // 修正多读了一位
|
||||
if (token.isEmpty()) {
|
||||
return {false, start, "变量名称缺失"};
|
||||
}
|
||||
lastWasOperator = false;
|
||||
lastWasOpenParen = false;
|
||||
} else if (ch.isLetterOrNumber() || ch == '#' || ch.unicode() > 127) {
|
||||
QString token;
|
||||
int start = i;
|
||||
while (i < expr.length() &&
|
||||
(expr[i].isLetterOrNumber() || expr[i] == '#' || expr[i].unicode() > 127)) {
|
||||
token += expr[i];
|
||||
++i;
|
||||
}
|
||||
--i;
|
||||
if (token.isEmpty()) {
|
||||
return {false, start, "变量名称缺失"};
|
||||
}
|
||||
lastWasOperator = false;
|
||||
lastWasOpenParen = false;
|
||||
}else {
|
||||
return {false, i, QString("不支持的字符 '%1'").arg(ch)};
|
||||
}
|
||||
}
|
||||
|
||||
if (bracketCount != 0) {
|
||||
return {false, expr.length(), "括号不匹配"};
|
||||
}
|
||||
|
||||
if (lastWasOperator) {
|
||||
return {false, expr.length() - 1, "表达式不能以运算符结尾"};
|
||||
}
|
||||
|
||||
return {true, -1, ""};
|
||||
}
|
||||
void SingleRelay::setExpressionToTreeView(QTreeView* treeView, const QString& expr) {
|
||||
int pos = 0;
|
||||
model_Relay->clear();
|
||||
ExprNode* root = parseExpression(expr, pos);
|
||||
QStandardItem* rootItem = buildItemTree(root);
|
||||
|
||||
model_Relay->appendRow(rootItem);
|
||||
treeView_relay->expandAll();
|
||||
}
|
||||
void SingleRelay::slotDeleteItem()
|
||||
{
|
||||
QModelIndex curIndex = treeView_relay->currentIndex();
|
||||
if(curIndex.isValid()){
|
||||
model_Relay->removeRow(curIndex.row(),curIndex.parent());
|
||||
}
|
||||
|
||||
}
|
||||
void SingleRelay::on_treeView_Relay_customContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
qDebug() << "on_treeView_Relay_customContextMenuRequested" <<endl;
|
||||
QModelIndex curIndex = treeView_relay->indexAt(pos); //当前点击的元素的index
|
||||
QModelIndex index = curIndex.sibling(curIndex.row(),0); //该行的第1列元素的index
|
||||
QMenu menu(this);
|
||||
if (index.isValid()){
|
||||
//添加一行菜单,进行展开
|
||||
menu.addAction(QStringLiteral("删除"), this, SLOT(slotDeleteItem()));
|
||||
menu.addSeparator(); //添加一个分隔线
|
||||
}
|
||||
menu.exec(QCursor::pos()); //显示菜单
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
namespace Ui {
|
||||
class SingleRelay;
|
||||
}
|
||||
|
||||
class SingleRelay : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
@ -31,6 +30,9 @@ class SingleRelay : public QDialog {
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void onComboBoxIndexChanged(int index);
|
||||
void slotDeleteItem();
|
||||
|
||||
void on_treeView_Relay_customContextMenuRequested(const QPoint &pos);
|
||||
|
||||
private:
|
||||
Ui::SingleRelay *ui;
|
||||
@ -38,11 +40,17 @@ private:
|
||||
QListWidget *list_widget_available = nullptr;
|
||||
QTreeView *treeView_relay;
|
||||
QStandardItemModel *model_Relay;
|
||||
std::shared_ptr<SingleRelayDataNOK> single_relay_nok_data = nullptr;
|
||||
std::shared_ptr<SingleRelayData> relay_data = nullptr;
|
||||
int current_index;
|
||||
QMap<QString, QString> channelNameMap;
|
||||
|
||||
void Init();
|
||||
void buildTreeFromExpression(QTreeView *treeView, const QString &expr);
|
||||
ExprNode* parseExpression(const QString& expr, int& pos);
|
||||
QStandardItem* buildItemTree(ExprNode* node);
|
||||
void setExpressionToTreeView(QTreeView* treeView, const QString& expr);
|
||||
QString buildLogicExpression(QStandardItem *item);
|
||||
ExprValidationResult validateLogicExpression(const QString& expr);
|
||||
};
|
||||
|
||||
#endif // SINGLERELAY_H
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>924</width>
|
||||
<width>994</width>
|
||||
<height>569</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -937,7 +937,7 @@
|
||||
<rect>
|
||||
<x>620</x>
|
||||
<y>40</y>
|
||||
<width>281</width>
|
||||
<width>341</width>
|
||||
<height>301</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -946,9 +946,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>380</y>
|
||||
<y>370</y>
|
||||
<width>391</width>
|
||||
<height>131</height>
|
||||
<height>141</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "singlerelay_data.h"
|
||||
SingleRelayDataNOK::SingleRelayDataNOK(){
|
||||
SingleRelayData::SingleRelayData(){
|
||||
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
#define SINGLERELAY_DATA_H
|
||||
|
||||
#include "cardbase.h"
|
||||
class SingleRelayDataNOK : public CardBase {
|
||||
class SingleRelayData : public CardBase {
|
||||
public:
|
||||
SingleRelayDataNOK();
|
||||
SingleRelayNOK single_relay_nok[RELAY_COUNT];
|
||||
SingleRelayData();
|
||||
SingleRelayNOK single_relay[RELAY_COUNT];
|
||||
};
|
||||
|
||||
#endif // SINGLERELAY_DATA_H
|
||||
|
@ -13,15 +13,7 @@
|
||||
namespace Ui {
|
||||
class TMRRelayAssociation;
|
||||
}
|
||||
struct ExprNode {
|
||||
QString value;
|
||||
QList<ExprNode*> children;
|
||||
};
|
||||
struct ExprValidationResult {
|
||||
bool isValid;
|
||||
int errorPos;
|
||||
QString errorMsg;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class TMRRelayAssociation : public QDialog
|
||||
|
@ -60,6 +60,7 @@ void Trust::Init() {
|
||||
ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low);
|
||||
ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high);
|
||||
ui->comboBox_direct_value_range->setCurrentIndex(variable_ptr->direct_.full_scale_range);
|
||||
ui->comboBox_gap_range->setCurrentIndex(variable_ptr->gap_range.full_scale_range);
|
||||
ui->doubleSpinBox_direct_clamp->setValue(variable_ptr->direct_.clamp_value);
|
||||
// ui->label_bias_voltage->setText(QString::number(variable_ptr->direct_.bias_voltage));
|
||||
// ui->doubleSpinBox_bias_volt_clamp->setValue(variables[i].clamp_value);
|
||||
@ -71,6 +72,7 @@ void Trust::Init() {
|
||||
ui->checkBox_danger_latching->setChecked(variable_ptr->danger_latching_);
|
||||
ui->comboBox_recorder_output->setCurrentIndex(variable_ptr->recorder_out_.recorder_output);
|
||||
ui->checkBox_two_ma_clamp->setChecked(variable_ptr->recorder_out_.two_ma_clamp);
|
||||
ui->doubleSpinBox_zero_position->setValue(variable_ptr->zero_position.value);
|
||||
}
|
||||
void Trust::on_pushButton_confirm_clicked()
|
||||
{
|
||||
@ -103,6 +105,7 @@ void Trust::on_pushButton_confirm_clicked()
|
||||
variable->direct_.full_scale_range = ui->comboBox_direct_value_range->currentIndex();
|
||||
variable->direct_.clamp_value = ui->doubleSpinBox_direct_clamp->value();
|
||||
variable->direct_.custom = 0; // TODO:
|
||||
variable->gap_range.full_scale_range = ui->comboBox_gap_range->currentIndex();
|
||||
variable->recorder_out_.recorder_output = ui->comboBox_recorder_output->currentIndex();
|
||||
variable->recorder_out_.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked();
|
||||
variable->delay_.alert = ui->spinBox_alert->value();
|
||||
@ -110,6 +113,7 @@ void Trust::on_pushButton_confirm_clicked()
|
||||
variable->delay_.active_100ms = ui->checkBox_100ms->isChecked();
|
||||
variable->alert_latching_ = ui->checkBox_alert_latching->isChecked();
|
||||
variable->danger_latching_ = ui->checkBox_danger_latching->isChecked();
|
||||
variable->zero_position.value = ui->doubleSpinBox_zero_position->value();
|
||||
ptr->variables_.push_back(variable);
|
||||
this->close();
|
||||
return;
|
||||
@ -127,6 +131,8 @@ void Trust::on_pushButton_confirm_clicked()
|
||||
variable->direct_.full_scale_range = ui->comboBox_direct_value_range->currentIndex();
|
||||
variable->direct_.clamp_value = ui->doubleSpinBox_direct_clamp->value();
|
||||
variable->direct_.custom = 0; // TODO:
|
||||
variable->gap_range.full_scale_range = ui->comboBox_gap_range->currentIndex();
|
||||
variable->gap_range.custom = 0;
|
||||
variable->recorder_out_.recorder_output = ui->comboBox_recorder_output->currentIndex();
|
||||
variable->recorder_out_.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked();
|
||||
variable->delay_.alert = ui->spinBox_alert->value();
|
||||
@ -140,6 +146,6 @@ void Trust::on_pushButton_confirm_clicked()
|
||||
|
||||
void Trust::on_pushButton_cancel_clicked()
|
||||
{
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
72
trust.ui
72
trust.ui
@ -430,31 +430,6 @@
|
||||
<string>-24 Vdc</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0-100 um</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0-150 um</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0-200 um</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0-400 um</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0-500 um</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>自定义</string>
|
||||
@ -466,7 +441,7 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>190</y>
|
||||
<width>221</width>
|
||||
<width>201</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -571,6 +546,51 @@
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>190</y>
|
||||
<width>171</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>初始位置</string>
|
||||
</property>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_zero_position">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>99.900000000000006</double>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>50</y>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-6.33 - 13.99 V</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_alert_latching">
|
||||
<property name="geometry">
|
||||
|
@ -13,6 +13,7 @@ class VibrationData : public CardBase {
|
||||
SeismicMonitor base_config_[CHANNEL_COUNT];
|
||||
std::vector<std::shared_ptr<VariableBase>> variables_;
|
||||
VibAlertDanger alert_danger[CHANNEL_COUNT];
|
||||
VibAlertDangerPress alert_danger_press[CHANNEL_COUNT];
|
||||
};
|
||||
|
||||
#endif // VIBRATIONDATA_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user