diff --git a/src/modules/utils/assembling/ASSEMBLE_BYTE_FROM_BOOLS_fct.cpp b/src/modules/utils/assembling/ASSEMBLE_BYTE_FROM_BOOLS_fct.cpp new file mode 100644 index 000000000..cec30b988 --- /dev/null +++ b/src/modules/utils/assembling/ASSEMBLE_BYTE_FROM_BOOLS_fct.cpp @@ -0,0 +1,189 @@ +/************************************************************************* + *** Copyright (c) 2024 HR Agrartechnik GmbH + *** This program and the accompanying materials are made available under the + *** terms of the Eclipse Public License 2.0 which is available at + *** http://www.eclipse.org/legal/epl-2.0. + *** + *** SPDX-License-Identifier: EPL-2.0 + *** + *** FORTE Library Element + *** + *** This file was generated using the 4DIAC FORTE Export Filter V1.0.x NG! + *** + *** Name: ASSEMBLE_BYTE_FROM_BOOLS + *** Description: this Function combines the 8 BOOLS to a BYTE + *** Version: + *** 1.0: 2024-02-22/Franz Höpfinger - HR Agrartechnik - initial Implementation + *** 1.1: 2024-07-28/Moritz Ortmeier - HR Agrartechnik - rename Function and change Input/Output Variables + *************************************************************************/ + +#include "ASSEMBLE_BYTE_FROM_BOOLS_fct.h" +#ifdef FORTE_ENABLE_GENERATED_SOURCE_CPP +#include "ASSEMBLE_BYTE_FROM_BOOLS_fct_gen.cpp" +#endif + +#include "criticalregion.h" +#include "resource.h" +#include "forte_byte.h" +#include "forte_bool.h" +#include "iec61131_functions.h" +#include "forte_array_common.h" +#include "forte_array.h" +#include "forte_array_fixed.h" +#include "forte_array_variable.h" +#include "ASSEMBLE_BYTE_FROM_BOOLS_fct.h" + +DEFINE_FIRMWARE_FB(FORTE_ASSEMBLE_BYTE_FROM_BOOLS, g_nStringIdASSEMBLE_BYTE_FROM_BOOLS) + +const CStringDictionary::TStringId FORTE_ASSEMBLE_BYTE_FROM_BOOLS::scmDataInputNames[] = {g_nStringIdBIT_00, g_nStringIdBIT_01, g_nStringIdBIT_02, g_nStringIdBIT_03, g_nStringIdBIT_04, g_nStringIdBIT_05, g_nStringIdBIT_06, g_nStringIdBIT_07}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_BYTE_FROM_BOOLS::scmDataInputTypeIds[] = {g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_BYTE_FROM_BOOLS::scmDataOutputNames[] = {g_nStringId}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_BYTE_FROM_BOOLS::scmDataOutputTypeIds[] = {g_nStringIdBYTE}; +const TDataIOID FORTE_ASSEMBLE_BYTE_FROM_BOOLS::scmEIWith[] = {0, 1, 2, 3, 4, 5, 6, 7, scmWithListDelimiter}; +const TForteInt16 FORTE_ASSEMBLE_BYTE_FROM_BOOLS::scmEIWithIndexes[] = {0}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_BYTE_FROM_BOOLS::scmEventInputNames[] = {g_nStringIdREQ}; +const TDataIOID FORTE_ASSEMBLE_BYTE_FROM_BOOLS::scmEOWith[] = {0, scmWithListDelimiter}; +const TForteInt16 FORTE_ASSEMBLE_BYTE_FROM_BOOLS::scmEOWithIndexes[] = {0}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_BYTE_FROM_BOOLS::scmEventOutputNames[] = {g_nStringIdCNF}; +const SFBInterfaceSpec FORTE_ASSEMBLE_BYTE_FROM_BOOLS::scmFBInterfaceSpec = { + 1, scmEventInputNames, scmEIWith, scmEIWithIndexes, + 1, scmEventOutputNames, scmEOWith, scmEOWithIndexes, + 8, scmDataInputNames, scmDataInputTypeIds, + 1, scmDataOutputNames, scmDataOutputTypeIds, + 0, nullptr, + 0, nullptr +}; + +FORTE_ASSEMBLE_BYTE_FROM_BOOLS::FORTE_ASSEMBLE_BYTE_FROM_BOOLS(const CStringDictionary::TStringId paInstanceNameId, forte::core::CFBContainer &paContainer) : + CFunctionBlock(paContainer, scmFBInterfaceSpec, paInstanceNameId), + var_conn_(var_), + conn_CNF(this, 0), + conn_BIT_00(nullptr), + conn_BIT_01(nullptr), + conn_BIT_02(nullptr), + conn_BIT_03(nullptr), + conn_BIT_04(nullptr), + conn_BIT_05(nullptr), + conn_BIT_06(nullptr), + conn_BIT_07(nullptr), + conn_(this, 0, &var_conn_) { +} + +void FORTE_ASSEMBLE_BYTE_FROM_BOOLS::setInitialValues() { + var_BIT_00 = 0_BOOL; + var_BIT_01 = 0_BOOL; + var_BIT_02 = 0_BOOL; + var_BIT_03 = 0_BOOL; + var_BIT_04 = 0_BOOL; + var_BIT_05 = 0_BOOL; + var_BIT_06 = 0_BOOL; + var_BIT_07 = 0_BOOL; + var_ = 0_BYTE; +} + +void FORTE_ASSEMBLE_BYTE_FROM_BOOLS::readInputData(const TEventID paEIID) { + switch(paEIID) { + case scmEventREQID: { + readData(0, var_BIT_00, conn_BIT_00); + readData(1, var_BIT_01, conn_BIT_01); + readData(2, var_BIT_02, conn_BIT_02); + readData(3, var_BIT_03, conn_BIT_03); + readData(4, var_BIT_04, conn_BIT_04); + readData(5, var_BIT_05, conn_BIT_05); + readData(6, var_BIT_06, conn_BIT_06); + readData(7, var_BIT_07, conn_BIT_07); + break; + } + default: + break; + } +} + +void FORTE_ASSEMBLE_BYTE_FROM_BOOLS::writeOutputData(const TEventID paEIID) { + switch(paEIID) { + case scmEventCNFID: { + writeData(0, var_, conn_); + break; + } + default: + break; + } +} + +CIEC_ANY *FORTE_ASSEMBLE_BYTE_FROM_BOOLS::getDI(const size_t paIndex) { + switch(paIndex) { + case 0: return &var_BIT_00; + case 1: return &var_BIT_01; + case 2: return &var_BIT_02; + case 3: return &var_BIT_03; + case 4: return &var_BIT_04; + case 5: return &var_BIT_05; + case 6: return &var_BIT_06; + case 7: return &var_BIT_07; + } + return nullptr; +} + +CIEC_ANY *FORTE_ASSEMBLE_BYTE_FROM_BOOLS::getDO(const size_t paIndex) { + switch(paIndex) { + case 0: return &var_; + } + return nullptr; +} + +CEventConnection *FORTE_ASSEMBLE_BYTE_FROM_BOOLS::getEOConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_CNF; + } + return nullptr; +} + +CDataConnection **FORTE_ASSEMBLE_BYTE_FROM_BOOLS::getDIConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_BIT_00; + case 1: return &conn_BIT_01; + case 2: return &conn_BIT_02; + case 3: return &conn_BIT_03; + case 4: return &conn_BIT_04; + case 5: return &conn_BIT_05; + case 6: return &conn_BIT_06; + case 7: return &conn_BIT_07; + } + return nullptr; +} + +CDataConnection *FORTE_ASSEMBLE_BYTE_FROM_BOOLS::getDOConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_; + } + return nullptr; +} + +void FORTE_ASSEMBLE_BYTE_FROM_BOOLS::executeEvent(const TEventID, CEventChainExecutionThread *const paECET) { + var_ = func_ASSEMBLE_BYTE_FROM_BOOLS(var_BIT_00, var_BIT_01, var_BIT_02, var_BIT_03, var_BIT_04, var_BIT_05, var_BIT_06, var_BIT_07); + sendOutputEvent(scmEventCNFID, paECET); +} + +CIEC_BYTE func_ASSEMBLE_BYTE_FROM_BOOLS(CIEC_BOOL st_lv_BIT_00, CIEC_BOOL st_lv_BIT_01, CIEC_BOOL st_lv_BIT_02, CIEC_BOOL st_lv_BIT_03, CIEC_BOOL st_lv_BIT_04, CIEC_BOOL st_lv_BIT_05, CIEC_BOOL st_lv_BIT_06, CIEC_BOOL st_lv_BIT_07) { + CIEC_BYTE st_ret_val = 0_BYTE; + + #line 15 "ASSEMBLE_BYTE_FROM_BOOLS.fct" + st_ret_val.partial(0) = st_lv_BIT_00; + #line 16 "ASSEMBLE_BYTE_FROM_BOOLS.fct" + st_ret_val.partial(1) = st_lv_BIT_01; + #line 17 "ASSEMBLE_BYTE_FROM_BOOLS.fct" + st_ret_val.partial(2) = st_lv_BIT_02; + #line 18 "ASSEMBLE_BYTE_FROM_BOOLS.fct" + st_ret_val.partial(3) = st_lv_BIT_03; + #line 19 "ASSEMBLE_BYTE_FROM_BOOLS.fct" + st_ret_val.partial(4) = st_lv_BIT_04; + #line 20 "ASSEMBLE_BYTE_FROM_BOOLS.fct" + st_ret_val.partial(5) = st_lv_BIT_05; + #line 21 "ASSEMBLE_BYTE_FROM_BOOLS.fct" + st_ret_val.partial(6) = st_lv_BIT_06; + #line 22 "ASSEMBLE_BYTE_FROM_BOOLS.fct" + st_ret_val.partial(7) = st_lv_BIT_07; + + return st_ret_val; +} + diff --git a/src/modules/utils/assembling/ASSEMBLE_BYTE_FROM_BOOLS_fct.h b/src/modules/utils/assembling/ASSEMBLE_BYTE_FROM_BOOLS_fct.h new file mode 100644 index 000000000..2729d8ea7 --- /dev/null +++ b/src/modules/utils/assembling/ASSEMBLE_BYTE_FROM_BOOLS_fct.h @@ -0,0 +1,111 @@ +/************************************************************************* + *** Copyright (c) 2024 HR Agrartechnik GmbH + *** This program and the accompanying materials are made available under the + *** terms of the Eclipse Public License 2.0 which is available at + *** http://www.eclipse.org/legal/epl-2.0. + *** + *** SPDX-License-Identifier: EPL-2.0 + *** + *** FORTE Library Element + *** + *** This file was generated using the 4DIAC FORTE Export Filter V1.0.x NG! + *** + *** Name: ASSEMBLE_BYTE_FROM_BOOLS + *** Description: this Function combines the 8 BOOLS to a BYTE + *** Version: + *** 1.0: 2024-02-22/Franz Höpfinger - HR Agrartechnik - initial Implementation + *** 1.1: 2024-07-28/Moritz Ortmeier - HR Agrartechnik - rename Function and change Input/Output Variables + *************************************************************************/ + +#pragma once + +#include "funcbloc.h" +#include "forte_byte.h" +#include "forte_bool.h" +#include "iec61131_functions.h" +#include "forte_array_common.h" +#include "forte_array.h" +#include "forte_array_fixed.h" +#include "forte_array_variable.h" + +class FORTE_ASSEMBLE_BYTE_FROM_BOOLS final : public CFunctionBlock { + DECLARE_FIRMWARE_FB(FORTE_ASSEMBLE_BYTE_FROM_BOOLS) + + private: + static const CStringDictionary::TStringId scmDataInputNames[]; + static const CStringDictionary::TStringId scmDataInputTypeIds[]; + static const CStringDictionary::TStringId scmDataOutputNames[]; + static const CStringDictionary::TStringId scmDataOutputTypeIds[]; + static const TEventID scmEventREQID = 0; + static const TDataIOID scmEIWith[]; + static const TForteInt16 scmEIWithIndexes[]; + static const CStringDictionary::TStringId scmEventInputNames[]; + static const TEventID scmEventCNFID = 0; + static const TDataIOID scmEOWith[]; + static const TForteInt16 scmEOWithIndexes[]; + static const CStringDictionary::TStringId scmEventOutputNames[]; + + static const SFBInterfaceSpec scmFBInterfaceSpec; + + void executeEvent(TEventID paEIID, CEventChainExecutionThread *const paECET) override; + + void readInputData(TEventID paEIID) override; + void writeOutputData(TEventID paEIID) override; + void setInitialValues() override; + + public: + FORTE_ASSEMBLE_BYTE_FROM_BOOLS(CStringDictionary::TStringId paInstanceNameId, forte::core::CFBContainer &paContainer); + + CIEC_BOOL var_BIT_00; + CIEC_BOOL var_BIT_01; + CIEC_BOOL var_BIT_02; + CIEC_BOOL var_BIT_03; + CIEC_BOOL var_BIT_04; + CIEC_BOOL var_BIT_05; + CIEC_BOOL var_BIT_06; + CIEC_BOOL var_BIT_07; + + CIEC_BYTE var_; + + CIEC_BYTE var_conn_; + + CEventConnection conn_CNF; + + CDataConnection *conn_BIT_00; + CDataConnection *conn_BIT_01; + CDataConnection *conn_BIT_02; + CDataConnection *conn_BIT_03; + CDataConnection *conn_BIT_04; + CDataConnection *conn_BIT_05; + CDataConnection *conn_BIT_06; + CDataConnection *conn_BIT_07; + + CDataConnection conn_; + + CIEC_ANY *getDI(size_t) override; + CIEC_ANY *getDO(size_t) override; + CEventConnection *getEOConUnchecked(TPortId) override; + CDataConnection **getDIConUnchecked(TPortId) override; + CDataConnection *getDOConUnchecked(TPortId) override; + + void evt_REQ(const CIEC_BOOL &paBIT_00, const CIEC_BOOL &paBIT_01, const CIEC_BOOL &paBIT_02, const CIEC_BOOL &paBIT_03, const CIEC_BOOL &paBIT_04, const CIEC_BOOL &paBIT_05, const CIEC_BOOL &paBIT_06, const CIEC_BOOL &paBIT_07, CIEC_BYTE &pa) { + var_BIT_00 = paBIT_00; + var_BIT_01 = paBIT_01; + var_BIT_02 = paBIT_02; + var_BIT_03 = paBIT_03; + var_BIT_04 = paBIT_04; + var_BIT_05 = paBIT_05; + var_BIT_06 = paBIT_06; + var_BIT_07 = paBIT_07; + executeEvent(scmEventREQID, nullptr); + pa = var_; + } + + void operator()(const CIEC_BOOL &paBIT_00, const CIEC_BOOL &paBIT_01, const CIEC_BOOL &paBIT_02, const CIEC_BOOL &paBIT_03, const CIEC_BOOL &paBIT_04, const CIEC_BOOL &paBIT_05, const CIEC_BOOL &paBIT_06, const CIEC_BOOL &paBIT_07, CIEC_BYTE &pa) { + evt_REQ(paBIT_00, paBIT_01, paBIT_02, paBIT_03, paBIT_04, paBIT_05, paBIT_06, paBIT_07, pa); + } +}; + +CIEC_BYTE func_ASSEMBLE_BYTE_FROM_BOOLS(CIEC_BOOL st_lv_BIT_00, CIEC_BOOL st_lv_BIT_01, CIEC_BOOL st_lv_BIT_02, CIEC_BOOL st_lv_BIT_03, CIEC_BOOL st_lv_BIT_04, CIEC_BOOL st_lv_BIT_05, CIEC_BOOL st_lv_BIT_06, CIEC_BOOL st_lv_BIT_07); + + diff --git a/src/modules/utils/assembling/ASSEMBLE_DWORD_FROM_BOOLS_fct.cpp b/src/modules/utils/assembling/ASSEMBLE_DWORD_FROM_BOOLS_fct.cpp new file mode 100644 index 000000000..a733e7101 --- /dev/null +++ b/src/modules/utils/assembling/ASSEMBLE_DWORD_FROM_BOOLS_fct.cpp @@ -0,0 +1,357 @@ +/************************************************************************* + *** Copyright (c) 2024 HR Agrartechnik GmbH + *** This program and the accompanying materials are made available under the + *** terms of the Eclipse Public License 2.0 which is available at + *** http://www.eclipse.org/legal/epl-2.0. + *** + *** SPDX-License-Identifier: EPL-2.0 + *** + *** FORTE Library Element + *** + *** This file was generated using the 4DIAC FORTE Export Filter V1.0.x NG! + *** + *** Name: ASSEMBLE_DWORD_FROM_BOOLS + *** Description: this Function combines the 32 BOOLS to a DWORD + *** Version: + *** 1.0: 2024-02-22/Franz Höpfinger - HR Agrartechnik - initial Implementation + *** 1.1: 2024-07-28/Moritz Ortmeier - HR Agrartechnik - rename Function and change Input/Output Variables + *************************************************************************/ + +#include "ASSEMBLE_DWORD_FROM_BOOLS_fct.h" +#ifdef FORTE_ENABLE_GENERATED_SOURCE_CPP +#include "ASSEMBLE_DWORD_FROM_BOOLS_fct_gen.cpp" +#endif + +#include "criticalregion.h" +#include "resource.h" +#include "forte_dword.h" +#include "forte_bool.h" +#include "iec61131_functions.h" +#include "forte_array_common.h" +#include "forte_array.h" +#include "forte_array_fixed.h" +#include "forte_array_variable.h" +#include "ASSEMBLE_DWORD_FROM_BOOLS_fct.h" + +DEFINE_FIRMWARE_FB(FORTE_ASSEMBLE_DWORD_FROM_BOOLS, g_nStringIdASSEMBLE_DWORD_FROM_BOOLS) + +const CStringDictionary::TStringId FORTE_ASSEMBLE_DWORD_FROM_BOOLS::scmDataInputNames[] = {g_nStringIdBIT_00, g_nStringIdBIT_01, g_nStringIdBIT_02, g_nStringIdBIT_03, g_nStringIdBIT_04, g_nStringIdBIT_05, g_nStringIdBIT_06, g_nStringIdBIT_07, g_nStringIdBIT_08, g_nStringIdBIT_09, g_nStringIdBIT_10, g_nStringIdBIT_11, g_nStringIdBIT_12, g_nStringIdBIT_13, g_nStringIdBIT_14, g_nStringIdBIT_15, g_nStringIdBIT_16, g_nStringIdBIT_17, g_nStringIdBIT_18, g_nStringIdBIT_19, g_nStringIdBIT_20, g_nStringIdBIT_21, g_nStringIdBIT_22, g_nStringIdBIT_23, g_nStringIdBIT_24, g_nStringIdBIT_25, g_nStringIdBIT_26, g_nStringIdBIT_27, g_nStringIdBIT_28, g_nStringIdBIT_29, g_nStringIdBIT_30, g_nStringIdBIT_31}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_DWORD_FROM_BOOLS::scmDataInputTypeIds[] = {g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_DWORD_FROM_BOOLS::scmDataOutputNames[] = {g_nStringId}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_DWORD_FROM_BOOLS::scmDataOutputTypeIds[] = {g_nStringIdDWORD}; +const TDataIOID FORTE_ASSEMBLE_DWORD_FROM_BOOLS::scmEIWith[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, scmWithListDelimiter}; +const TForteInt16 FORTE_ASSEMBLE_DWORD_FROM_BOOLS::scmEIWithIndexes[] = {0}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_DWORD_FROM_BOOLS::scmEventInputNames[] = {g_nStringIdREQ}; +const TDataIOID FORTE_ASSEMBLE_DWORD_FROM_BOOLS::scmEOWith[] = {0, scmWithListDelimiter}; +const TForteInt16 FORTE_ASSEMBLE_DWORD_FROM_BOOLS::scmEOWithIndexes[] = {0}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_DWORD_FROM_BOOLS::scmEventOutputNames[] = {g_nStringIdCNF}; +const SFBInterfaceSpec FORTE_ASSEMBLE_DWORD_FROM_BOOLS::scmFBInterfaceSpec = { + 1, scmEventInputNames, scmEIWith, scmEIWithIndexes, + 1, scmEventOutputNames, scmEOWith, scmEOWithIndexes, + 32, scmDataInputNames, scmDataInputTypeIds, + 1, scmDataOutputNames, scmDataOutputTypeIds, + 0, nullptr, + 0, nullptr +}; + +FORTE_ASSEMBLE_DWORD_FROM_BOOLS::FORTE_ASSEMBLE_DWORD_FROM_BOOLS(const CStringDictionary::TStringId paInstanceNameId, forte::core::CFBContainer &paContainer) : + CFunctionBlock(paContainer, scmFBInterfaceSpec, paInstanceNameId), + var_conn_(var_), + conn_CNF(this, 0), + conn_BIT_00(nullptr), + conn_BIT_01(nullptr), + conn_BIT_02(nullptr), + conn_BIT_03(nullptr), + conn_BIT_04(nullptr), + conn_BIT_05(nullptr), + conn_BIT_06(nullptr), + conn_BIT_07(nullptr), + conn_BIT_08(nullptr), + conn_BIT_09(nullptr), + conn_BIT_10(nullptr), + conn_BIT_11(nullptr), + conn_BIT_12(nullptr), + conn_BIT_13(nullptr), + conn_BIT_14(nullptr), + conn_BIT_15(nullptr), + conn_BIT_16(nullptr), + conn_BIT_17(nullptr), + conn_BIT_18(nullptr), + conn_BIT_19(nullptr), + conn_BIT_20(nullptr), + conn_BIT_21(nullptr), + conn_BIT_22(nullptr), + conn_BIT_23(nullptr), + conn_BIT_24(nullptr), + conn_BIT_25(nullptr), + conn_BIT_26(nullptr), + conn_BIT_27(nullptr), + conn_BIT_28(nullptr), + conn_BIT_29(nullptr), + conn_BIT_30(nullptr), + conn_BIT_31(nullptr), + conn_(this, 0, &var_conn_) { +} + +void FORTE_ASSEMBLE_DWORD_FROM_BOOLS::setInitialValues() { + var_BIT_00 = 0_BOOL; + var_BIT_01 = 0_BOOL; + var_BIT_02 = 0_BOOL; + var_BIT_03 = 0_BOOL; + var_BIT_04 = 0_BOOL; + var_BIT_05 = 0_BOOL; + var_BIT_06 = 0_BOOL; + var_BIT_07 = 0_BOOL; + var_BIT_08 = 0_BOOL; + var_BIT_09 = 0_BOOL; + var_BIT_10 = 0_BOOL; + var_BIT_11 = 0_BOOL; + var_BIT_12 = 0_BOOL; + var_BIT_13 = 0_BOOL; + var_BIT_14 = 0_BOOL; + var_BIT_15 = 0_BOOL; + var_BIT_16 = 0_BOOL; + var_BIT_17 = 0_BOOL; + var_BIT_18 = 0_BOOL; + var_BIT_19 = 0_BOOL; + var_BIT_20 = 0_BOOL; + var_BIT_21 = 0_BOOL; + var_BIT_22 = 0_BOOL; + var_BIT_23 = 0_BOOL; + var_BIT_24 = 0_BOOL; + var_BIT_25 = 0_BOOL; + var_BIT_26 = 0_BOOL; + var_BIT_27 = 0_BOOL; + var_BIT_28 = 0_BOOL; + var_BIT_29 = 0_BOOL; + var_BIT_30 = 0_BOOL; + var_BIT_31 = 0_BOOL; + var_ = 0_DWORD; +} + +void FORTE_ASSEMBLE_DWORD_FROM_BOOLS::readInputData(const TEventID paEIID) { + switch(paEIID) { + case scmEventREQID: { + readData(0, var_BIT_00, conn_BIT_00); + readData(1, var_BIT_01, conn_BIT_01); + readData(2, var_BIT_02, conn_BIT_02); + readData(3, var_BIT_03, conn_BIT_03); + readData(4, var_BIT_04, conn_BIT_04); + readData(5, var_BIT_05, conn_BIT_05); + readData(6, var_BIT_06, conn_BIT_06); + readData(7, var_BIT_07, conn_BIT_07); + readData(8, var_BIT_08, conn_BIT_08); + readData(9, var_BIT_09, conn_BIT_09); + readData(10, var_BIT_10, conn_BIT_10); + readData(11, var_BIT_11, conn_BIT_11); + readData(12, var_BIT_12, conn_BIT_12); + readData(13, var_BIT_13, conn_BIT_13); + readData(14, var_BIT_14, conn_BIT_14); + readData(15, var_BIT_15, conn_BIT_15); + readData(16, var_BIT_16, conn_BIT_16); + readData(17, var_BIT_17, conn_BIT_17); + readData(18, var_BIT_18, conn_BIT_18); + readData(19, var_BIT_19, conn_BIT_19); + readData(20, var_BIT_20, conn_BIT_20); + readData(21, var_BIT_21, conn_BIT_21); + readData(22, var_BIT_22, conn_BIT_22); + readData(23, var_BIT_23, conn_BIT_23); + readData(24, var_BIT_24, conn_BIT_24); + readData(25, var_BIT_25, conn_BIT_25); + readData(26, var_BIT_26, conn_BIT_26); + readData(27, var_BIT_27, conn_BIT_27); + readData(28, var_BIT_28, conn_BIT_28); + readData(29, var_BIT_29, conn_BIT_29); + readData(30, var_BIT_30, conn_BIT_30); + readData(31, var_BIT_31, conn_BIT_31); + break; + } + default: + break; + } +} + +void FORTE_ASSEMBLE_DWORD_FROM_BOOLS::writeOutputData(const TEventID paEIID) { + switch(paEIID) { + case scmEventCNFID: { + writeData(0, var_, conn_); + break; + } + default: + break; + } +} + +CIEC_ANY *FORTE_ASSEMBLE_DWORD_FROM_BOOLS::getDI(const size_t paIndex) { + switch(paIndex) { + case 0: return &var_BIT_00; + case 1: return &var_BIT_01; + case 2: return &var_BIT_02; + case 3: return &var_BIT_03; + case 4: return &var_BIT_04; + case 5: return &var_BIT_05; + case 6: return &var_BIT_06; + case 7: return &var_BIT_07; + case 8: return &var_BIT_08; + case 9: return &var_BIT_09; + case 10: return &var_BIT_10; + case 11: return &var_BIT_11; + case 12: return &var_BIT_12; + case 13: return &var_BIT_13; + case 14: return &var_BIT_14; + case 15: return &var_BIT_15; + case 16: return &var_BIT_16; + case 17: return &var_BIT_17; + case 18: return &var_BIT_18; + case 19: return &var_BIT_19; + case 20: return &var_BIT_20; + case 21: return &var_BIT_21; + case 22: return &var_BIT_22; + case 23: return &var_BIT_23; + case 24: return &var_BIT_24; + case 25: return &var_BIT_25; + case 26: return &var_BIT_26; + case 27: return &var_BIT_27; + case 28: return &var_BIT_28; + case 29: return &var_BIT_29; + case 30: return &var_BIT_30; + case 31: return &var_BIT_31; + } + return nullptr; +} + +CIEC_ANY *FORTE_ASSEMBLE_DWORD_FROM_BOOLS::getDO(const size_t paIndex) { + switch(paIndex) { + case 0: return &var_; + } + return nullptr; +} + +CEventConnection *FORTE_ASSEMBLE_DWORD_FROM_BOOLS::getEOConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_CNF; + } + return nullptr; +} + +CDataConnection **FORTE_ASSEMBLE_DWORD_FROM_BOOLS::getDIConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_BIT_00; + case 1: return &conn_BIT_01; + case 2: return &conn_BIT_02; + case 3: return &conn_BIT_03; + case 4: return &conn_BIT_04; + case 5: return &conn_BIT_05; + case 6: return &conn_BIT_06; + case 7: return &conn_BIT_07; + case 8: return &conn_BIT_08; + case 9: return &conn_BIT_09; + case 10: return &conn_BIT_10; + case 11: return &conn_BIT_11; + case 12: return &conn_BIT_12; + case 13: return &conn_BIT_13; + case 14: return &conn_BIT_14; + case 15: return &conn_BIT_15; + case 16: return &conn_BIT_16; + case 17: return &conn_BIT_17; + case 18: return &conn_BIT_18; + case 19: return &conn_BIT_19; + case 20: return &conn_BIT_20; + case 21: return &conn_BIT_21; + case 22: return &conn_BIT_22; + case 23: return &conn_BIT_23; + case 24: return &conn_BIT_24; + case 25: return &conn_BIT_25; + case 26: return &conn_BIT_26; + case 27: return &conn_BIT_27; + case 28: return &conn_BIT_28; + case 29: return &conn_BIT_29; + case 30: return &conn_BIT_30; + case 31: return &conn_BIT_31; + } + return nullptr; +} + +CDataConnection *FORTE_ASSEMBLE_DWORD_FROM_BOOLS::getDOConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_; + } + return nullptr; +} + +void FORTE_ASSEMBLE_DWORD_FROM_BOOLS::executeEvent(const TEventID, CEventChainExecutionThread *const paECET) { + var_ = func_ASSEMBLE_DWORD_FROM_BOOLS(var_BIT_00, var_BIT_01, var_BIT_02, var_BIT_03, var_BIT_04, var_BIT_05, var_BIT_06, var_BIT_07, var_BIT_08, var_BIT_09, var_BIT_10, var_BIT_11, var_BIT_12, var_BIT_13, var_BIT_14, var_BIT_15, var_BIT_16, var_BIT_17, var_BIT_18, var_BIT_19, var_BIT_20, var_BIT_21, var_BIT_22, var_BIT_23, var_BIT_24, var_BIT_25, var_BIT_26, var_BIT_27, var_BIT_28, var_BIT_29, var_BIT_30, var_BIT_31); + sendOutputEvent(scmEventCNFID, paECET); +} + +CIEC_DWORD func_ASSEMBLE_DWORD_FROM_BOOLS(CIEC_BOOL st_lv_BIT_00, CIEC_BOOL st_lv_BIT_01, CIEC_BOOL st_lv_BIT_02, CIEC_BOOL st_lv_BIT_03, CIEC_BOOL st_lv_BIT_04, CIEC_BOOL st_lv_BIT_05, CIEC_BOOL st_lv_BIT_06, CIEC_BOOL st_lv_BIT_07, CIEC_BOOL st_lv_BIT_08, CIEC_BOOL st_lv_BIT_09, CIEC_BOOL st_lv_BIT_10, CIEC_BOOL st_lv_BIT_11, CIEC_BOOL st_lv_BIT_12, CIEC_BOOL st_lv_BIT_13, CIEC_BOOL st_lv_BIT_14, CIEC_BOOL st_lv_BIT_15, CIEC_BOOL st_lv_BIT_16, CIEC_BOOL st_lv_BIT_17, CIEC_BOOL st_lv_BIT_18, CIEC_BOOL st_lv_BIT_19, CIEC_BOOL st_lv_BIT_20, CIEC_BOOL st_lv_BIT_21, CIEC_BOOL st_lv_BIT_22, CIEC_BOOL st_lv_BIT_23, CIEC_BOOL st_lv_BIT_24, CIEC_BOOL st_lv_BIT_25, CIEC_BOOL st_lv_BIT_26, CIEC_BOOL st_lv_BIT_27, CIEC_BOOL st_lv_BIT_28, CIEC_BOOL st_lv_BIT_29, CIEC_BOOL st_lv_BIT_30, CIEC_BOOL st_lv_BIT_31) { + CIEC_DWORD st_ret_val = 0_DWORD; + + #line 39 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(0) = st_lv_BIT_00; + #line 40 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(1) = st_lv_BIT_01; + #line 41 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(2) = st_lv_BIT_02; + #line 42 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(3) = st_lv_BIT_03; + #line 43 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(4) = st_lv_BIT_04; + #line 44 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(5) = st_lv_BIT_05; + #line 45 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(6) = st_lv_BIT_06; + #line 46 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(7) = st_lv_BIT_07; + #line 47 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(8) = st_lv_BIT_08; + #line 48 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(9) = st_lv_BIT_09; + #line 49 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(10) = st_lv_BIT_10; + #line 50 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(11) = st_lv_BIT_11; + #line 51 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(12) = st_lv_BIT_12; + #line 52 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(13) = st_lv_BIT_13; + #line 53 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(14) = st_lv_BIT_14; + #line 54 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(15) = st_lv_BIT_15; + #line 55 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(16) = st_lv_BIT_16; + #line 56 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(17) = st_lv_BIT_17; + #line 57 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(18) = st_lv_BIT_18; + #line 58 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(19) = st_lv_BIT_19; + #line 59 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(20) = st_lv_BIT_20; + #line 60 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(21) = st_lv_BIT_21; + #line 61 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(22) = st_lv_BIT_22; + #line 62 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(23) = st_lv_BIT_23; + #line 63 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(24) = st_lv_BIT_24; + #line 64 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(25) = st_lv_BIT_25; + #line 65 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(26) = st_lv_BIT_26; + #line 66 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(27) = st_lv_BIT_27; + #line 67 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(28) = st_lv_BIT_28; + #line 68 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(29) = st_lv_BIT_29; + #line 69 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(30) = st_lv_BIT_30; + #line 70 "ASSEMBLE_DWORD_FROM_BOOLS.fct" + st_ret_val.partial(31) = st_lv_BIT_31; + + return st_ret_val; +} + diff --git a/src/modules/utils/assembling/ASSEMBLE_DWORD_FROM_BOOLS_fct.h b/src/modules/utils/assembling/ASSEMBLE_DWORD_FROM_BOOLS_fct.h new file mode 100644 index 000000000..e2055ab4e --- /dev/null +++ b/src/modules/utils/assembling/ASSEMBLE_DWORD_FROM_BOOLS_fct.h @@ -0,0 +1,183 @@ +/************************************************************************* + *** Copyright (c) 2024 HR Agrartechnik GmbH + *** This program and the accompanying materials are made available under the + *** terms of the Eclipse Public License 2.0 which is available at + *** http://www.eclipse.org/legal/epl-2.0. + *** + *** SPDX-License-Identifier: EPL-2.0 + *** + *** FORTE Library Element + *** + *** This file was generated using the 4DIAC FORTE Export Filter V1.0.x NG! + *** + *** Name: ASSEMBLE_DWORD_FROM_BOOLS + *** Description: this Function combines the 32 BOOLS to a DWORD + *** Version: + *** 1.0: 2024-02-22/Franz Höpfinger - HR Agrartechnik - initial Implementation + *** 1.1: 2024-07-28/Moritz Ortmeier - HR Agrartechnik - rename Function and change Input/Output Variables + *************************************************************************/ + +#pragma once + +#include "funcbloc.h" +#include "forte_dword.h" +#include "forte_bool.h" +#include "iec61131_functions.h" +#include "forte_array_common.h" +#include "forte_array.h" +#include "forte_array_fixed.h" +#include "forte_array_variable.h" + +class FORTE_ASSEMBLE_DWORD_FROM_BOOLS final : public CFunctionBlock { + DECLARE_FIRMWARE_FB(FORTE_ASSEMBLE_DWORD_FROM_BOOLS) + + private: + static const CStringDictionary::TStringId scmDataInputNames[]; + static const CStringDictionary::TStringId scmDataInputTypeIds[]; + static const CStringDictionary::TStringId scmDataOutputNames[]; + static const CStringDictionary::TStringId scmDataOutputTypeIds[]; + static const TEventID scmEventREQID = 0; + static const TDataIOID scmEIWith[]; + static const TForteInt16 scmEIWithIndexes[]; + static const CStringDictionary::TStringId scmEventInputNames[]; + static const TEventID scmEventCNFID = 0; + static const TDataIOID scmEOWith[]; + static const TForteInt16 scmEOWithIndexes[]; + static const CStringDictionary::TStringId scmEventOutputNames[]; + + static const SFBInterfaceSpec scmFBInterfaceSpec; + + void executeEvent(TEventID paEIID, CEventChainExecutionThread *const paECET) override; + + void readInputData(TEventID paEIID) override; + void writeOutputData(TEventID paEIID) override; + void setInitialValues() override; + + public: + FORTE_ASSEMBLE_DWORD_FROM_BOOLS(CStringDictionary::TStringId paInstanceNameId, forte::core::CFBContainer &paContainer); + + CIEC_BOOL var_BIT_00; + CIEC_BOOL var_BIT_01; + CIEC_BOOL var_BIT_02; + CIEC_BOOL var_BIT_03; + CIEC_BOOL var_BIT_04; + CIEC_BOOL var_BIT_05; + CIEC_BOOL var_BIT_06; + CIEC_BOOL var_BIT_07; + CIEC_BOOL var_BIT_08; + CIEC_BOOL var_BIT_09; + CIEC_BOOL var_BIT_10; + CIEC_BOOL var_BIT_11; + CIEC_BOOL var_BIT_12; + CIEC_BOOL var_BIT_13; + CIEC_BOOL var_BIT_14; + CIEC_BOOL var_BIT_15; + CIEC_BOOL var_BIT_16; + CIEC_BOOL var_BIT_17; + CIEC_BOOL var_BIT_18; + CIEC_BOOL var_BIT_19; + CIEC_BOOL var_BIT_20; + CIEC_BOOL var_BIT_21; + CIEC_BOOL var_BIT_22; + CIEC_BOOL var_BIT_23; + CIEC_BOOL var_BIT_24; + CIEC_BOOL var_BIT_25; + CIEC_BOOL var_BIT_26; + CIEC_BOOL var_BIT_27; + CIEC_BOOL var_BIT_28; + CIEC_BOOL var_BIT_29; + CIEC_BOOL var_BIT_30; + CIEC_BOOL var_BIT_31; + + CIEC_DWORD var_; + + CIEC_DWORD var_conn_; + + CEventConnection conn_CNF; + + CDataConnection *conn_BIT_00; + CDataConnection *conn_BIT_01; + CDataConnection *conn_BIT_02; + CDataConnection *conn_BIT_03; + CDataConnection *conn_BIT_04; + CDataConnection *conn_BIT_05; + CDataConnection *conn_BIT_06; + CDataConnection *conn_BIT_07; + CDataConnection *conn_BIT_08; + CDataConnection *conn_BIT_09; + CDataConnection *conn_BIT_10; + CDataConnection *conn_BIT_11; + CDataConnection *conn_BIT_12; + CDataConnection *conn_BIT_13; + CDataConnection *conn_BIT_14; + CDataConnection *conn_BIT_15; + CDataConnection *conn_BIT_16; + CDataConnection *conn_BIT_17; + CDataConnection *conn_BIT_18; + CDataConnection *conn_BIT_19; + CDataConnection *conn_BIT_20; + CDataConnection *conn_BIT_21; + CDataConnection *conn_BIT_22; + CDataConnection *conn_BIT_23; + CDataConnection *conn_BIT_24; + CDataConnection *conn_BIT_25; + CDataConnection *conn_BIT_26; + CDataConnection *conn_BIT_27; + CDataConnection *conn_BIT_28; + CDataConnection *conn_BIT_29; + CDataConnection *conn_BIT_30; + CDataConnection *conn_BIT_31; + + CDataConnection conn_; + + CIEC_ANY *getDI(size_t) override; + CIEC_ANY *getDO(size_t) override; + CEventConnection *getEOConUnchecked(TPortId) override; + CDataConnection **getDIConUnchecked(TPortId) override; + CDataConnection *getDOConUnchecked(TPortId) override; + + void evt_REQ(const CIEC_BOOL &paBIT_00, const CIEC_BOOL &paBIT_01, const CIEC_BOOL &paBIT_02, const CIEC_BOOL &paBIT_03, const CIEC_BOOL &paBIT_04, const CIEC_BOOL &paBIT_05, const CIEC_BOOL &paBIT_06, const CIEC_BOOL &paBIT_07, const CIEC_BOOL &paBIT_08, const CIEC_BOOL &paBIT_09, const CIEC_BOOL &paBIT_10, const CIEC_BOOL &paBIT_11, const CIEC_BOOL &paBIT_12, const CIEC_BOOL &paBIT_13, const CIEC_BOOL &paBIT_14, const CIEC_BOOL &paBIT_15, const CIEC_BOOL &paBIT_16, const CIEC_BOOL &paBIT_17, const CIEC_BOOL &paBIT_18, const CIEC_BOOL &paBIT_19, const CIEC_BOOL &paBIT_20, const CIEC_BOOL &paBIT_21, const CIEC_BOOL &paBIT_22, const CIEC_BOOL &paBIT_23, const CIEC_BOOL &paBIT_24, const CIEC_BOOL &paBIT_25, const CIEC_BOOL &paBIT_26, const CIEC_BOOL &paBIT_27, const CIEC_BOOL &paBIT_28, const CIEC_BOOL &paBIT_29, const CIEC_BOOL &paBIT_30, const CIEC_BOOL &paBIT_31, CIEC_DWORD &pa) { + var_BIT_00 = paBIT_00; + var_BIT_01 = paBIT_01; + var_BIT_02 = paBIT_02; + var_BIT_03 = paBIT_03; + var_BIT_04 = paBIT_04; + var_BIT_05 = paBIT_05; + var_BIT_06 = paBIT_06; + var_BIT_07 = paBIT_07; + var_BIT_08 = paBIT_08; + var_BIT_09 = paBIT_09; + var_BIT_10 = paBIT_10; + var_BIT_11 = paBIT_11; + var_BIT_12 = paBIT_12; + var_BIT_13 = paBIT_13; + var_BIT_14 = paBIT_14; + var_BIT_15 = paBIT_15; + var_BIT_16 = paBIT_16; + var_BIT_17 = paBIT_17; + var_BIT_18 = paBIT_18; + var_BIT_19 = paBIT_19; + var_BIT_20 = paBIT_20; + var_BIT_21 = paBIT_21; + var_BIT_22 = paBIT_22; + var_BIT_23 = paBIT_23; + var_BIT_24 = paBIT_24; + var_BIT_25 = paBIT_25; + var_BIT_26 = paBIT_26; + var_BIT_27 = paBIT_27; + var_BIT_28 = paBIT_28; + var_BIT_29 = paBIT_29; + var_BIT_30 = paBIT_30; + var_BIT_31 = paBIT_31; + executeEvent(scmEventREQID, nullptr); + pa = var_; + } + + void operator()(const CIEC_BOOL &paBIT_00, const CIEC_BOOL &paBIT_01, const CIEC_BOOL &paBIT_02, const CIEC_BOOL &paBIT_03, const CIEC_BOOL &paBIT_04, const CIEC_BOOL &paBIT_05, const CIEC_BOOL &paBIT_06, const CIEC_BOOL &paBIT_07, const CIEC_BOOL &paBIT_08, const CIEC_BOOL &paBIT_09, const CIEC_BOOL &paBIT_10, const CIEC_BOOL &paBIT_11, const CIEC_BOOL &paBIT_12, const CIEC_BOOL &paBIT_13, const CIEC_BOOL &paBIT_14, const CIEC_BOOL &paBIT_15, const CIEC_BOOL &paBIT_16, const CIEC_BOOL &paBIT_17, const CIEC_BOOL &paBIT_18, const CIEC_BOOL &paBIT_19, const CIEC_BOOL &paBIT_20, const CIEC_BOOL &paBIT_21, const CIEC_BOOL &paBIT_22, const CIEC_BOOL &paBIT_23, const CIEC_BOOL &paBIT_24, const CIEC_BOOL &paBIT_25, const CIEC_BOOL &paBIT_26, const CIEC_BOOL &paBIT_27, const CIEC_BOOL &paBIT_28, const CIEC_BOOL &paBIT_29, const CIEC_BOOL &paBIT_30, const CIEC_BOOL &paBIT_31, CIEC_DWORD &pa) { + evt_REQ(paBIT_00, paBIT_01, paBIT_02, paBIT_03, paBIT_04, paBIT_05, paBIT_06, paBIT_07, paBIT_08, paBIT_09, paBIT_10, paBIT_11, paBIT_12, paBIT_13, paBIT_14, paBIT_15, paBIT_16, paBIT_17, paBIT_18, paBIT_19, paBIT_20, paBIT_21, paBIT_22, paBIT_23, paBIT_24, paBIT_25, paBIT_26, paBIT_27, paBIT_28, paBIT_29, paBIT_30, paBIT_31, pa); + } +}; + +CIEC_DWORD func_ASSEMBLE_DWORD_FROM_BOOLS(CIEC_BOOL st_lv_BIT_00, CIEC_BOOL st_lv_BIT_01, CIEC_BOOL st_lv_BIT_02, CIEC_BOOL st_lv_BIT_03, CIEC_BOOL st_lv_BIT_04, CIEC_BOOL st_lv_BIT_05, CIEC_BOOL st_lv_BIT_06, CIEC_BOOL st_lv_BIT_07, CIEC_BOOL st_lv_BIT_08, CIEC_BOOL st_lv_BIT_09, CIEC_BOOL st_lv_BIT_10, CIEC_BOOL st_lv_BIT_11, CIEC_BOOL st_lv_BIT_12, CIEC_BOOL st_lv_BIT_13, CIEC_BOOL st_lv_BIT_14, CIEC_BOOL st_lv_BIT_15, CIEC_BOOL st_lv_BIT_16, CIEC_BOOL st_lv_BIT_17, CIEC_BOOL st_lv_BIT_18, CIEC_BOOL st_lv_BIT_19, CIEC_BOOL st_lv_BIT_20, CIEC_BOOL st_lv_BIT_21, CIEC_BOOL st_lv_BIT_22, CIEC_BOOL st_lv_BIT_23, CIEC_BOOL st_lv_BIT_24, CIEC_BOOL st_lv_BIT_25, CIEC_BOOL st_lv_BIT_26, CIEC_BOOL st_lv_BIT_27, CIEC_BOOL st_lv_BIT_28, CIEC_BOOL st_lv_BIT_29, CIEC_BOOL st_lv_BIT_30, CIEC_BOOL st_lv_BIT_31); + + diff --git a/src/modules/utils/assembling/ASSEMBLE_LWORD_FROM_BOOLS_fct.cpp b/src/modules/utils/assembling/ASSEMBLE_LWORD_FROM_BOOLS_fct.cpp new file mode 100644 index 000000000..d0e61891b --- /dev/null +++ b/src/modules/utils/assembling/ASSEMBLE_LWORD_FROM_BOOLS_fct.cpp @@ -0,0 +1,581 @@ +/************************************************************************* + *** Copyright (c) 2024 HR Agrartechnik GmbH + *** This program and the accompanying materials are made available under the + *** terms of the Eclipse Public License 2.0 which is available at + *** http://www.eclipse.org/legal/epl-2.0. + *** + *** SPDX-License-Identifier: EPL-2.0 + *** + *** FORTE Library Element + *** + *** This file was generated using the 4DIAC FORTE Export Filter V1.0.x NG! + *** + *** Name: ASSEMBLE_LWORD_FROM_BOOLS + *** Description: this Function combines the 64 BOOLS to a LWORD + *** Version: + *** 1.0: 2024-02-22/Franz Höpfinger - HR Agrartechnik - initial Implementation + *** 1.1: 2024-07-28/Moritz Ortmeier - HR Agrartechnik - rename Function and change Input/Output Variables + *************************************************************************/ + +#include "ASSEMBLE_LWORD_FROM_BOOLS_fct.h" +#ifdef FORTE_ENABLE_GENERATED_SOURCE_CPP +#include "ASSEMBLE_LWORD_FROM_BOOLS_fct_gen.cpp" +#endif + +#include "criticalregion.h" +#include "resource.h" +#include "forte_lword.h" +#include "forte_bool.h" +#include "iec61131_functions.h" +#include "forte_array_common.h" +#include "forte_array.h" +#include "forte_array_fixed.h" +#include "forte_array_variable.h" +#include "ASSEMBLE_LWORD_FROM_BOOLS_fct.h" + +DEFINE_FIRMWARE_FB(FORTE_ASSEMBLE_LWORD_FROM_BOOLS, g_nStringIdASSEMBLE_LWORD_FROM_BOOLS) + +const CStringDictionary::TStringId FORTE_ASSEMBLE_LWORD_FROM_BOOLS::scmDataInputNames[] = {g_nStringIdBIT_00, g_nStringIdBIT_01, g_nStringIdBIT_02, g_nStringIdBIT_03, g_nStringIdBIT_04, g_nStringIdBIT_05, g_nStringIdBIT_06, g_nStringIdBIT_07, g_nStringIdBIT_08, g_nStringIdBIT_09, g_nStringIdBIT_10, g_nStringIdBIT_11, g_nStringIdBIT_12, g_nStringIdBIT_13, g_nStringIdBIT_14, g_nStringIdBIT_15, g_nStringIdBIT_16, g_nStringIdBIT_17, g_nStringIdBIT_18, g_nStringIdBIT_19, g_nStringIdBIT_20, g_nStringIdBIT_21, g_nStringIdBIT_22, g_nStringIdBIT_23, g_nStringIdBIT_24, g_nStringIdBIT_25, g_nStringIdBIT_26, g_nStringIdBIT_27, g_nStringIdBIT_28, g_nStringIdBIT_29, g_nStringIdBIT_30, g_nStringIdBIT_31, g_nStringIdBIT_32, g_nStringIdBIT_33, g_nStringIdBIT_34, g_nStringIdBIT_35, g_nStringIdBIT_36, g_nStringIdBIT_37, g_nStringIdBIT_38, g_nStringIdBIT_39, g_nStringIdBIT_40, g_nStringIdBIT_41, g_nStringIdBIT_42, g_nStringIdBIT_43, g_nStringIdBIT_44, g_nStringIdBIT_45, g_nStringIdBIT_46, g_nStringIdBIT_47, g_nStringIdBIT_48, g_nStringIdBIT_49, g_nStringIdBIT_50, g_nStringIdBIT_51, g_nStringIdBIT_52, g_nStringIdBIT_53, g_nStringIdBIT_54, g_nStringIdBIT_55, g_nStringIdBIT_56, g_nStringIdBIT_57, g_nStringIdBIT_58, g_nStringIdBIT_59, g_nStringIdBIT_60, g_nStringIdBIT_61, g_nStringIdBIT_62, g_nStringIdBIT_63}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_LWORD_FROM_BOOLS::scmDataInputTypeIds[] = {g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_LWORD_FROM_BOOLS::scmDataOutputNames[] = {g_nStringId}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_LWORD_FROM_BOOLS::scmDataOutputTypeIds[] = {g_nStringIdLWORD}; +const TDataIOID FORTE_ASSEMBLE_LWORD_FROM_BOOLS::scmEIWith[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, scmWithListDelimiter}; +const TForteInt16 FORTE_ASSEMBLE_LWORD_FROM_BOOLS::scmEIWithIndexes[] = {0}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_LWORD_FROM_BOOLS::scmEventInputNames[] = {g_nStringIdREQ}; +const TDataIOID FORTE_ASSEMBLE_LWORD_FROM_BOOLS::scmEOWith[] = {0, scmWithListDelimiter}; +const TForteInt16 FORTE_ASSEMBLE_LWORD_FROM_BOOLS::scmEOWithIndexes[] = {0}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_LWORD_FROM_BOOLS::scmEventOutputNames[] = {g_nStringIdCNF}; +const SFBInterfaceSpec FORTE_ASSEMBLE_LWORD_FROM_BOOLS::scmFBInterfaceSpec = { + 1, scmEventInputNames, scmEIWith, scmEIWithIndexes, + 1, scmEventOutputNames, scmEOWith, scmEOWithIndexes, + 64, scmDataInputNames, scmDataInputTypeIds, + 1, scmDataOutputNames, scmDataOutputTypeIds, + 0, nullptr, + 0, nullptr +}; + +FORTE_ASSEMBLE_LWORD_FROM_BOOLS::FORTE_ASSEMBLE_LWORD_FROM_BOOLS(const CStringDictionary::TStringId paInstanceNameId, forte::core::CFBContainer &paContainer) : + CFunctionBlock(paContainer, scmFBInterfaceSpec, paInstanceNameId), + var_conn_(var_), + conn_CNF(this, 0), + conn_BIT_00(nullptr), + conn_BIT_01(nullptr), + conn_BIT_02(nullptr), + conn_BIT_03(nullptr), + conn_BIT_04(nullptr), + conn_BIT_05(nullptr), + conn_BIT_06(nullptr), + conn_BIT_07(nullptr), + conn_BIT_08(nullptr), + conn_BIT_09(nullptr), + conn_BIT_10(nullptr), + conn_BIT_11(nullptr), + conn_BIT_12(nullptr), + conn_BIT_13(nullptr), + conn_BIT_14(nullptr), + conn_BIT_15(nullptr), + conn_BIT_16(nullptr), + conn_BIT_17(nullptr), + conn_BIT_18(nullptr), + conn_BIT_19(nullptr), + conn_BIT_20(nullptr), + conn_BIT_21(nullptr), + conn_BIT_22(nullptr), + conn_BIT_23(nullptr), + conn_BIT_24(nullptr), + conn_BIT_25(nullptr), + conn_BIT_26(nullptr), + conn_BIT_27(nullptr), + conn_BIT_28(nullptr), + conn_BIT_29(nullptr), + conn_BIT_30(nullptr), + conn_BIT_31(nullptr), + conn_BIT_32(nullptr), + conn_BIT_33(nullptr), + conn_BIT_34(nullptr), + conn_BIT_35(nullptr), + conn_BIT_36(nullptr), + conn_BIT_37(nullptr), + conn_BIT_38(nullptr), + conn_BIT_39(nullptr), + conn_BIT_40(nullptr), + conn_BIT_41(nullptr), + conn_BIT_42(nullptr), + conn_BIT_43(nullptr), + conn_BIT_44(nullptr), + conn_BIT_45(nullptr), + conn_BIT_46(nullptr), + conn_BIT_47(nullptr), + conn_BIT_48(nullptr), + conn_BIT_49(nullptr), + conn_BIT_50(nullptr), + conn_BIT_51(nullptr), + conn_BIT_52(nullptr), + conn_BIT_53(nullptr), + conn_BIT_54(nullptr), + conn_BIT_55(nullptr), + conn_BIT_56(nullptr), + conn_BIT_57(nullptr), + conn_BIT_58(nullptr), + conn_BIT_59(nullptr), + conn_BIT_60(nullptr), + conn_BIT_61(nullptr), + conn_BIT_62(nullptr), + conn_BIT_63(nullptr), + conn_(this, 0, &var_conn_) { +} + +void FORTE_ASSEMBLE_LWORD_FROM_BOOLS::setInitialValues() { + var_BIT_00 = 0_BOOL; + var_BIT_01 = 0_BOOL; + var_BIT_02 = 0_BOOL; + var_BIT_03 = 0_BOOL; + var_BIT_04 = 0_BOOL; + var_BIT_05 = 0_BOOL; + var_BIT_06 = 0_BOOL; + var_BIT_07 = 0_BOOL; + var_BIT_08 = 0_BOOL; + var_BIT_09 = 0_BOOL; + var_BIT_10 = 0_BOOL; + var_BIT_11 = 0_BOOL; + var_BIT_12 = 0_BOOL; + var_BIT_13 = 0_BOOL; + var_BIT_14 = 0_BOOL; + var_BIT_15 = 0_BOOL; + var_BIT_16 = 0_BOOL; + var_BIT_17 = 0_BOOL; + var_BIT_18 = 0_BOOL; + var_BIT_19 = 0_BOOL; + var_BIT_20 = 0_BOOL; + var_BIT_21 = 0_BOOL; + var_BIT_22 = 0_BOOL; + var_BIT_23 = 0_BOOL; + var_BIT_24 = 0_BOOL; + var_BIT_25 = 0_BOOL; + var_BIT_26 = 0_BOOL; + var_BIT_27 = 0_BOOL; + var_BIT_28 = 0_BOOL; + var_BIT_29 = 0_BOOL; + var_BIT_30 = 0_BOOL; + var_BIT_31 = 0_BOOL; + var_BIT_32 = 0_BOOL; + var_BIT_33 = 0_BOOL; + var_BIT_34 = 0_BOOL; + var_BIT_35 = 0_BOOL; + var_BIT_36 = 0_BOOL; + var_BIT_37 = 0_BOOL; + var_BIT_38 = 0_BOOL; + var_BIT_39 = 0_BOOL; + var_BIT_40 = 0_BOOL; + var_BIT_41 = 0_BOOL; + var_BIT_42 = 0_BOOL; + var_BIT_43 = 0_BOOL; + var_BIT_44 = 0_BOOL; + var_BIT_45 = 0_BOOL; + var_BIT_46 = 0_BOOL; + var_BIT_47 = 0_BOOL; + var_BIT_48 = 0_BOOL; + var_BIT_49 = 0_BOOL; + var_BIT_50 = 0_BOOL; + var_BIT_51 = 0_BOOL; + var_BIT_52 = 0_BOOL; + var_BIT_53 = 0_BOOL; + var_BIT_54 = 0_BOOL; + var_BIT_55 = 0_BOOL; + var_BIT_56 = 0_BOOL; + var_BIT_57 = 0_BOOL; + var_BIT_58 = 0_BOOL; + var_BIT_59 = 0_BOOL; + var_BIT_60 = 0_BOOL; + var_BIT_61 = 0_BOOL; + var_BIT_62 = 0_BOOL; + var_BIT_63 = 0_BOOL; + var_ = 0_LWORD; +} + +void FORTE_ASSEMBLE_LWORD_FROM_BOOLS::readInputData(const TEventID paEIID) { + switch(paEIID) { + case scmEventREQID: { + readData(0, var_BIT_00, conn_BIT_00); + readData(1, var_BIT_01, conn_BIT_01); + readData(2, var_BIT_02, conn_BIT_02); + readData(3, var_BIT_03, conn_BIT_03); + readData(4, var_BIT_04, conn_BIT_04); + readData(5, var_BIT_05, conn_BIT_05); + readData(6, var_BIT_06, conn_BIT_06); + readData(7, var_BIT_07, conn_BIT_07); + readData(8, var_BIT_08, conn_BIT_08); + readData(9, var_BIT_09, conn_BIT_09); + readData(10, var_BIT_10, conn_BIT_10); + readData(11, var_BIT_11, conn_BIT_11); + readData(12, var_BIT_12, conn_BIT_12); + readData(13, var_BIT_13, conn_BIT_13); + readData(14, var_BIT_14, conn_BIT_14); + readData(15, var_BIT_15, conn_BIT_15); + readData(16, var_BIT_16, conn_BIT_16); + readData(17, var_BIT_17, conn_BIT_17); + readData(18, var_BIT_18, conn_BIT_18); + readData(19, var_BIT_19, conn_BIT_19); + readData(20, var_BIT_20, conn_BIT_20); + readData(21, var_BIT_21, conn_BIT_21); + readData(22, var_BIT_22, conn_BIT_22); + readData(23, var_BIT_23, conn_BIT_23); + readData(24, var_BIT_24, conn_BIT_24); + readData(25, var_BIT_25, conn_BIT_25); + readData(26, var_BIT_26, conn_BIT_26); + readData(27, var_BIT_27, conn_BIT_27); + readData(28, var_BIT_28, conn_BIT_28); + readData(29, var_BIT_29, conn_BIT_29); + readData(30, var_BIT_30, conn_BIT_30); + readData(31, var_BIT_31, conn_BIT_31); + readData(32, var_BIT_32, conn_BIT_32); + readData(33, var_BIT_33, conn_BIT_33); + readData(34, var_BIT_34, conn_BIT_34); + readData(35, var_BIT_35, conn_BIT_35); + readData(36, var_BIT_36, conn_BIT_36); + readData(37, var_BIT_37, conn_BIT_37); + readData(38, var_BIT_38, conn_BIT_38); + readData(39, var_BIT_39, conn_BIT_39); + readData(40, var_BIT_40, conn_BIT_40); + readData(41, var_BIT_41, conn_BIT_41); + readData(42, var_BIT_42, conn_BIT_42); + readData(43, var_BIT_43, conn_BIT_43); + readData(44, var_BIT_44, conn_BIT_44); + readData(45, var_BIT_45, conn_BIT_45); + readData(46, var_BIT_46, conn_BIT_46); + readData(47, var_BIT_47, conn_BIT_47); + readData(48, var_BIT_48, conn_BIT_48); + readData(49, var_BIT_49, conn_BIT_49); + readData(50, var_BIT_50, conn_BIT_50); + readData(51, var_BIT_51, conn_BIT_51); + readData(52, var_BIT_52, conn_BIT_52); + readData(53, var_BIT_53, conn_BIT_53); + readData(54, var_BIT_54, conn_BIT_54); + readData(55, var_BIT_55, conn_BIT_55); + readData(56, var_BIT_56, conn_BIT_56); + readData(57, var_BIT_57, conn_BIT_57); + readData(58, var_BIT_58, conn_BIT_58); + readData(59, var_BIT_59, conn_BIT_59); + readData(60, var_BIT_60, conn_BIT_60); + readData(61, var_BIT_61, conn_BIT_61); + readData(62, var_BIT_62, conn_BIT_62); + readData(63, var_BIT_63, conn_BIT_63); + break; + } + default: + break; + } +} + +void FORTE_ASSEMBLE_LWORD_FROM_BOOLS::writeOutputData(const TEventID paEIID) { + switch(paEIID) { + case scmEventCNFID: { + writeData(0, var_, conn_); + break; + } + default: + break; + } +} + +CIEC_ANY *FORTE_ASSEMBLE_LWORD_FROM_BOOLS::getDI(const size_t paIndex) { + switch(paIndex) { + case 0: return &var_BIT_00; + case 1: return &var_BIT_01; + case 2: return &var_BIT_02; + case 3: return &var_BIT_03; + case 4: return &var_BIT_04; + case 5: return &var_BIT_05; + case 6: return &var_BIT_06; + case 7: return &var_BIT_07; + case 8: return &var_BIT_08; + case 9: return &var_BIT_09; + case 10: return &var_BIT_10; + case 11: return &var_BIT_11; + case 12: return &var_BIT_12; + case 13: return &var_BIT_13; + case 14: return &var_BIT_14; + case 15: return &var_BIT_15; + case 16: return &var_BIT_16; + case 17: return &var_BIT_17; + case 18: return &var_BIT_18; + case 19: return &var_BIT_19; + case 20: return &var_BIT_20; + case 21: return &var_BIT_21; + case 22: return &var_BIT_22; + case 23: return &var_BIT_23; + case 24: return &var_BIT_24; + case 25: return &var_BIT_25; + case 26: return &var_BIT_26; + case 27: return &var_BIT_27; + case 28: return &var_BIT_28; + case 29: return &var_BIT_29; + case 30: return &var_BIT_30; + case 31: return &var_BIT_31; + case 32: return &var_BIT_32; + case 33: return &var_BIT_33; + case 34: return &var_BIT_34; + case 35: return &var_BIT_35; + case 36: return &var_BIT_36; + case 37: return &var_BIT_37; + case 38: return &var_BIT_38; + case 39: return &var_BIT_39; + case 40: return &var_BIT_40; + case 41: return &var_BIT_41; + case 42: return &var_BIT_42; + case 43: return &var_BIT_43; + case 44: return &var_BIT_44; + case 45: return &var_BIT_45; + case 46: return &var_BIT_46; + case 47: return &var_BIT_47; + case 48: return &var_BIT_48; + case 49: return &var_BIT_49; + case 50: return &var_BIT_50; + case 51: return &var_BIT_51; + case 52: return &var_BIT_52; + case 53: return &var_BIT_53; + case 54: return &var_BIT_54; + case 55: return &var_BIT_55; + case 56: return &var_BIT_56; + case 57: return &var_BIT_57; + case 58: return &var_BIT_58; + case 59: return &var_BIT_59; + case 60: return &var_BIT_60; + case 61: return &var_BIT_61; + case 62: return &var_BIT_62; + case 63: return &var_BIT_63; + } + return nullptr; +} + +CIEC_ANY *FORTE_ASSEMBLE_LWORD_FROM_BOOLS::getDO(const size_t paIndex) { + switch(paIndex) { + case 0: return &var_; + } + return nullptr; +} + +CEventConnection *FORTE_ASSEMBLE_LWORD_FROM_BOOLS::getEOConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_CNF; + } + return nullptr; +} + +CDataConnection **FORTE_ASSEMBLE_LWORD_FROM_BOOLS::getDIConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_BIT_00; + case 1: return &conn_BIT_01; + case 2: return &conn_BIT_02; + case 3: return &conn_BIT_03; + case 4: return &conn_BIT_04; + case 5: return &conn_BIT_05; + case 6: return &conn_BIT_06; + case 7: return &conn_BIT_07; + case 8: return &conn_BIT_08; + case 9: return &conn_BIT_09; + case 10: return &conn_BIT_10; + case 11: return &conn_BIT_11; + case 12: return &conn_BIT_12; + case 13: return &conn_BIT_13; + case 14: return &conn_BIT_14; + case 15: return &conn_BIT_15; + case 16: return &conn_BIT_16; + case 17: return &conn_BIT_17; + case 18: return &conn_BIT_18; + case 19: return &conn_BIT_19; + case 20: return &conn_BIT_20; + case 21: return &conn_BIT_21; + case 22: return &conn_BIT_22; + case 23: return &conn_BIT_23; + case 24: return &conn_BIT_24; + case 25: return &conn_BIT_25; + case 26: return &conn_BIT_26; + case 27: return &conn_BIT_27; + case 28: return &conn_BIT_28; + case 29: return &conn_BIT_29; + case 30: return &conn_BIT_30; + case 31: return &conn_BIT_31; + case 32: return &conn_BIT_32; + case 33: return &conn_BIT_33; + case 34: return &conn_BIT_34; + case 35: return &conn_BIT_35; + case 36: return &conn_BIT_36; + case 37: return &conn_BIT_37; + case 38: return &conn_BIT_38; + case 39: return &conn_BIT_39; + case 40: return &conn_BIT_40; + case 41: return &conn_BIT_41; + case 42: return &conn_BIT_42; + case 43: return &conn_BIT_43; + case 44: return &conn_BIT_44; + case 45: return &conn_BIT_45; + case 46: return &conn_BIT_46; + case 47: return &conn_BIT_47; + case 48: return &conn_BIT_48; + case 49: return &conn_BIT_49; + case 50: return &conn_BIT_50; + case 51: return &conn_BIT_51; + case 52: return &conn_BIT_52; + case 53: return &conn_BIT_53; + case 54: return &conn_BIT_54; + case 55: return &conn_BIT_55; + case 56: return &conn_BIT_56; + case 57: return &conn_BIT_57; + case 58: return &conn_BIT_58; + case 59: return &conn_BIT_59; + case 60: return &conn_BIT_60; + case 61: return &conn_BIT_61; + case 62: return &conn_BIT_62; + case 63: return &conn_BIT_63; + } + return nullptr; +} + +CDataConnection *FORTE_ASSEMBLE_LWORD_FROM_BOOLS::getDOConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_; + } + return nullptr; +} + +void FORTE_ASSEMBLE_LWORD_FROM_BOOLS::executeEvent(const TEventID, CEventChainExecutionThread *const paECET) { + var_ = func_ASSEMBLE_LWORD_FROM_BOOLS(var_BIT_00, var_BIT_01, var_BIT_02, var_BIT_03, var_BIT_04, var_BIT_05, var_BIT_06, var_BIT_07, var_BIT_08, var_BIT_09, var_BIT_10, var_BIT_11, var_BIT_12, var_BIT_13, var_BIT_14, var_BIT_15, var_BIT_16, var_BIT_17, var_BIT_18, var_BIT_19, var_BIT_20, var_BIT_21, var_BIT_22, var_BIT_23, var_BIT_24, var_BIT_25, var_BIT_26, var_BIT_27, var_BIT_28, var_BIT_29, var_BIT_30, var_BIT_31, var_BIT_32, var_BIT_33, var_BIT_34, var_BIT_35, var_BIT_36, var_BIT_37, var_BIT_38, var_BIT_39, var_BIT_40, var_BIT_41, var_BIT_42, var_BIT_43, var_BIT_44, var_BIT_45, var_BIT_46, var_BIT_47, var_BIT_48, var_BIT_49, var_BIT_50, var_BIT_51, var_BIT_52, var_BIT_53, var_BIT_54, var_BIT_55, var_BIT_56, var_BIT_57, var_BIT_58, var_BIT_59, var_BIT_60, var_BIT_61, var_BIT_62, var_BIT_63); + sendOutputEvent(scmEventCNFID, paECET); +} + +CIEC_LWORD func_ASSEMBLE_LWORD_FROM_BOOLS(CIEC_BOOL st_lv_BIT_00, CIEC_BOOL st_lv_BIT_01, CIEC_BOOL st_lv_BIT_02, CIEC_BOOL st_lv_BIT_03, CIEC_BOOL st_lv_BIT_04, CIEC_BOOL st_lv_BIT_05, CIEC_BOOL st_lv_BIT_06, CIEC_BOOL st_lv_BIT_07, CIEC_BOOL st_lv_BIT_08, CIEC_BOOL st_lv_BIT_09, CIEC_BOOL st_lv_BIT_10, CIEC_BOOL st_lv_BIT_11, CIEC_BOOL st_lv_BIT_12, CIEC_BOOL st_lv_BIT_13, CIEC_BOOL st_lv_BIT_14, CIEC_BOOL st_lv_BIT_15, CIEC_BOOL st_lv_BIT_16, CIEC_BOOL st_lv_BIT_17, CIEC_BOOL st_lv_BIT_18, CIEC_BOOL st_lv_BIT_19, CIEC_BOOL st_lv_BIT_20, CIEC_BOOL st_lv_BIT_21, CIEC_BOOL st_lv_BIT_22, CIEC_BOOL st_lv_BIT_23, CIEC_BOOL st_lv_BIT_24, CIEC_BOOL st_lv_BIT_25, CIEC_BOOL st_lv_BIT_26, CIEC_BOOL st_lv_BIT_27, CIEC_BOOL st_lv_BIT_28, CIEC_BOOL st_lv_BIT_29, CIEC_BOOL st_lv_BIT_30, CIEC_BOOL st_lv_BIT_31, CIEC_BOOL st_lv_BIT_32, CIEC_BOOL st_lv_BIT_33, CIEC_BOOL st_lv_BIT_34, CIEC_BOOL st_lv_BIT_35, CIEC_BOOL st_lv_BIT_36, CIEC_BOOL st_lv_BIT_37, CIEC_BOOL st_lv_BIT_38, CIEC_BOOL st_lv_BIT_39, CIEC_BOOL st_lv_BIT_40, CIEC_BOOL st_lv_BIT_41, CIEC_BOOL st_lv_BIT_42, CIEC_BOOL st_lv_BIT_43, CIEC_BOOL st_lv_BIT_44, CIEC_BOOL st_lv_BIT_45, CIEC_BOOL st_lv_BIT_46, CIEC_BOOL st_lv_BIT_47, CIEC_BOOL st_lv_BIT_48, CIEC_BOOL st_lv_BIT_49, CIEC_BOOL st_lv_BIT_50, CIEC_BOOL st_lv_BIT_51, CIEC_BOOL st_lv_BIT_52, CIEC_BOOL st_lv_BIT_53, CIEC_BOOL st_lv_BIT_54, CIEC_BOOL st_lv_BIT_55, CIEC_BOOL st_lv_BIT_56, CIEC_BOOL st_lv_BIT_57, CIEC_BOOL st_lv_BIT_58, CIEC_BOOL st_lv_BIT_59, CIEC_BOOL st_lv_BIT_60, CIEC_BOOL st_lv_BIT_61, CIEC_BOOL st_lv_BIT_62, CIEC_BOOL st_lv_BIT_63) { + CIEC_LWORD st_ret_val = 0_LWORD; + + #line 71 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(0) = st_lv_BIT_00; + #line 72 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(1) = st_lv_BIT_01; + #line 73 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(2) = st_lv_BIT_02; + #line 74 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(3) = st_lv_BIT_03; + #line 75 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(4) = st_lv_BIT_04; + #line 76 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(5) = st_lv_BIT_05; + #line 77 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(6) = st_lv_BIT_06; + #line 78 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(7) = st_lv_BIT_07; + #line 79 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(8) = st_lv_BIT_08; + #line 80 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(9) = st_lv_BIT_09; + #line 81 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(10) = st_lv_BIT_10; + #line 82 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(11) = st_lv_BIT_11; + #line 83 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(12) = st_lv_BIT_12; + #line 84 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(13) = st_lv_BIT_13; + #line 85 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(14) = st_lv_BIT_14; + #line 86 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(15) = st_lv_BIT_15; + #line 87 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(16) = st_lv_BIT_16; + #line 88 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(17) = st_lv_BIT_17; + #line 89 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(18) = st_lv_BIT_18; + #line 90 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(19) = st_lv_BIT_19; + #line 91 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(20) = st_lv_BIT_20; + #line 92 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(21) = st_lv_BIT_21; + #line 93 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(22) = st_lv_BIT_22; + #line 94 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(23) = st_lv_BIT_23; + #line 95 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(24) = st_lv_BIT_24; + #line 96 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(25) = st_lv_BIT_25; + #line 97 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(26) = st_lv_BIT_26; + #line 98 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(27) = st_lv_BIT_27; + #line 99 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(28) = st_lv_BIT_28; + #line 100 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(29) = st_lv_BIT_29; + #line 101 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(30) = st_lv_BIT_30; + #line 102 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(31) = st_lv_BIT_31; + #line 103 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(32) = st_lv_BIT_32; + #line 104 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(33) = st_lv_BIT_33; + #line 105 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(34) = st_lv_BIT_34; + #line 106 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(35) = st_lv_BIT_35; + #line 107 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(36) = st_lv_BIT_36; + #line 108 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(37) = st_lv_BIT_37; + #line 109 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(38) = st_lv_BIT_38; + #line 110 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(39) = st_lv_BIT_39; + #line 111 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(40) = st_lv_BIT_40; + #line 112 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(41) = st_lv_BIT_41; + #line 113 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(42) = st_lv_BIT_42; + #line 114 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(43) = st_lv_BIT_43; + #line 115 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(44) = st_lv_BIT_44; + #line 116 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(45) = st_lv_BIT_45; + #line 117 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(46) = st_lv_BIT_46; + #line 118 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(47) = st_lv_BIT_47; + #line 119 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(48) = st_lv_BIT_48; + #line 120 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(49) = st_lv_BIT_49; + #line 121 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(50) = st_lv_BIT_50; + #line 122 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(51) = st_lv_BIT_51; + #line 123 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(52) = st_lv_BIT_52; + #line 124 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(53) = st_lv_BIT_53; + #line 125 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(54) = st_lv_BIT_54; + #line 126 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(55) = st_lv_BIT_55; + #line 127 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(56) = st_lv_BIT_56; + #line 128 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(57) = st_lv_BIT_57; + #line 129 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(58) = st_lv_BIT_58; + #line 130 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(59) = st_lv_BIT_59; + #line 131 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(60) = st_lv_BIT_60; + #line 132 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(61) = st_lv_BIT_61; + #line 133 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(62) = st_lv_BIT_62; + #line 134 "ASSEMBLE_LWORD_FROM_BOOLS.fct" + st_ret_val.partial(63) = st_lv_BIT_63; + + return st_ret_val; +} + diff --git a/src/modules/utils/assembling/ASSEMBLE_LWORD_FROM_BOOLS_fct.h b/src/modules/utils/assembling/ASSEMBLE_LWORD_FROM_BOOLS_fct.h new file mode 100644 index 000000000..c336bc2d5 --- /dev/null +++ b/src/modules/utils/assembling/ASSEMBLE_LWORD_FROM_BOOLS_fct.h @@ -0,0 +1,279 @@ +/************************************************************************* + *** Copyright (c) 2024 HR Agrartechnik GmbH + *** This program and the accompanying materials are made available under the + *** terms of the Eclipse Public License 2.0 which is available at + *** http://www.eclipse.org/legal/epl-2.0. + *** + *** SPDX-License-Identifier: EPL-2.0 + *** + *** FORTE Library Element + *** + *** This file was generated using the 4DIAC FORTE Export Filter V1.0.x NG! + *** + *** Name: ASSEMBLE_LWORD_FROM_BOOLS + *** Description: this Function combines the 64 BOOLS to a LWORD + *** Version: + *** 1.0: 2024-02-22/Franz Höpfinger - HR Agrartechnik - initial Implementation + *** 1.1: 2024-07-28/Moritz Ortmeier - HR Agrartechnik - rename Function and change Input/Output Variables + *************************************************************************/ + +#pragma once + +#include "funcbloc.h" +#include "forte_lword.h" +#include "forte_bool.h" +#include "iec61131_functions.h" +#include "forte_array_common.h" +#include "forte_array.h" +#include "forte_array_fixed.h" +#include "forte_array_variable.h" + +class FORTE_ASSEMBLE_LWORD_FROM_BOOLS final : public CFunctionBlock { + DECLARE_FIRMWARE_FB(FORTE_ASSEMBLE_LWORD_FROM_BOOLS) + + private: + static const CStringDictionary::TStringId scmDataInputNames[]; + static const CStringDictionary::TStringId scmDataInputTypeIds[]; + static const CStringDictionary::TStringId scmDataOutputNames[]; + static const CStringDictionary::TStringId scmDataOutputTypeIds[]; + static const TEventID scmEventREQID = 0; + static const TDataIOID scmEIWith[]; + static const TForteInt16 scmEIWithIndexes[]; + static const CStringDictionary::TStringId scmEventInputNames[]; + static const TEventID scmEventCNFID = 0; + static const TDataIOID scmEOWith[]; + static const TForteInt16 scmEOWithIndexes[]; + static const CStringDictionary::TStringId scmEventOutputNames[]; + + static const SFBInterfaceSpec scmFBInterfaceSpec; + + void executeEvent(TEventID paEIID, CEventChainExecutionThread *const paECET) override; + + void readInputData(TEventID paEIID) override; + void writeOutputData(TEventID paEIID) override; + void setInitialValues() override; + + public: + FORTE_ASSEMBLE_LWORD_FROM_BOOLS(CStringDictionary::TStringId paInstanceNameId, forte::core::CFBContainer &paContainer); + + CIEC_BOOL var_BIT_00; + CIEC_BOOL var_BIT_01; + CIEC_BOOL var_BIT_02; + CIEC_BOOL var_BIT_03; + CIEC_BOOL var_BIT_04; + CIEC_BOOL var_BIT_05; + CIEC_BOOL var_BIT_06; + CIEC_BOOL var_BIT_07; + CIEC_BOOL var_BIT_08; + CIEC_BOOL var_BIT_09; + CIEC_BOOL var_BIT_10; + CIEC_BOOL var_BIT_11; + CIEC_BOOL var_BIT_12; + CIEC_BOOL var_BIT_13; + CIEC_BOOL var_BIT_14; + CIEC_BOOL var_BIT_15; + CIEC_BOOL var_BIT_16; + CIEC_BOOL var_BIT_17; + CIEC_BOOL var_BIT_18; + CIEC_BOOL var_BIT_19; + CIEC_BOOL var_BIT_20; + CIEC_BOOL var_BIT_21; + CIEC_BOOL var_BIT_22; + CIEC_BOOL var_BIT_23; + CIEC_BOOL var_BIT_24; + CIEC_BOOL var_BIT_25; + CIEC_BOOL var_BIT_26; + CIEC_BOOL var_BIT_27; + CIEC_BOOL var_BIT_28; + CIEC_BOOL var_BIT_29; + CIEC_BOOL var_BIT_30; + CIEC_BOOL var_BIT_31; + CIEC_BOOL var_BIT_32; + CIEC_BOOL var_BIT_33; + CIEC_BOOL var_BIT_34; + CIEC_BOOL var_BIT_35; + CIEC_BOOL var_BIT_36; + CIEC_BOOL var_BIT_37; + CIEC_BOOL var_BIT_38; + CIEC_BOOL var_BIT_39; + CIEC_BOOL var_BIT_40; + CIEC_BOOL var_BIT_41; + CIEC_BOOL var_BIT_42; + CIEC_BOOL var_BIT_43; + CIEC_BOOL var_BIT_44; + CIEC_BOOL var_BIT_45; + CIEC_BOOL var_BIT_46; + CIEC_BOOL var_BIT_47; + CIEC_BOOL var_BIT_48; + CIEC_BOOL var_BIT_49; + CIEC_BOOL var_BIT_50; + CIEC_BOOL var_BIT_51; + CIEC_BOOL var_BIT_52; + CIEC_BOOL var_BIT_53; + CIEC_BOOL var_BIT_54; + CIEC_BOOL var_BIT_55; + CIEC_BOOL var_BIT_56; + CIEC_BOOL var_BIT_57; + CIEC_BOOL var_BIT_58; + CIEC_BOOL var_BIT_59; + CIEC_BOOL var_BIT_60; + CIEC_BOOL var_BIT_61; + CIEC_BOOL var_BIT_62; + CIEC_BOOL var_BIT_63; + + CIEC_LWORD var_; + + CIEC_LWORD var_conn_; + + CEventConnection conn_CNF; + + CDataConnection *conn_BIT_00; + CDataConnection *conn_BIT_01; + CDataConnection *conn_BIT_02; + CDataConnection *conn_BIT_03; + CDataConnection *conn_BIT_04; + CDataConnection *conn_BIT_05; + CDataConnection *conn_BIT_06; + CDataConnection *conn_BIT_07; + CDataConnection *conn_BIT_08; + CDataConnection *conn_BIT_09; + CDataConnection *conn_BIT_10; + CDataConnection *conn_BIT_11; + CDataConnection *conn_BIT_12; + CDataConnection *conn_BIT_13; + CDataConnection *conn_BIT_14; + CDataConnection *conn_BIT_15; + CDataConnection *conn_BIT_16; + CDataConnection *conn_BIT_17; + CDataConnection *conn_BIT_18; + CDataConnection *conn_BIT_19; + CDataConnection *conn_BIT_20; + CDataConnection *conn_BIT_21; + CDataConnection *conn_BIT_22; + CDataConnection *conn_BIT_23; + CDataConnection *conn_BIT_24; + CDataConnection *conn_BIT_25; + CDataConnection *conn_BIT_26; + CDataConnection *conn_BIT_27; + CDataConnection *conn_BIT_28; + CDataConnection *conn_BIT_29; + CDataConnection *conn_BIT_30; + CDataConnection *conn_BIT_31; + CDataConnection *conn_BIT_32; + CDataConnection *conn_BIT_33; + CDataConnection *conn_BIT_34; + CDataConnection *conn_BIT_35; + CDataConnection *conn_BIT_36; + CDataConnection *conn_BIT_37; + CDataConnection *conn_BIT_38; + CDataConnection *conn_BIT_39; + CDataConnection *conn_BIT_40; + CDataConnection *conn_BIT_41; + CDataConnection *conn_BIT_42; + CDataConnection *conn_BIT_43; + CDataConnection *conn_BIT_44; + CDataConnection *conn_BIT_45; + CDataConnection *conn_BIT_46; + CDataConnection *conn_BIT_47; + CDataConnection *conn_BIT_48; + CDataConnection *conn_BIT_49; + CDataConnection *conn_BIT_50; + CDataConnection *conn_BIT_51; + CDataConnection *conn_BIT_52; + CDataConnection *conn_BIT_53; + CDataConnection *conn_BIT_54; + CDataConnection *conn_BIT_55; + CDataConnection *conn_BIT_56; + CDataConnection *conn_BIT_57; + CDataConnection *conn_BIT_58; + CDataConnection *conn_BIT_59; + CDataConnection *conn_BIT_60; + CDataConnection *conn_BIT_61; + CDataConnection *conn_BIT_62; + CDataConnection *conn_BIT_63; + + CDataConnection conn_; + + CIEC_ANY *getDI(size_t) override; + CIEC_ANY *getDO(size_t) override; + CEventConnection *getEOConUnchecked(TPortId) override; + CDataConnection **getDIConUnchecked(TPortId) override; + CDataConnection *getDOConUnchecked(TPortId) override; + + void evt_REQ(const CIEC_BOOL &paBIT_00, const CIEC_BOOL &paBIT_01, const CIEC_BOOL &paBIT_02, const CIEC_BOOL &paBIT_03, const CIEC_BOOL &paBIT_04, const CIEC_BOOL &paBIT_05, const CIEC_BOOL &paBIT_06, const CIEC_BOOL &paBIT_07, const CIEC_BOOL &paBIT_08, const CIEC_BOOL &paBIT_09, const CIEC_BOOL &paBIT_10, const CIEC_BOOL &paBIT_11, const CIEC_BOOL &paBIT_12, const CIEC_BOOL &paBIT_13, const CIEC_BOOL &paBIT_14, const CIEC_BOOL &paBIT_15, const CIEC_BOOL &paBIT_16, const CIEC_BOOL &paBIT_17, const CIEC_BOOL &paBIT_18, const CIEC_BOOL &paBIT_19, const CIEC_BOOL &paBIT_20, const CIEC_BOOL &paBIT_21, const CIEC_BOOL &paBIT_22, const CIEC_BOOL &paBIT_23, const CIEC_BOOL &paBIT_24, const CIEC_BOOL &paBIT_25, const CIEC_BOOL &paBIT_26, const CIEC_BOOL &paBIT_27, const CIEC_BOOL &paBIT_28, const CIEC_BOOL &paBIT_29, const CIEC_BOOL &paBIT_30, const CIEC_BOOL &paBIT_31, const CIEC_BOOL &paBIT_32, const CIEC_BOOL &paBIT_33, const CIEC_BOOL &paBIT_34, const CIEC_BOOL &paBIT_35, const CIEC_BOOL &paBIT_36, const CIEC_BOOL &paBIT_37, const CIEC_BOOL &paBIT_38, const CIEC_BOOL &paBIT_39, const CIEC_BOOL &paBIT_40, const CIEC_BOOL &paBIT_41, const CIEC_BOOL &paBIT_42, const CIEC_BOOL &paBIT_43, const CIEC_BOOL &paBIT_44, const CIEC_BOOL &paBIT_45, const CIEC_BOOL &paBIT_46, const CIEC_BOOL &paBIT_47, const CIEC_BOOL &paBIT_48, const CIEC_BOOL &paBIT_49, const CIEC_BOOL &paBIT_50, const CIEC_BOOL &paBIT_51, const CIEC_BOOL &paBIT_52, const CIEC_BOOL &paBIT_53, const CIEC_BOOL &paBIT_54, const CIEC_BOOL &paBIT_55, const CIEC_BOOL &paBIT_56, const CIEC_BOOL &paBIT_57, const CIEC_BOOL &paBIT_58, const CIEC_BOOL &paBIT_59, const CIEC_BOOL &paBIT_60, const CIEC_BOOL &paBIT_61, const CIEC_BOOL &paBIT_62, const CIEC_BOOL &paBIT_63, CIEC_LWORD &pa) { + var_BIT_00 = paBIT_00; + var_BIT_01 = paBIT_01; + var_BIT_02 = paBIT_02; + var_BIT_03 = paBIT_03; + var_BIT_04 = paBIT_04; + var_BIT_05 = paBIT_05; + var_BIT_06 = paBIT_06; + var_BIT_07 = paBIT_07; + var_BIT_08 = paBIT_08; + var_BIT_09 = paBIT_09; + var_BIT_10 = paBIT_10; + var_BIT_11 = paBIT_11; + var_BIT_12 = paBIT_12; + var_BIT_13 = paBIT_13; + var_BIT_14 = paBIT_14; + var_BIT_15 = paBIT_15; + var_BIT_16 = paBIT_16; + var_BIT_17 = paBIT_17; + var_BIT_18 = paBIT_18; + var_BIT_19 = paBIT_19; + var_BIT_20 = paBIT_20; + var_BIT_21 = paBIT_21; + var_BIT_22 = paBIT_22; + var_BIT_23 = paBIT_23; + var_BIT_24 = paBIT_24; + var_BIT_25 = paBIT_25; + var_BIT_26 = paBIT_26; + var_BIT_27 = paBIT_27; + var_BIT_28 = paBIT_28; + var_BIT_29 = paBIT_29; + var_BIT_30 = paBIT_30; + var_BIT_31 = paBIT_31; + var_BIT_32 = paBIT_32; + var_BIT_33 = paBIT_33; + var_BIT_34 = paBIT_34; + var_BIT_35 = paBIT_35; + var_BIT_36 = paBIT_36; + var_BIT_37 = paBIT_37; + var_BIT_38 = paBIT_38; + var_BIT_39 = paBIT_39; + var_BIT_40 = paBIT_40; + var_BIT_41 = paBIT_41; + var_BIT_42 = paBIT_42; + var_BIT_43 = paBIT_43; + var_BIT_44 = paBIT_44; + var_BIT_45 = paBIT_45; + var_BIT_46 = paBIT_46; + var_BIT_47 = paBIT_47; + var_BIT_48 = paBIT_48; + var_BIT_49 = paBIT_49; + var_BIT_50 = paBIT_50; + var_BIT_51 = paBIT_51; + var_BIT_52 = paBIT_52; + var_BIT_53 = paBIT_53; + var_BIT_54 = paBIT_54; + var_BIT_55 = paBIT_55; + var_BIT_56 = paBIT_56; + var_BIT_57 = paBIT_57; + var_BIT_58 = paBIT_58; + var_BIT_59 = paBIT_59; + var_BIT_60 = paBIT_60; + var_BIT_61 = paBIT_61; + var_BIT_62 = paBIT_62; + var_BIT_63 = paBIT_63; + executeEvent(scmEventREQID, nullptr); + pa = var_; + } + + void operator()(const CIEC_BOOL &paBIT_00, const CIEC_BOOL &paBIT_01, const CIEC_BOOL &paBIT_02, const CIEC_BOOL &paBIT_03, const CIEC_BOOL &paBIT_04, const CIEC_BOOL &paBIT_05, const CIEC_BOOL &paBIT_06, const CIEC_BOOL &paBIT_07, const CIEC_BOOL &paBIT_08, const CIEC_BOOL &paBIT_09, const CIEC_BOOL &paBIT_10, const CIEC_BOOL &paBIT_11, const CIEC_BOOL &paBIT_12, const CIEC_BOOL &paBIT_13, const CIEC_BOOL &paBIT_14, const CIEC_BOOL &paBIT_15, const CIEC_BOOL &paBIT_16, const CIEC_BOOL &paBIT_17, const CIEC_BOOL &paBIT_18, const CIEC_BOOL &paBIT_19, const CIEC_BOOL &paBIT_20, const CIEC_BOOL &paBIT_21, const CIEC_BOOL &paBIT_22, const CIEC_BOOL &paBIT_23, const CIEC_BOOL &paBIT_24, const CIEC_BOOL &paBIT_25, const CIEC_BOOL &paBIT_26, const CIEC_BOOL &paBIT_27, const CIEC_BOOL &paBIT_28, const CIEC_BOOL &paBIT_29, const CIEC_BOOL &paBIT_30, const CIEC_BOOL &paBIT_31, const CIEC_BOOL &paBIT_32, const CIEC_BOOL &paBIT_33, const CIEC_BOOL &paBIT_34, const CIEC_BOOL &paBIT_35, const CIEC_BOOL &paBIT_36, const CIEC_BOOL &paBIT_37, const CIEC_BOOL &paBIT_38, const CIEC_BOOL &paBIT_39, const CIEC_BOOL &paBIT_40, const CIEC_BOOL &paBIT_41, const CIEC_BOOL &paBIT_42, const CIEC_BOOL &paBIT_43, const CIEC_BOOL &paBIT_44, const CIEC_BOOL &paBIT_45, const CIEC_BOOL &paBIT_46, const CIEC_BOOL &paBIT_47, const CIEC_BOOL &paBIT_48, const CIEC_BOOL &paBIT_49, const CIEC_BOOL &paBIT_50, const CIEC_BOOL &paBIT_51, const CIEC_BOOL &paBIT_52, const CIEC_BOOL &paBIT_53, const CIEC_BOOL &paBIT_54, const CIEC_BOOL &paBIT_55, const CIEC_BOOL &paBIT_56, const CIEC_BOOL &paBIT_57, const CIEC_BOOL &paBIT_58, const CIEC_BOOL &paBIT_59, const CIEC_BOOL &paBIT_60, const CIEC_BOOL &paBIT_61, const CIEC_BOOL &paBIT_62, const CIEC_BOOL &paBIT_63, CIEC_LWORD &pa) { + evt_REQ(paBIT_00, paBIT_01, paBIT_02, paBIT_03, paBIT_04, paBIT_05, paBIT_06, paBIT_07, paBIT_08, paBIT_09, paBIT_10, paBIT_11, paBIT_12, paBIT_13, paBIT_14, paBIT_15, paBIT_16, paBIT_17, paBIT_18, paBIT_19, paBIT_20, paBIT_21, paBIT_22, paBIT_23, paBIT_24, paBIT_25, paBIT_26, paBIT_27, paBIT_28, paBIT_29, paBIT_30, paBIT_31, paBIT_32, paBIT_33, paBIT_34, paBIT_35, paBIT_36, paBIT_37, paBIT_38, paBIT_39, paBIT_40, paBIT_41, paBIT_42, paBIT_43, paBIT_44, paBIT_45, paBIT_46, paBIT_47, paBIT_48, paBIT_49, paBIT_50, paBIT_51, paBIT_52, paBIT_53, paBIT_54, paBIT_55, paBIT_56, paBIT_57, paBIT_58, paBIT_59, paBIT_60, paBIT_61, paBIT_62, paBIT_63, pa); + } +}; + +CIEC_LWORD func_ASSEMBLE_LWORD_FROM_BOOLS(CIEC_BOOL st_lv_BIT_00, CIEC_BOOL st_lv_BIT_01, CIEC_BOOL st_lv_BIT_02, CIEC_BOOL st_lv_BIT_03, CIEC_BOOL st_lv_BIT_04, CIEC_BOOL st_lv_BIT_05, CIEC_BOOL st_lv_BIT_06, CIEC_BOOL st_lv_BIT_07, CIEC_BOOL st_lv_BIT_08, CIEC_BOOL st_lv_BIT_09, CIEC_BOOL st_lv_BIT_10, CIEC_BOOL st_lv_BIT_11, CIEC_BOOL st_lv_BIT_12, CIEC_BOOL st_lv_BIT_13, CIEC_BOOL st_lv_BIT_14, CIEC_BOOL st_lv_BIT_15, CIEC_BOOL st_lv_BIT_16, CIEC_BOOL st_lv_BIT_17, CIEC_BOOL st_lv_BIT_18, CIEC_BOOL st_lv_BIT_19, CIEC_BOOL st_lv_BIT_20, CIEC_BOOL st_lv_BIT_21, CIEC_BOOL st_lv_BIT_22, CIEC_BOOL st_lv_BIT_23, CIEC_BOOL st_lv_BIT_24, CIEC_BOOL st_lv_BIT_25, CIEC_BOOL st_lv_BIT_26, CIEC_BOOL st_lv_BIT_27, CIEC_BOOL st_lv_BIT_28, CIEC_BOOL st_lv_BIT_29, CIEC_BOOL st_lv_BIT_30, CIEC_BOOL st_lv_BIT_31, CIEC_BOOL st_lv_BIT_32, CIEC_BOOL st_lv_BIT_33, CIEC_BOOL st_lv_BIT_34, CIEC_BOOL st_lv_BIT_35, CIEC_BOOL st_lv_BIT_36, CIEC_BOOL st_lv_BIT_37, CIEC_BOOL st_lv_BIT_38, CIEC_BOOL st_lv_BIT_39, CIEC_BOOL st_lv_BIT_40, CIEC_BOOL st_lv_BIT_41, CIEC_BOOL st_lv_BIT_42, CIEC_BOOL st_lv_BIT_43, CIEC_BOOL st_lv_BIT_44, CIEC_BOOL st_lv_BIT_45, CIEC_BOOL st_lv_BIT_46, CIEC_BOOL st_lv_BIT_47, CIEC_BOOL st_lv_BIT_48, CIEC_BOOL st_lv_BIT_49, CIEC_BOOL st_lv_BIT_50, CIEC_BOOL st_lv_BIT_51, CIEC_BOOL st_lv_BIT_52, CIEC_BOOL st_lv_BIT_53, CIEC_BOOL st_lv_BIT_54, CIEC_BOOL st_lv_BIT_55, CIEC_BOOL st_lv_BIT_56, CIEC_BOOL st_lv_BIT_57, CIEC_BOOL st_lv_BIT_58, CIEC_BOOL st_lv_BIT_59, CIEC_BOOL st_lv_BIT_60, CIEC_BOOL st_lv_BIT_61, CIEC_BOOL st_lv_BIT_62, CIEC_BOOL st_lv_BIT_63); + + diff --git a/src/modules/utils/assembling/ASSEMBLE_WORD_FROM_BOOLS_fct.cpp b/src/modules/utils/assembling/ASSEMBLE_WORD_FROM_BOOLS_fct.cpp new file mode 100644 index 000000000..29ce103f7 --- /dev/null +++ b/src/modules/utils/assembling/ASSEMBLE_WORD_FROM_BOOLS_fct.cpp @@ -0,0 +1,245 @@ +/************************************************************************* + *** Copyright (c) 2024 HR Agrartechnik GmbH + *** This program and the accompanying materials are made available under the + *** terms of the Eclipse Public License 2.0 which is available at + *** http://www.eclipse.org/legal/epl-2.0. + *** + *** SPDX-License-Identifier: EPL-2.0 + *** + *** FORTE Library Element + *** + *** This file was generated using the 4DIAC FORTE Export Filter V1.0.x NG! + *** + *** Name: ASSEMBLE_WORD_FROM_BOOLS + *** Description: this Function combines the 16 BOOLS to a WORD + *** Version: + *** 1.0: 2024-02-22/Franz Höpfinger - HR Agrartechnik - initial Implementation + *** 1.1: 2024-07-28/Moritz Ortmeier - HR Agrartechnik - rename Function and change Input/Output Variables + *************************************************************************/ + +#include "ASSEMBLE_WORD_FROM_BOOLS_fct.h" +#ifdef FORTE_ENABLE_GENERATED_SOURCE_CPP +#include "ASSEMBLE_WORD_FROM_BOOLS_fct_gen.cpp" +#endif + +#include "criticalregion.h" +#include "resource.h" +#include "forte_bool.h" +#include "forte_word.h" +#include "iec61131_functions.h" +#include "forte_array_common.h" +#include "forte_array.h" +#include "forte_array_fixed.h" +#include "forte_array_variable.h" +#include "ASSEMBLE_WORD_FROM_BOOLS_fct.h" + +DEFINE_FIRMWARE_FB(FORTE_ASSEMBLE_WORD_FROM_BOOLS, g_nStringIdASSEMBLE_WORD_FROM_BOOLS) + +const CStringDictionary::TStringId FORTE_ASSEMBLE_WORD_FROM_BOOLS::scmDataInputNames[] = {g_nStringIdBIT_00, g_nStringIdBIT_01, g_nStringIdBIT_02, g_nStringIdBIT_03, g_nStringIdBIT_04, g_nStringIdBIT_05, g_nStringIdBIT_06, g_nStringIdBIT_07, g_nStringIdBIT_08, g_nStringIdBIT_09, g_nStringIdBIT_10, g_nStringIdBIT_11, g_nStringIdBIT_12, g_nStringIdBIT_13, g_nStringIdBIT_14, g_nStringIdBIT_15}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_WORD_FROM_BOOLS::scmDataInputTypeIds[] = {g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL, g_nStringIdBOOL}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_WORD_FROM_BOOLS::scmDataOutputNames[] = {g_nStringId}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_WORD_FROM_BOOLS::scmDataOutputTypeIds[] = {g_nStringIdWORD}; +const TDataIOID FORTE_ASSEMBLE_WORD_FROM_BOOLS::scmEIWith[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, scmWithListDelimiter}; +const TForteInt16 FORTE_ASSEMBLE_WORD_FROM_BOOLS::scmEIWithIndexes[] = {0}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_WORD_FROM_BOOLS::scmEventInputNames[] = {g_nStringIdREQ}; +const TDataIOID FORTE_ASSEMBLE_WORD_FROM_BOOLS::scmEOWith[] = {0, scmWithListDelimiter}; +const TForteInt16 FORTE_ASSEMBLE_WORD_FROM_BOOLS::scmEOWithIndexes[] = {0}; +const CStringDictionary::TStringId FORTE_ASSEMBLE_WORD_FROM_BOOLS::scmEventOutputNames[] = {g_nStringIdCNF}; +const SFBInterfaceSpec FORTE_ASSEMBLE_WORD_FROM_BOOLS::scmFBInterfaceSpec = { + 1, scmEventInputNames, scmEIWith, scmEIWithIndexes, + 1, scmEventOutputNames, scmEOWith, scmEOWithIndexes, + 16, scmDataInputNames, scmDataInputTypeIds, + 1, scmDataOutputNames, scmDataOutputTypeIds, + 0, nullptr, + 0, nullptr +}; + +FORTE_ASSEMBLE_WORD_FROM_BOOLS::FORTE_ASSEMBLE_WORD_FROM_BOOLS(const CStringDictionary::TStringId paInstanceNameId, forte::core::CFBContainer &paContainer) : + CFunctionBlock(paContainer, scmFBInterfaceSpec, paInstanceNameId), + var_conn_(var_), + conn_CNF(this, 0), + conn_BIT_00(nullptr), + conn_BIT_01(nullptr), + conn_BIT_02(nullptr), + conn_BIT_03(nullptr), + conn_BIT_04(nullptr), + conn_BIT_05(nullptr), + conn_BIT_06(nullptr), + conn_BIT_07(nullptr), + conn_BIT_08(nullptr), + conn_BIT_09(nullptr), + conn_BIT_10(nullptr), + conn_BIT_11(nullptr), + conn_BIT_12(nullptr), + conn_BIT_13(nullptr), + conn_BIT_14(nullptr), + conn_BIT_15(nullptr), + conn_(this, 0, &var_conn_) { +} + +void FORTE_ASSEMBLE_WORD_FROM_BOOLS::setInitialValues() { + var_BIT_00 = 0_BOOL; + var_BIT_01 = 0_BOOL; + var_BIT_02 = 0_BOOL; + var_BIT_03 = 0_BOOL; + var_BIT_04 = 0_BOOL; + var_BIT_05 = 0_BOOL; + var_BIT_06 = 0_BOOL; + var_BIT_07 = 0_BOOL; + var_BIT_08 = 0_BOOL; + var_BIT_09 = 0_BOOL; + var_BIT_10 = 0_BOOL; + var_BIT_11 = 0_BOOL; + var_BIT_12 = 0_BOOL; + var_BIT_13 = 0_BOOL; + var_BIT_14 = 0_BOOL; + var_BIT_15 = 0_BOOL; + var_ = 0_WORD; +} + +void FORTE_ASSEMBLE_WORD_FROM_BOOLS::readInputData(const TEventID paEIID) { + switch(paEIID) { + case scmEventREQID: { + readData(0, var_BIT_00, conn_BIT_00); + readData(1, var_BIT_01, conn_BIT_01); + readData(2, var_BIT_02, conn_BIT_02); + readData(3, var_BIT_03, conn_BIT_03); + readData(4, var_BIT_04, conn_BIT_04); + readData(5, var_BIT_05, conn_BIT_05); + readData(6, var_BIT_06, conn_BIT_06); + readData(7, var_BIT_07, conn_BIT_07); + readData(8, var_BIT_08, conn_BIT_08); + readData(9, var_BIT_09, conn_BIT_09); + readData(10, var_BIT_10, conn_BIT_10); + readData(11, var_BIT_11, conn_BIT_11); + readData(12, var_BIT_12, conn_BIT_12); + readData(13, var_BIT_13, conn_BIT_13); + readData(14, var_BIT_14, conn_BIT_14); + readData(15, var_BIT_15, conn_BIT_15); + break; + } + default: + break; + } +} + +void FORTE_ASSEMBLE_WORD_FROM_BOOLS::writeOutputData(const TEventID paEIID) { + switch(paEIID) { + case scmEventCNFID: { + writeData(0, var_, conn_); + break; + } + default: + break; + } +} + +CIEC_ANY *FORTE_ASSEMBLE_WORD_FROM_BOOLS::getDI(const size_t paIndex) { + switch(paIndex) { + case 0: return &var_BIT_00; + case 1: return &var_BIT_01; + case 2: return &var_BIT_02; + case 3: return &var_BIT_03; + case 4: return &var_BIT_04; + case 5: return &var_BIT_05; + case 6: return &var_BIT_06; + case 7: return &var_BIT_07; + case 8: return &var_BIT_08; + case 9: return &var_BIT_09; + case 10: return &var_BIT_10; + case 11: return &var_BIT_11; + case 12: return &var_BIT_12; + case 13: return &var_BIT_13; + case 14: return &var_BIT_14; + case 15: return &var_BIT_15; + } + return nullptr; +} + +CIEC_ANY *FORTE_ASSEMBLE_WORD_FROM_BOOLS::getDO(const size_t paIndex) { + switch(paIndex) { + case 0: return &var_; + } + return nullptr; +} + +CEventConnection *FORTE_ASSEMBLE_WORD_FROM_BOOLS::getEOConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_CNF; + } + return nullptr; +} + +CDataConnection **FORTE_ASSEMBLE_WORD_FROM_BOOLS::getDIConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_BIT_00; + case 1: return &conn_BIT_01; + case 2: return &conn_BIT_02; + case 3: return &conn_BIT_03; + case 4: return &conn_BIT_04; + case 5: return &conn_BIT_05; + case 6: return &conn_BIT_06; + case 7: return &conn_BIT_07; + case 8: return &conn_BIT_08; + case 9: return &conn_BIT_09; + case 10: return &conn_BIT_10; + case 11: return &conn_BIT_11; + case 12: return &conn_BIT_12; + case 13: return &conn_BIT_13; + case 14: return &conn_BIT_14; + case 15: return &conn_BIT_15; + } + return nullptr; +} + +CDataConnection *FORTE_ASSEMBLE_WORD_FROM_BOOLS::getDOConUnchecked(const TPortId paIndex) { + switch(paIndex) { + case 0: return &conn_; + } + return nullptr; +} + +void FORTE_ASSEMBLE_WORD_FROM_BOOLS::executeEvent(const TEventID, CEventChainExecutionThread *const paECET) { + var_ = func_ASSEMBLE_WORD_FROM_BOOLS(var_BIT_00, var_BIT_01, var_BIT_02, var_BIT_03, var_BIT_04, var_BIT_05, var_BIT_06, var_BIT_07, var_BIT_08, var_BIT_09, var_BIT_10, var_BIT_11, var_BIT_12, var_BIT_13, var_BIT_14, var_BIT_15); + sendOutputEvent(scmEventCNFID, paECET); +} + +CIEC_WORD func_ASSEMBLE_WORD_FROM_BOOLS(CIEC_BOOL st_lv_BIT_00, CIEC_BOOL st_lv_BIT_01, CIEC_BOOL st_lv_BIT_02, CIEC_BOOL st_lv_BIT_03, CIEC_BOOL st_lv_BIT_04, CIEC_BOOL st_lv_BIT_05, CIEC_BOOL st_lv_BIT_06, CIEC_BOOL st_lv_BIT_07, CIEC_BOOL st_lv_BIT_08, CIEC_BOOL st_lv_BIT_09, CIEC_BOOL st_lv_BIT_10, CIEC_BOOL st_lv_BIT_11, CIEC_BOOL st_lv_BIT_12, CIEC_BOOL st_lv_BIT_13, CIEC_BOOL st_lv_BIT_14, CIEC_BOOL st_lv_BIT_15) { + CIEC_WORD st_ret_val = 0_WORD; + + #line 23 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(0) = st_lv_BIT_00; + #line 24 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(1) = st_lv_BIT_01; + #line 25 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(2) = st_lv_BIT_02; + #line 26 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(3) = st_lv_BIT_03; + #line 27 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(4) = st_lv_BIT_04; + #line 28 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(5) = st_lv_BIT_05; + #line 29 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(6) = st_lv_BIT_06; + #line 30 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(7) = st_lv_BIT_07; + #line 31 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(8) = st_lv_BIT_08; + #line 32 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(9) = st_lv_BIT_09; + #line 33 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(10) = st_lv_BIT_10; + #line 34 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(11) = st_lv_BIT_11; + #line 35 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(12) = st_lv_BIT_12; + #line 36 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(13) = st_lv_BIT_13; + #line 37 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(14) = st_lv_BIT_14; + #line 38 "ASSEMBLE_WORD_FROM_BOOLS.fct" + st_ret_val.partial(15) = st_lv_BIT_15; + + return st_ret_val; +} + diff --git a/src/modules/utils/assembling/ASSEMBLE_WORD_FROM_BOOLS_fct.h b/src/modules/utils/assembling/ASSEMBLE_WORD_FROM_BOOLS_fct.h new file mode 100644 index 000000000..d1381f4c9 --- /dev/null +++ b/src/modules/utils/assembling/ASSEMBLE_WORD_FROM_BOOLS_fct.h @@ -0,0 +1,135 @@ +/************************************************************************* + *** Copyright (c) 2024 HR Agrartechnik GmbH + *** This program and the accompanying materials are made available under the + *** terms of the Eclipse Public License 2.0 which is available at + *** http://www.eclipse.org/legal/epl-2.0. + *** + *** SPDX-License-Identifier: EPL-2.0 + *** + *** FORTE Library Element + *** + *** This file was generated using the 4DIAC FORTE Export Filter V1.0.x NG! + *** + *** Name: ASSEMBLE_WORD_FROM_BOOLS + *** Description: this Function combines the 16 BOOLS to a WORD + *** Version: + *** 1.0: 2024-02-22/Franz Höpfinger - HR Agrartechnik - initial Implementation + *** 1.1: 2024-07-28/Moritz Ortmeier - HR Agrartechnik - rename Function and change Input/Output Variables + *************************************************************************/ + +#pragma once + +#include "funcbloc.h" +#include "forte_bool.h" +#include "forte_word.h" +#include "iec61131_functions.h" +#include "forte_array_common.h" +#include "forte_array.h" +#include "forte_array_fixed.h" +#include "forte_array_variable.h" + +class FORTE_ASSEMBLE_WORD_FROM_BOOLS final : public CFunctionBlock { + DECLARE_FIRMWARE_FB(FORTE_ASSEMBLE_WORD_FROM_BOOLS) + + private: + static const CStringDictionary::TStringId scmDataInputNames[]; + static const CStringDictionary::TStringId scmDataInputTypeIds[]; + static const CStringDictionary::TStringId scmDataOutputNames[]; + static const CStringDictionary::TStringId scmDataOutputTypeIds[]; + static const TEventID scmEventREQID = 0; + static const TDataIOID scmEIWith[]; + static const TForteInt16 scmEIWithIndexes[]; + static const CStringDictionary::TStringId scmEventInputNames[]; + static const TEventID scmEventCNFID = 0; + static const TDataIOID scmEOWith[]; + static const TForteInt16 scmEOWithIndexes[]; + static const CStringDictionary::TStringId scmEventOutputNames[]; + + static const SFBInterfaceSpec scmFBInterfaceSpec; + + void executeEvent(TEventID paEIID, CEventChainExecutionThread *const paECET) override; + + void readInputData(TEventID paEIID) override; + void writeOutputData(TEventID paEIID) override; + void setInitialValues() override; + + public: + FORTE_ASSEMBLE_WORD_FROM_BOOLS(CStringDictionary::TStringId paInstanceNameId, forte::core::CFBContainer &paContainer); + + CIEC_BOOL var_BIT_00; + CIEC_BOOL var_BIT_01; + CIEC_BOOL var_BIT_02; + CIEC_BOOL var_BIT_03; + CIEC_BOOL var_BIT_04; + CIEC_BOOL var_BIT_05; + CIEC_BOOL var_BIT_06; + CIEC_BOOL var_BIT_07; + CIEC_BOOL var_BIT_08; + CIEC_BOOL var_BIT_09; + CIEC_BOOL var_BIT_10; + CIEC_BOOL var_BIT_11; + CIEC_BOOL var_BIT_12; + CIEC_BOOL var_BIT_13; + CIEC_BOOL var_BIT_14; + CIEC_BOOL var_BIT_15; + + CIEC_WORD var_; + + CIEC_WORD var_conn_; + + CEventConnection conn_CNF; + + CDataConnection *conn_BIT_00; + CDataConnection *conn_BIT_01; + CDataConnection *conn_BIT_02; + CDataConnection *conn_BIT_03; + CDataConnection *conn_BIT_04; + CDataConnection *conn_BIT_05; + CDataConnection *conn_BIT_06; + CDataConnection *conn_BIT_07; + CDataConnection *conn_BIT_08; + CDataConnection *conn_BIT_09; + CDataConnection *conn_BIT_10; + CDataConnection *conn_BIT_11; + CDataConnection *conn_BIT_12; + CDataConnection *conn_BIT_13; + CDataConnection *conn_BIT_14; + CDataConnection *conn_BIT_15; + + CDataConnection conn_; + + CIEC_ANY *getDI(size_t) override; + CIEC_ANY *getDO(size_t) override; + CEventConnection *getEOConUnchecked(TPortId) override; + CDataConnection **getDIConUnchecked(TPortId) override; + CDataConnection *getDOConUnchecked(TPortId) override; + + void evt_REQ(const CIEC_BOOL &paBIT_00, const CIEC_BOOL &paBIT_01, const CIEC_BOOL &paBIT_02, const CIEC_BOOL &paBIT_03, const CIEC_BOOL &paBIT_04, const CIEC_BOOL &paBIT_05, const CIEC_BOOL &paBIT_06, const CIEC_BOOL &paBIT_07, const CIEC_BOOL &paBIT_08, const CIEC_BOOL &paBIT_09, const CIEC_BOOL &paBIT_10, const CIEC_BOOL &paBIT_11, const CIEC_BOOL &paBIT_12, const CIEC_BOOL &paBIT_13, const CIEC_BOOL &paBIT_14, const CIEC_BOOL &paBIT_15, CIEC_WORD &pa) { + var_BIT_00 = paBIT_00; + var_BIT_01 = paBIT_01; + var_BIT_02 = paBIT_02; + var_BIT_03 = paBIT_03; + var_BIT_04 = paBIT_04; + var_BIT_05 = paBIT_05; + var_BIT_06 = paBIT_06; + var_BIT_07 = paBIT_07; + var_BIT_08 = paBIT_08; + var_BIT_09 = paBIT_09; + var_BIT_10 = paBIT_10; + var_BIT_11 = paBIT_11; + var_BIT_12 = paBIT_12; + var_BIT_13 = paBIT_13; + var_BIT_14 = paBIT_14; + var_BIT_15 = paBIT_15; + executeEvent(scmEventREQID, nullptr); + pa = var_; + } + + void operator()(const CIEC_BOOL &paBIT_00, const CIEC_BOOL &paBIT_01, const CIEC_BOOL &paBIT_02, const CIEC_BOOL &paBIT_03, const CIEC_BOOL &paBIT_04, const CIEC_BOOL &paBIT_05, const CIEC_BOOL &paBIT_06, const CIEC_BOOL &paBIT_07, const CIEC_BOOL &paBIT_08, const CIEC_BOOL &paBIT_09, const CIEC_BOOL &paBIT_10, const CIEC_BOOL &paBIT_11, const CIEC_BOOL &paBIT_12, const CIEC_BOOL &paBIT_13, const CIEC_BOOL &paBIT_14, const CIEC_BOOL &paBIT_15, CIEC_WORD &pa) { + evt_REQ(paBIT_00, paBIT_01, paBIT_02, paBIT_03, paBIT_04, paBIT_05, paBIT_06, paBIT_07, paBIT_08, paBIT_09, paBIT_10, paBIT_11, paBIT_12, paBIT_13, paBIT_14, paBIT_15, pa); + } +}; + +CIEC_WORD func_ASSEMBLE_WORD_FROM_BOOLS(CIEC_BOOL st_lv_BIT_00, CIEC_BOOL st_lv_BIT_01, CIEC_BOOL st_lv_BIT_02, CIEC_BOOL st_lv_BIT_03, CIEC_BOOL st_lv_BIT_04, CIEC_BOOL st_lv_BIT_05, CIEC_BOOL st_lv_BIT_06, CIEC_BOOL st_lv_BIT_07, CIEC_BOOL st_lv_BIT_08, CIEC_BOOL st_lv_BIT_09, CIEC_BOOL st_lv_BIT_10, CIEC_BOOL st_lv_BIT_11, CIEC_BOOL st_lv_BIT_12, CIEC_BOOL st_lv_BIT_13, CIEC_BOOL st_lv_BIT_14, CIEC_BOOL st_lv_BIT_15); + +