M1M3 Support System
Loading...
Searching...
No Matches
ILCResponseParser.h
1/*
2 * This file is part of LSST M1M3 support system package.
3 *
4 * Developed for the Vera C. Rubin Telescope and Site System.
5 * This product includes software developed by the LSST Project
6 * (https://www.lsst.org).
7 * See the COPYRIGHT file at the top-level directory of this distribution
8 * for details of code ownership.
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef ILCRESPONSEPARSER_H_
25#define ILCRESPONSEPARSER_H_
26
27#include <SAL_MTM1M3C.h>
28
29#include <ForceActuatorSettings.h>
30#include <HardpointActuatorSettings.h>
31#include <ILCDataTypes.h>
32#include <ILCSubnetData.h>
33#include <ModbusBuffer.h>
34#include <SafetyController.h>
35#include <cRIO/DataTypes.h>
36
37namespace LSST {
38namespace M1M3 {
39namespace SS {
40
42public:
44 ILCResponseParser(ILCSubnetData *subnetData, SafetyController *safetyController);
45
46 void parse(ModbusBuffer *buffer, uint8_t subnet);
47 void incExpectedResponses(int32_t *fa, int32_t *hp, int32_t *hm);
48 void clearResponses();
49 void verifyResponses();
50
51private:
52 void _parseErrorResponse(ModbusBuffer *buffer, uint8_t called_function, double timestamp,
53 int32_t actuatorId);
54 void _parseReportHPServerIDResponse(ModbusBuffer *buffer, const ILCMap &ilc);
55 void _parseReportHMServerIDResponse(ModbusBuffer *buffer, const ILCMap &ilc);
56 void _parseReportHPServerStatusResponse(ModbusBuffer *buffer, const ILCMap &ilc);
57 void _parseReportFAServerStatusResponse(ModbusBuffer *buffer, const ILCMap &ilc);
58 void _parseReportHMServerStatusResponse(ModbusBuffer *buffer, const ILCMap &ilc);
59 void _parseChangeHPILCModeResponse(ModbusBuffer *buffer, const ILCMap &ilc);
60 void _parseChangeFAILCModeResponse(ModbusBuffer *buffer, const ILCMap &ilc);
61 void _parseChangeHMILCModeResponse(ModbusBuffer *buffer, const ILCMap &ilc);
62 void _parseElectromechanicalForceAndStatusResponse(ModbusBuffer *buffer, const ILCMap &ilc,
63 double timestamp);
64 void _parseSetBoostValveDCAGainsResponse(ModbusBuffer *buffer, const ILCMap &ilc);
65 void _parseForceDemandResponse(ModbusBuffer *buffer, uint8_t address, const ILCMap &ilc);
66 void _parseSingleAxisForceDemandResponse(ModbusBuffer *buffer, const ILCMap &ilc);
67 void _parseDualAxisForceDemandResponse(ModbusBuffer *buffer, const ILCMap &ilc);
68 void _parsePneumaticForceStatusResponse(ModbusBuffer *buffer, uint8_t address, const ILCMap &ilc);
69 void _parseSingleAxisPneumaticForceStatusResponse(ModbusBuffer *buffer, const ILCMap &ilc);
70 void _parseDualAxisPneumaticForceStatusResponse(ModbusBuffer *buffer, const ILCMap &ilc);
71 void _parseSetHPADCScanRateResponse(ModbusBuffer *buffer, const ILCMap &ilc);
72 void _parseSetHPADCChannelOffsetAndSensitivityResponse(ModbusBuffer *buffer, const ILCMap &ilc);
73 void _parseSetFAADCChannelOffsetAndSensitivityResponse(ModbusBuffer *buffer, const ILCMap &ilc);
74 void _parseHPResetResponse(ModbusBuffer *buffer, const ILCMap &ilc);
75 void _parseFAResetResponse(ModbusBuffer *buffer, const ILCMap &ilc);
76 void _parseHMResetResponse(ModbusBuffer *buffer, const ILCMap &ilc);
77 void _parseReadHPCalibrationResponse(ModbusBuffer *buffer, const ILCMap &ilc);
78 void _parseReadDCAPressureValuesResponse(ModbusBuffer *buffer, const ILCMap &ilc);
79 void _parseReadHMPressureValuesResponse(ModbusBuffer *buffer, const ILCMap &ilc);
80 void _parseReportHMMezzanineIDResponse(ModbusBuffer *buffer, const ILCMap &ilc);
81 void _parseReportDCAStatusResponse(ModbusBuffer *buffer, const ILCMap &ilc);
82 void _parseReportHMMezzanineStatusResponse(ModbusBuffer *buffer, const ILCMap &ilc);
83 void _parseReportLVDTResponse(ModbusBuffer *buffer, const ILCMap &ilc);
84
85 void _checkForceActuatorForces(const ILCMap &ilc);
86 void _checkHardpointActuatorMeasuredForce(int32_t actuatorId);
87 void _checkHardpointActuatorAirPressure(int32_t actuatorId);
88
89 void _warnResponseTimeout(double timestamp, int32_t actuatorId);
90 void _warnInvalidCRC(double timestamp);
91 void _warnIllegalFunction(double timestamp, int32_t actuatorId);
92 void _warnIllegalDataValue(double timestamp, int32_t actuatorId);
93 void _warnInvalidLength(double timestamp, int32_t actuatorId);
94 void _warnUnknownSubnet(double timestamp);
95 void _warnUnknownAddress(double timestamp, int32_t actuatorId);
96 void _warnUnknownFunction(double timestamp, int32_t actuatorId);
97 void _warnUnknownProblem(double timestamp, int32_t actuatorId);
98
99 HardpointActuatorSettings *_hardpointActuatorSettings;
100 ILCSubnetData *_subnetData;
101 SafetyController *_safetyController;
102
103 int32_t _faExpectedResponses[FA_COUNT];
104 int32_t _hpExpectedResponses[HP_COUNT];
105 int32_t _hmExpectedResponses[HP_COUNT];
106
107 MTM1M3_logevent_detailedStateC *_detailedState;
108
109 MTM1M3_logevent_hardpointActuatorInfoC *_hardpointActuatorInfo;
110 MTM1M3_logevent_hardpointActuatorStateC *_hardpointActuatorState;
111 MTM1M3_hardpointActuatorDataC *_hardpointActuatorData;
112
113 MTM1M3_logevent_forceActuatorStateC *_forceActuatorState;
114 MTM1M3_logevent_forceActuatorWarningC *_forceActuatorWarning;
115 MTM1M3_logevent_forceActuatorForceWarningC *_forceWarning;
116 MTM1M3_appliedCylinderForcesC *_appliedCylinderForces;
117
118 MTM1M3_logevent_hardpointMonitorInfoC *_hardpointMonitorInfo;
119 MTM1M3_logevent_hardpointMonitorStateC *_hardpointMonitorState;
120 MTM1M3_logevent_hardpointMonitorWarningC *_hardpointMonitorWarning;
121 MTM1M3_hardpointMonitorDataC *_hardpointMonitorData;
122
123 MTM1M3_outerLoopDataC *_outerLoopData;
124};
125
126} /* namespace SS */
127} /* namespace M1M3 */
128} /* namespace LSST */
129
130#endif /* ILCRESPONSEPARSER_H_ */
Definition HardpointActuatorSettings.h:43
Definition ILCResponseParser.h:41
Definition ILCSubnetData.h:38
Utility class for Modbus buffer management.
Definition ModbusBuffer.h:42
Controls mirror safety.
Definition SafetyController.h:50
ILC data.
Definition ILCDataTypes.h:42