forked from eclipse-4diac/4diac-forte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update E_IMPULSE function block to handle standard timer functions: - Change data input and output names from TM to PT and QO to Q respectively - Update internal variables and connections accordingly * Copy over E_CTUD to E_CTUD_UDINT with corrected name spelling. * Add standard timer function block (pulse) implementation. Define input and output data, event connections, internal FBs, and set initial values. * Add standard timer function block for on/off-delay timing This commit adds a new file implementing the E_TONOF function block, including data input/output definitions and event connections. Initial values are set, and read/write methods are implemented for handling input/output data. * Add E_TON function block for standard timer (on-delay timing). This commit introduces the E_TON function block for on-delay timing, including initialization, data connections, event handling, and interface definitions. * Add standard timer function block for off-delay timing. Define inputs, outputs, event connections, and internal FBs. * Update event source files list Added multiple event source files to the list in CMakeLists.txt. * Update event function block names and file references. - Rename E_IMPULSE to E_PULSE in source files - Update class names, header files, and function definitions accordingly. * Update internal and event connections, add new FB instances. - Added a new FB instance E_PERMIT. - Updated event connections for E_RS, E_DELAY, and E_PERMIT. - Adjusted data connections for PT, Q, IN ports. * Update copyright year and rename function block types. Details: - Updated copyright year to 2024 for HR Agrartechnik GmbH. - Renamed function block type E_IMPULSE to E_PULSE on 2024-05-03 by Franz Hoepfinger.
- Loading branch information
1 parent
dd310ed
commit a5c5826
Showing
14 changed files
with
1,257 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
/************************************************************************* | ||
*** 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 | ||
*** | ||
*** This file was generated using the 4DIAC FORTE Export Filter V1.0.x NG! | ||
*** | ||
*** Name: E_PULSE | ||
*** Description: standard timer function block (pulse) | ||
*** Version: | ||
*** 1.0: 2023-08-21/Franz Hoepfinger - HR Agrartechnik GmbH - initial implementation as E_IMPULSE | ||
*** 2024-05-03/Franz Hoepfinger - HR Agrartechnik GmbH - renamed to E_PULSE | ||
*************************************************************************/ | ||
|
||
#include "E_PULSE_fbt.h" | ||
#ifdef FORTE_ENABLE_GENERATED_SOURCE_CPP | ||
#include "E_PULSE_fbt_gen.cpp" | ||
#endif | ||
|
||
#include "criticalregion.h" | ||
#include "resource.h" | ||
|
||
DEFINE_FIRMWARE_FB(FORTE_E_PULSE, g_nStringIdE_PULSE) | ||
|
||
const CStringDictionary::TStringId FORTE_E_PULSE::scmDataInputNames[] = {g_nStringIdPT}; | ||
const CStringDictionary::TStringId FORTE_E_PULSE::scmDataInputTypeIds[] = {g_nStringIdTIME}; | ||
const CStringDictionary::TStringId FORTE_E_PULSE::scmDataOutputNames[] = {g_nStringIdQ}; | ||
const CStringDictionary::TStringId FORTE_E_PULSE::scmDataOutputTypeIds[] = {g_nStringIdBOOL}; | ||
const TDataIOID FORTE_E_PULSE::scmEIWith[] = {0, scmWithListDelimiter}; | ||
const TForteInt16 FORTE_E_PULSE::scmEIWithIndexes[] = {0, -1}; | ||
const CStringDictionary::TStringId FORTE_E_PULSE::scmEventInputNames[] = {g_nStringIdREQ, g_nStringIdR}; | ||
const TDataIOID FORTE_E_PULSE::scmEOWith[] = {0, scmWithListDelimiter}; | ||
const TForteInt16 FORTE_E_PULSE::scmEOWithIndexes[] = {0}; | ||
const CStringDictionary::TStringId FORTE_E_PULSE::scmEventOutputNames[] = {g_nStringIdCNF}; | ||
const SFBInterfaceSpec FORTE_E_PULSE::scmFBInterfaceSpec = { | ||
2, scmEventInputNames, scmEIWith, scmEIWithIndexes, | ||
1, scmEventOutputNames, scmEOWith, scmEOWithIndexes, | ||
1, scmDataInputNames, scmDataInputTypeIds, | ||
1, scmDataOutputNames, scmDataOutputTypeIds, | ||
0, nullptr, | ||
0, nullptr | ||
}; | ||
|
||
FORTE_E_PULSE::FORTE_E_PULSE(const CStringDictionary::TStringId paInstanceNameId, forte::core::CFBContainer &paContainer) : | ||
CCompositeFB(paContainer, &scmFBInterfaceSpec, paInstanceNameId, scmFBNData), | ||
var_conn_Q(var_Q), | ||
conn_CNF(this, 0), | ||
conn_PT(nullptr), | ||
conn_Q(this, 0, &var_conn_Q) { | ||
}; | ||
|
||
void FORTE_E_PULSE::setInitialValues() { | ||
var_PT = 0_TIME; | ||
var_Q = 0_BOOL; | ||
} | ||
|
||
const SCFB_FBInstanceData FORTE_E_PULSE::scmInternalFBs[] = { | ||
{g_nStringIdE_DELAY, g_nStringIdE_DELAY}, | ||
{g_nStringIdE_SR, g_nStringIdE_SR} | ||
}; | ||
|
||
|
||
const SCFB_FBConnectionData FORTE_E_PULSE::scmEventConnections[] = { | ||
{GENERATE_CONNECTION_PORT_ID_1_ARG(g_nStringIdREQ), -1, GENERATE_CONNECTION_PORT_ID_2_ARG(g_nStringIdE_DELAY, g_nStringIdSTART), 0}, | ||
{GENERATE_CONNECTION_PORT_ID_2_ARG(g_nStringIdE_DELAY, g_nStringIdEO), 0, GENERATE_CONNECTION_PORT_ID_2_ARG(g_nStringIdE_SR, g_nStringIdR), 1}, | ||
{GENERATE_CONNECTION_PORT_ID_2_ARG(g_nStringIdE_SR, g_nStringIdEO), 1, GENERATE_CONNECTION_PORT_ID_1_ARG(g_nStringIdCNF), -1}, | ||
{GENERATE_CONNECTION_PORT_ID_1_ARG(g_nStringIdR), -1, GENERATE_CONNECTION_PORT_ID_2_ARG(g_nStringIdE_DELAY, g_nStringIdSTOP), 0}, | ||
}; | ||
|
||
const SCFB_FBFannedOutConnectionData FORTE_E_PULSE::scmFannedOutEventConnections[] = { | ||
{0, GENERATE_CONNECTION_PORT_ID_2_ARG(g_nStringIdE_SR, g_nStringIdS), 1}, | ||
{3, GENERATE_CONNECTION_PORT_ID_2_ARG(g_nStringIdE_SR, g_nStringIdR), 1}, | ||
}; | ||
|
||
const SCFB_FBConnectionData FORTE_E_PULSE::scmDataConnections[] = { | ||
{GENERATE_CONNECTION_PORT_ID_1_ARG(g_nStringIdPT), -1, GENERATE_CONNECTION_PORT_ID_2_ARG(g_nStringIdE_DELAY, g_nStringIdDT), 0}, | ||
{GENERATE_CONNECTION_PORT_ID_2_ARG(g_nStringIdE_SR, g_nStringIdQ), 1, GENERATE_CONNECTION_PORT_ID_1_ARG(g_nStringIdQ), -1}, | ||
}; | ||
|
||
const SCFB_FBNData FORTE_E_PULSE::scmFBNData = { | ||
2, scmInternalFBs, | ||
4, scmEventConnections, | ||
2, scmFannedOutEventConnections, | ||
2, scmDataConnections, | ||
0, nullptr, | ||
0, nullptr, | ||
0, nullptr | ||
}; | ||
|
||
void FORTE_E_PULSE::readInternal2InterfaceOutputData(const TEventID paEOID) { | ||
switch(paEOID) { | ||
case scmEventCNFID: { | ||
if(CDataConnection *conn = getIn2IfConUnchecked(0); conn) { conn->readData(var_Q); } | ||
break; | ||
} | ||
default: | ||
break; | ||
} | ||
} | ||
void FORTE_E_PULSE::readInputData(const TEventID paEIID) { | ||
switch(paEIID) { | ||
case scmEventREQID: { | ||
readData(0, var_PT, conn_PT); | ||
break; | ||
} | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
void FORTE_E_PULSE::writeOutputData(const TEventID paEIID) { | ||
switch(paEIID) { | ||
case scmEventCNFID: { | ||
writeData(0, var_Q, conn_Q); | ||
break; | ||
} | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
CIEC_ANY *FORTE_E_PULSE::getDI(const size_t paIndex) { | ||
switch(paIndex) { | ||
case 0: return &var_PT; | ||
} | ||
return nullptr; | ||
} | ||
|
||
CIEC_ANY *FORTE_E_PULSE::getDO(const size_t paIndex) { | ||
switch(paIndex) { | ||
case 0: return &var_Q; | ||
} | ||
return nullptr; | ||
} | ||
|
||
CEventConnection *FORTE_E_PULSE::getEOConUnchecked(const TPortId paIndex) { | ||
switch(paIndex) { | ||
case 0: return &conn_CNF; | ||
} | ||
return nullptr; | ||
} | ||
|
||
CDataConnection **FORTE_E_PULSE::getDIConUnchecked(const TPortId paIndex) { | ||
switch(paIndex) { | ||
case 0: return &conn_PT; | ||
} | ||
return nullptr; | ||
} | ||
|
||
CDataConnection *FORTE_E_PULSE::getDOConUnchecked(const TPortId paIndex) { | ||
switch(paIndex) { | ||
case 0: return &conn_Q; | ||
} | ||
return nullptr; | ||
} | ||
|
Oops, something went wrong.