https://mooseframework.inl.gov
Loading...
Searching...
No Matches
UnitTripChainControl.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
13
16{
18
19 params.addClassDescription("Trips a boolean value if an input boolean value is a certain value.");
20
21 params.addRequiredParam<std::string>("input",
22 "The boolean chain control data to determine if tripped");
23 params.addParam<bool>("trip_on_true",
24 true,
25 "If set to 'true', the trip occurs if the input has a value of 'true'; "
26 "else the trip occurs if the input has a value of 'false'.");
27 params.addParam<bool>(
28 "use_old_input", false, "Whether to use the input from the previous time step");
29
30 return params;
31}
32
34 : ChainControl(parameters),
35 _trip_on_true(getParam<bool>("trip_on_true")),
36 _input(getParam<bool>("use_old_input") ? getChainControlDataOld<bool>("input")
37 : getChainControlData<bool>("input")),
38 _tripped(declareChainControlData<bool>("tripped"))
39{
40 _tripped = false;
41}
42
43void
45{
46 if (_trip_on_true && _input)
47 _tripped = true;
48
49 if (!_trip_on_true && !_input)
50 _tripped = true;
51}
registerMooseObject("MooseApp", UnitTripChainControl)
Control that additionally provides the capability to produce/consume data values, to allow control op...
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
Trips a boolean value if an input boolean value is a certain value.
bool & _tripped
Tripped status.
const bool & _input
Value to check for trip.
const bool _trip_on_true
Whether to trip on true or false value.
virtual void execute() override
Execute the control.
static InputParameters validParams()
UnitTripChainControl(const InputParameters &parameters)