1#ifndef IV_SRC_LOGIC_STATIONLOGICS_HPP_
2#define IV_SRC_LOGIC_STATIONLOGICS_HPP_
40 std::atomic<std::optional<iv::types::channelValue>>
m_outputValue {std::nullopt};
53 std::vector<std::shared_ptr<StationBlockParam>>
m_params {};
82 const std::shared_ptr<iv::logic::station::StationBlockParam> &blockParameter);
83 [[nodiscard]] std::optional<std::weak_ptr<iv::logic::station::StationBlockParam>>
89 static void prvProcessFollower(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
90 static void prvProcessAdd(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
91 static void prvProcessSub(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
92 static void prvProcessDiv(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
93 static void prvProcessMult(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
94 static void prvProcessAnd(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
95 static void prvProcessOr(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
96 static void prvProcessCompare(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
97 static void prvProcessNot(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
98 static void prvProcessMean(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
99 static void prvProcessIfElse(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
100 static void prvProcessAbs(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
102 static void prvProcessAnalogRoot(
const std::shared_ptr<iv::logic::station::StationBlock> &pBlock);
107 static std::vector<std::shared_ptr<iv::logic::station::StationBlockParam>>
109 static std::vector<std::shared_ptr<iv::logic::station::StationBlockParam>>
111 static std::vector<std::shared_ptr<iv::logic::station::StationBlockParam>>
115 static std::optional<iv::types::channelValue>
116 prvGetInputValue(
const std::shared_ptr<iv::logic::station::StationBlockParam> &inputParam);
117 static void prvSetOutputValue(
const std::shared_ptr<iv::logic::station::StationBlockParam> &outputParam,
Definition StationLogics.hpp:65
void clear() const
Definition StationLogics.cpp:47
static void prvProcessMult(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the mult block. It multiplies the input values and stores the result in the output.
Definition StationLogics.cpp:385
std::shared_ptr< iv::logic::station::StationLogicBlocks > getStationLogicBlocks()
Definition StationLogics.cpp:159
static void prvProcessAnalogAlmType2Limits(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Definition StationLogics.cpp:751
static void prvProcessMean(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the mean block. It calculates the mean value of the input values and stores the result in t...
Definition StationLogics.cpp:558
static void prvProcessOr(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the or block. It performs a logical OR operation between the input values and stores the re...
Definition StationLogics.cpp:442
void update(const iv::logic::StationLogics &other)
Definition StationLogics.cpp:55
bool readStationLomFile(const std::string &file)
Definition StationLogics.cpp:30
StationLogics(iv::types::unitId unitId)
Definition StationLogics.cpp:15
static void prvInvalidateOutputValue(const std::shared_ptr< iv::logic::station::StationBlockParam > &outputParam)
Invalidates the output parameter value that goes to another block.
Definition StationLogics.cpp:977
void processLogic() const
Definition StationLogics.cpp:70
static std::optional< iv::types::channelValue > prvGetInputValue(const std::shared_ptr< iv::logic::station::StationBlockParam > &inputParam)
Gets the input parameter value. It might be a channel value, a constant value or a value from another...
Definition StationLogics.cpp:909
static std::vector< std::shared_ptr< iv::logic::station::StationBlockParam > > prvGetInputsParams(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Gets the input parameters from a block.
Definition StationLogics.cpp:866
static void prvProcessAbs(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the abs block. It calculates the absolute value of the input value and stores the result in...
Definition StationLogics.cpp:621
static void prvProcessSub(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the sub block. It subtracts the second input value from the first input value and stores th...
Definition StationLogics.cpp:318
static void processLoadedStationLogicBlockIOParameter(const std::shared_ptr< iv::logic::station::StationBlockParam > &blockParameter)
Definition StationLogics.cpp:209
static void prvProcessAnalogRoot(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the analog root block. It calculates the square root of the input value and stores the resu...
Definition StationLogics.cpp:673
bool processLoadedStationLogicBlocks() const
Definition StationLogics.cpp:164
bool hasLogic() const
Definition StationLogics.cpp:60
static void prvProcessAnalogAlmState(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Definition StationLogics.cpp:815
static void prvProcessCompare(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the compare block. It compares the input values using the specified operator and stores the...
Definition StationLogics.cpp:501
static void prvProcessDiv(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the div block. It divides the first input value by the second input value and stores the qu...
Definition StationLogics.cpp:346
std::shared_ptr< iv::logic::station::StationLogicBlocks > m_stationLogics
Definition StationLogics.hpp:87
iv::types::unitId m_unitID
Definition StationLogics.hpp:86
static std::vector< std::shared_ptr< iv::logic::station::StationBlockParam > > prvGetParamsOfType(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock, iv::logic::eDBBlockParamType paramType)
Gets the parameters of a specific type from a block.
Definition StationLogics.cpp:889
static void prvSetOutputValue(const std::shared_ptr< iv::logic::station::StationBlockParam > &outputParam, iv::types::channelValue)
Sets the output parameter value. It might be a channel value or a value to be stored in the parameter...
Definition StationLogics.cpp:954
static void prvProcessAnalogAlmType(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Definition StationLogics.cpp:705
static void prvProcessAnd(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the and block. It performs a logical AND operation between the input values and stores the ...
Definition StationLogics.cpp:413
static void prvProcessAnalogConstant(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the analog constant block. It stores the constant value in the output.
Definition StationLogics.cpp:647
static std::vector< std::shared_ptr< iv::logic::station::StationBlockParam > > prvGetOutputsParams(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Gets the output parameters from a block.
Definition StationLogics.cpp:877
~StationLogics()
Definition StationLogics.cpp:21
static void prvProcessIfElse(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the if-else block. It evaluates the condition and stores the true value in the output if th...
Definition StationLogics.cpp:586
static void prvProcessAdd(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the add block. It sums the input values and stores the result in the output.
Definition StationLogics.cpp:290
std::optional< std::weak_ptr< iv::logic::station::StationBlockParam > > findOutputParameterWithGlobalId(uint32_t globalId) const
Definition StationLogics.cpp:243
static void prvProcessNot(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the not block. It performs a logical NOT operation on the input value and stores the result...
Definition StationLogics.cpp:532
static void prvProcessFollower(const std::shared_ptr< iv::logic::station::StationBlock > &pBlock)
Processes the follower block. It copies the input value to the output.
Definition StationLogics.cpp:264
iv::types::unitId getUnitID() const
Definition StationLogics.cpp:65
Definition LogicRectangle.cpp:4
eDBBlockParamType
Definition defines.hpp:20
uint16_t unitId
Definition types.hpp:77
double channelValue
Definition types.hpp:67
Definition structs.hpp:43
Definition StationLogics.hpp:20
std::optional< std::weak_ptr< iv::channels::AbstractChannel > > m_connectedChannel
Optimizations.
Definition StationLogics.hpp:32
iv::logic::eDBBlockParamType m_type
Definition StationLogics.hpp:21
std::optional< uint32_t > m_connectedBlockId
Definition StationLogics.hpp:33
std::optional< std::weak_ptr< StationBlockParam > > m_inputConnectedBlockParam
Definition StationLogics.hpp:37
std::optional< uint32_t > m_value
Definition StationLogics.hpp:43
std::uint16_t m_channelId
Definition StationLogics.hpp:26
uint32_t m_globalIdOrValueParameter
Definition StationLogics.hpp:24
std::atomic< std::optional< iv::types::channelValue > > m_outputValue
Definition StationLogics.hpp:40
std::uint16_t m_channelUnitId
Definition StationLogics.hpp:25
Definition StationLogics.hpp:47
uint8_t m_subType
Definition StationLogics.hpp:51
uint16_t m_orderOfExecution
Definition StationLogics.hpp:48
uint8_t m_type
Definition StationLogics.hpp:50
std::vector< std::shared_ptr< StationBlockParam > > m_params
Definition StationLogics.hpp:53
std::string m_name
Definition StationLogics.hpp:49
Definition StationLogics.hpp:57
iv::logic::InfoLogicTxt m_infoLogic
Definition StationLogics.hpp:58
std::vector< std::shared_ptr< StationBlock > > m_stationBlocks
Definition StationLogics.hpp:59