1#ifndef IV_SRC_MODEL_CONTROLS_VALVEMANAGER_HPP_
2#define IV_SRC_MODEL_CONTROLS_VALVEMANAGER_HPP_
28 bool insertValve(
const std::shared_ptr<iv::model::control::Valve> &valve);
39 bool removeSoftwareChannels);
67 static std::optional<std::shared_ptr<iv::channels::AbstractChannel>>
77 static std::optional<std::shared_ptr<iv::channels::AbstractChannel>>
90 [[nodiscard]] std::map<iv::types::control::valve::valveId, std::shared_ptr<iv::model::control::Valve>> &
valves();
99 static bool isDefaultChannel(
const std::shared_ptr<iv::channels::AbstractChannel> &channel);
115 static std::list<iv::types::channelOrder>
124 static std::list<iv::types::channelOrder>
157 static bool configureChOutputOP(
const std::shared_ptr<iv::channels::AbstractChannel> &channel,
159 static bool configureChOutputCL(
const std::shared_ptr<iv::channels::AbstractChannel> &channel,
161 static bool configureChCmdOP(
const std::shared_ptr<iv::channels::AbstractChannel> &channel,
164 bool isConfiguringFromController);
165 static bool configureChCmdCL(
const std::shared_ptr<iv::channels::AbstractChannel> &channel,
168 bool isConfiguringFromController);
169 static bool configureChCmdReset(
const std::shared_ptr<iv::channels::AbstractChannel> &channel,
172 bool isConfiguringFromController);
173 static bool configureChTrip(
const std::shared_ptr<iv::channels::AbstractChannel> &channel,
177 std::map<iv::types::control::valve::valveId, std::shared_ptr<iv::model::control::Valve>>
m_valves;
181 static constexpr std::string_view
valve {
"Valve"};
Definition xmlFile.hpp:15
Definition ValveManager.hpp:19
static bool configureChFeedbackCL(const std::shared_ptr< iv::channels::AbstractChannel > &channel, iv::types::control::valve::valveId valveId)
Definition ValveManager.cpp:614
void update(const ValveManager &other)
Definition ValveManager.cpp:962
static uint16_t getNumAvailableDigitalOutputChannels(const std::shared_ptr< iv::units::Unit > &unit)
Get the number of available digital output channels for a given unit.
Definition ValveManager.cpp:324
std::map< iv::types::control::valve::valveId, std::shared_ptr< iv::model::control::Valve > > m_valves
Definition ValveManager.hpp:177
static bool configureChCmdCL(const std::shared_ptr< iv::channels::AbstractChannel > &channel, const iv::types::control::valve::valveId &valveId, iv::types::channelOrder channelOrder, iv::types::unitId unitId, bool isConfiguringFromController)
Definition ValveManager.cpp:800
static std::list< iv::types::channelOrder > getNumAvailableCmdChannelOrders(const std::shared_ptr< iv::units::Unit > &unit)
Get the available command channel orders for a given unit.
Definition ValveManager.cpp:342
bool load(const iv::file::xml::node &nodeValves)
Definition ValveManager.cpp:14
bool insertValve(const std::shared_ptr< iv::model::control::Valve > &valve)
Definition ValveManager.cpp:41
bool changeValveSystemAndOrder(const iv::types::control::valve::valveId &oldValveId, iv::model::control::valve::eValveSystem newValveSystem, iv::types::control::valve::valveOrder newValveOrder)
Definition ValveManager.cpp:91
static std::list< iv::types::channelOrder > getNumAvailableTripChannelOrders(const std::shared_ptr< iv::units::Unit > &unit)
Get the available trip channel orders for a given unit.
Definition ValveManager.cpp:359
std::map< iv::types::control::valve::valveId, std::shared_ptr< iv::model::control::Valve > > & valves()
Definition ValveManager.cpp:146
static void removeValveSoftwareChannels(const std::shared_ptr< iv::model::control::Valve > &valve)
Remove the software channels of a valve.
Definition ValveManager.cpp:559
static bool isDefaultChannel(const std::shared_ptr< iv::channels::AbstractChannel > &channel)
Check if the channel is a default channel from the point of view of Valves.
Definition ValveManager.cpp:281
static bool configureChCmdOP(const std::shared_ptr< iv::channels::AbstractChannel > &channel, const iv::types::control::valve::valveId &valveId, iv::types::channelOrder channelOrder, iv::types::unitId unitId, bool isConfiguringFromController)
Definition ValveManager.cpp:749
static bool configureChTrip(const std::shared_ptr< iv::channels::AbstractChannel > &channel, const iv::types::control::valve::valveId &valveId, iv::types::channelOrder channelOrder, iv::types::unitId unitId, bool isConfiguringFromController)
Definition ValveManager.cpp:904
static bool configureChOutputOP(const std::shared_ptr< iv::channels::AbstractChannel > &channel, iv::types::control::valve::valveId valveId)
Definition ValveManager.cpp:659
static std::optional< std::shared_ptr< iv::channels::AbstractChannel > > getTheNAvailableValveFeedbackChannel(iv::types::unitId lomId, uint16_t n)
Get the Nth available valve feedback channel for a given LOM ID.
Definition ValveManager.cpp:222
static bool configureChOutputCL(const std::shared_ptr< iv::channels::AbstractChannel > &channel, iv::types::control::valve::valveId valveId)
Definition ValveManager.cpp:704
bool removeValve(const types::control::valve::valveId &valveId, bool resetWiredChannels, bool removeSoftwareChannels)
Definition ValveManager.cpp:121
static void reconfigureValveChannels(const std::shared_ptr< iv::model::control::Valve > &valve)
Definition ValveManager.cpp:469
bool createValve(valve::eValveSystem valveSystem, iv::types::control::valve::valveOrder valveOrder, iv::model::control::valve::eValveType valveType, iv::types::unitId lomId, const iv::model::control::valve::AllValveChannels &allValveChannels)
Definition ValveManager.cpp:59
bool save(iv::file::xml::node &nodeValves) const
Definition ValveManager.cpp:28
static std::optional< std::shared_ptr< iv::channels::AbstractChannel > > getTheNAvailableValveOrderChannel(iv::types::unitId lomId, uint16_t n)
Get the Nth available valve order channel for a given LOM ID.
Definition ValveManager.cpp:252
static bool configureChFeedbackOP(const std::shared_ptr< iv::channels::AbstractChannel > &channel, iv::types::control::valve::valveId valveId)
Definition ValveManager.cpp:569
static iv::model::control::valve::eLomAvailability getLomAvailability(const std::shared_ptr< iv::units::Unit > &unit, iv::model::control::valve::eValveType valveType)
Get the availability of LOMs for a given valve type.
Definition ValveManager.cpp:289
static bool linkAndConfigureValveChannels(const std::shared_ptr< iv::model::control::Valve > &valve)
Link and configure the channels of a valve.
Definition ValveManager.cpp:375
void getValveValidDefaultParameters(iv::model::control::valve::eValveSystem &defaultValveSystem, iv::types::control::valve::valveOrder &defaultValveOrder, valve::eValveType &defaultValveType, iv::types::unitId &defaultLomId)
Gets a valid combination of default parameters for a valve.
Definition ValveManager.cpp:151
static void resetValveWiredChannels(const std::shared_ptr< iv::model::control::Valve > &valve)
Reset the wired channels of a valve.
Definition ValveManager.cpp:533
static bool configureChCmdReset(const std::shared_ptr< iv::channels::AbstractChannel > &channel, const iv::types::control::valve::valveId &valveId, iv::types::channelOrder channelOrder, iv::types::unitId unitId, bool isConfiguringFromController)
Definition ValveManager.cpp:851
static std::set< iv::types::unitId > getAvailableLomIds(iv::model::control::valve::eValveType valveType)
Get the LOM IDs of the LOMs capable of managing a valve of a given type.
Definition ValveManager.cpp:191
eValveType
Definition enums.hpp:71
eValveSystem
Definition enums.hpp:21
eLomAvailability
Definition enums.hpp:77
Definition ControlManager.cpp:4
uint16_t valveOrder
Definition types.hpp:107
std::string valveId
Definition types.hpp:106
uint16_t unitId
Definition types.hpp:77
uint16_t channelOrder
Definition types.hpp:68
Definition ValveManager.hpp:184
static constexpr uint16_t numCmdChannels
Definition ValveManager.hpp:186
static constexpr std::pair< iv::types::channelOrder, iv::types::channelOrder > valveTripChannelOrderRange
Definition ValveManager.hpp:190
static constexpr uint16_t numTripChannels
Definition ValveManager.hpp:187
static constexpr std::pair< iv::types::channelOrder, iv::types::channelOrder > valveCmdChannelOrderRange
Definition ValveManager.hpp:188
static constexpr uint16_t maxValveOrderValue
Definition ValveManager.hpp:185
Definition ValveManager.hpp:180
static constexpr std::string_view valve
Definition ValveManager.hpp:181
Definition structs.hpp:16