io_constants.h
Go to the documentation of this file.
1 // Copyright (c) 2021 Pilz GmbH & Co. KG
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU Lesser General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with this program. If not, see <https://www.gnu.org/licenses/>.
15 
16 #ifndef PSEN_SCAN_V2_STANDALONE_IO_CONSTANTS_H
17 #define PSEN_SCAN_V2_STANDALONE_IO_CONSTANTS_H
18 
19 #include <array>
20 #include <map>
21 #include <string>
22 
24 {
25 namespace data_conversion_layer
26 {
27 namespace monitoring_frame
28 {
29 namespace io
30 {
34 static constexpr uint32_t RAW_CHUNK_LENGTH_RESERVED_IN_BYTES{ 4 };
35 static constexpr uint32_t RAW_CHUNK_PHYSICAL_INPUT_SIGNALS_IN_BYTES{ 10 };
36 static constexpr uint32_t RAW_CHUNK_LOGICAL_INPUT_SIGNALS_IN_BYTES{ 8 };
37 static constexpr uint32_t RAW_CHUNK_OUTPUT_SIGNALS_IN_BYTES{ 4 };
38 static constexpr uint32_t RAW_CHUNK_LENGTH_IN_BYTES{
42 };
43 
44 using RawChunk = std::array<uint8_t, io::RAW_CHUNK_LENGTH_IN_BYTES>;
45 
46 #define REV(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) arg8, arg7, arg6, arg5, arg4, arg3, arg2, arg1
47 
48 enum class LogicalInputType
49 {
50  zone_sw_2,
51  zone_sw_1,
52  overr_2_a,
53  overr_1_a,
54  muting_2_a,
55  muting_1_a,
56 
57  reset_a,
58  zone_sw_8,
59  zone_sw_7,
60  zone_sw_6,
61  zone_sw_5,
62  zone_sw_4,
63  zone_sw_3,
64 
66  mut_en_2_a,
70  mut_en_1_a,
72 
74  unused
75 };
76 
78 using IoName = std::string;
79 // clang-format off
80 static const std::map<Lit, IoName> LOGICAL_INPUT_BIT_TO_NAME{
81 
82  { Lit::zone_sw_2, "Zone Set Switching Input 2" },
83  { Lit::zone_sw_1, "Zone Set Switching Input 1" },
84  { Lit::overr_2_a, "Override 2 Activated" },
85  { Lit::overr_1_a, "Override 1 Activated" },
86  { Lit::muting_2_a, "Muting 2 Activated" },
87  { Lit::muting_1_a, "Muting 1 Activated" },
88 
89  { Lit::reset_a, "Reset Activated" },
90  { Lit::zone_sw_8, "Zone Set Switching Input 8" },
91  { Lit::zone_sw_7, "Zone Set Switching Input 7" },
92  { Lit::zone_sw_6, "Zone Set Switching Input 6" },
93  { Lit::zone_sw_5, "Zone Set Switching Input 5" },
94  { Lit::zone_sw_4, "Zone Set Switching Input 4" },
95  { Lit::zone_sw_3, "Zone Set Switching Input 3" },
96 
97  { Lit::cor_seq_mut_2, "Correct activation sequence of Muting 2 Pins" },
98  { Lit::mut_en_2_a, "Muting Enable 2 Activated" },
99  { Lit::restart_2_a, "Restart 2 Activated" },
100  { Lit::cor_seq_or_1, "Correct activation sequence of Override 1 Pins" },
101  { Lit::cor_seq_mut_1, "Correct activation sequence of Muting 1 Pins" },
102  { Lit::mut_en_1_a, "Muting Enable 1 Activated" },
103  { Lit::restart_1_a, "Restart 1 Activated" },
104 
105  { Lit::cor_seq_or_2, "Correct activation sequence of Override 2 Pins" },
106  { Lit::unused, "unused" },
107 };
108 
109 static constexpr std::array<std::array<Lit, 8>, RAW_CHUNK_LOGICAL_INPUT_SIGNALS_IN_BYTES> LOGICAL_INPUT_BITS{{
110  // Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
111  { Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused },
112  { Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused },
113  { Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused },
114  { Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused },
115  { REV(Lit::zone_sw_2, Lit::zone_sw_1, Lit::unused, Lit::overr_2_a, Lit::overr_1_a, Lit::unused, Lit::muting_2_a, Lit::muting_1_a) },
116  { REV(Lit::unused, Lit::reset_a, Lit::zone_sw_8, Lit::zone_sw_7, Lit::zone_sw_6, Lit::zone_sw_5, Lit::zone_sw_4, Lit::zone_sw_3) },
117  { REV(Lit::cor_seq_mut_2, Lit::mut_en_2_a, Lit::restart_2_a, Lit::unused, Lit::cor_seq_or_1, Lit::cor_seq_mut_1, Lit::mut_en_1_a, Lit::restart_1_a) },
118  { REV(Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::unused, Lit::cor_seq_or_2) },
119 }};
120 // clang-format on
121 
122 enum class OutputType
123 {
124  unused,
125  ossd1_refpts,
126 
127  warn_2_int,
128  warn_1_int,
129  ossd3_lock,
130  safe_3_int,
131  int_lock_2,
132  safe_2_int,
133  int_lock_1,
134  safe_1_int
135 };
136 
137 using Ot = OutputType;
138 
139 // clang-format off
140 static const std::map<Ot, IoName> OUTPUT_BIT_TO_NAME
141 {
142  { Ot::unused, "unused" },
143  { Ot::ossd1_refpts, "REFERENCE POINTS VIOLATION" },
144 
145  { Ot::warn_2_int, "Warning 2 intrusion" },
146  { Ot::warn_1_int, "Warning 1 intrusion" },
147  { Ot::safe_3_int, "Safety 3 intrusion" },
148  { Ot::int_lock_2, "INTERLOCK 2" },
149  { Ot::safe_2_int, "Safety 2 intrusion" },
150  { Ot::int_lock_1, "INTERLOCK 1" },
151  { Ot::safe_1_int, "Safety 1 intrusion" }
152 };
153 
154 static constexpr std::array<std::array<Ot, 8>, RAW_CHUNK_OUTPUT_SIGNALS_IN_BYTES> OUTPUT_BITS{{
155  // Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
156  { REV(Ot::warn_2_int, Ot::warn_1_int, Ot::unused, Ot::safe_3_int, Ot::int_lock_2, Ot::safe_2_int, Ot::int_lock_1, Ot::safe_1_int) },
157  { REV(Ot::unused, Ot::unused, Ot::unused, Ot::unused, Ot::unused, Ot::unused, Ot::unused, Ot::unused) },
158  { REV(Ot::unused, Ot::unused, Ot::unused, Ot::unused, Ot::unused, Ot::unused, Ot::unused, Ot::unused) },
159  { REV(Ot::unused, Ot::unused, Ot::unused, Ot::ossd1_refpts, Ot::unused, Ot::unused, Ot::unused, Ot::unused) }
160 }};
161 // clang-format on
162 
163 } // namespace io
164 } // namespace monitoring_frame
165 } // namespace data_conversion_layer
166 } // namespace psen_scan_v2_standalone
167 
168 #endif // PSEN_SCAN_V2_STANDALONE_IO_CONSTANTS_H
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OutputType::int_lock_2
@ int_lock_2
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::RAW_CHUNK_LOGICAL_INPUT_SIGNALS_IN_BYTES
static constexpr uint32_t RAW_CHUNK_LOGICAL_INPUT_SIGNALS_IN_BYTES
Definition: io_constants.h:36
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::muting_1_a
@ muting_1_a
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::zone_sw_4
@ zone_sw_4
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::zone_sw_8
@ zone_sw_8
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::restart_2_a
@ restart_2_a
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::RAW_CHUNK_LENGTH_IN_BYTES
static constexpr uint32_t RAW_CHUNK_LENGTH_IN_BYTES
Definition: io_constants.h:38
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::cor_seq_or_1
@ cor_seq_or_1
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::RawChunk
std::array< uint8_t, io::RAW_CHUNK_LENGTH_IN_BYTES > RawChunk
Definition: io_constants.h:44
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::restart_1_a
@ restart_1_a
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OUTPUT_BITS
static constexpr std::array< std::array< Ot, 8 >, RAW_CHUNK_OUTPUT_SIGNALS_IN_BYTES > OUTPUT_BITS
Definition: io_constants.h:154
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OutputType::safe_1_int
@ safe_1_int
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::IoName
std::string IoName
Definition: io_constants.h:78
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LOGICAL_INPUT_BITS
static constexpr std::array< std::array< Lit, 8 >, RAW_CHUNK_LOGICAL_INPUT_SIGNALS_IN_BYTES > LOGICAL_INPUT_BITS
Definition: io_constants.h:109
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OutputType
OutputType
Definition: io_constants.h:122
REV
#define REV(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
Definition: io_constants.h:46
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OutputType::warn_2_int
@ warn_2_int
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OutputType::ossd3_lock
@ ossd3_lock
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::mut_en_1_a
@ mut_en_1_a
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::zone_sw_3
@ zone_sw_3
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::zone_sw_7
@ zone_sw_7
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType
LogicalInputType
Definition: io_constants.h:48
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LOGICAL_INPUT_BIT_TO_NAME
static const std::map< Lit, IoName > LOGICAL_INPUT_BIT_TO_NAME
Definition: io_constants.h:80
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OutputType::safe_3_int
@ safe_3_int
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::zone_sw_6
@ zone_sw_6
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OutputType::unused
@ unused
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OutputType::int_lock_1
@ int_lock_1
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::cor_seq_or_2
@ cor_seq_or_2
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::RAW_CHUNK_PHYSICAL_INPUT_SIGNALS_IN_BYTES
static constexpr uint32_t RAW_CHUNK_PHYSICAL_INPUT_SIGNALS_IN_BYTES
Definition: io_constants.h:35
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::zone_sw_1
@ zone_sw_1
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::overr_1_a
@ overr_1_a
psen_scan_v2_standalone
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Definition: udp_client.h:41
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::zone_sw_2
@ zone_sw_2
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::unused
@ unused
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::reset_a
@ reset_a
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::overr_2_a
@ overr_2_a
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OutputType::safe_2_int
@ safe_2_int
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OutputType::warn_1_int
@ warn_1_int
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OutputType::ossd1_refpts
@ ossd1_refpts
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::muting_2_a
@ muting_2_a
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::RAW_CHUNK_LENGTH_RESERVED_IN_BYTES
static constexpr uint32_t RAW_CHUNK_LENGTH_RESERVED_IN_BYTES
Contains constants and types needed to define PinData and for the (de)serialization.
Definition: io_constants.h:34
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::mut_en_2_a
@ mut_en_2_a
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::RAW_CHUNK_OUTPUT_SIGNALS_IN_BYTES
static constexpr uint32_t RAW_CHUNK_OUTPUT_SIGNALS_IN_BYTES
Definition: io_constants.h:37
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::cor_seq_mut_1
@ cor_seq_mut_1
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::cor_seq_mut_2
@ cor_seq_mut_2
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::LogicalInputType::zone_sw_5
@ zone_sw_5
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::OUTPUT_BIT_TO_NAME
static const std::map< Ot, IoName > OUTPUT_BIT_TO_NAME
Definition: io_constants.h:141


psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Jun 22 2024 02:46:11