src/energyplus/ForwardTranslator/ForwardTranslateExternalInterfaceActuator.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "../ForwardTranslator.hpp" | ||
| 7 | |||
| 8 | #include "../../model/Model.hpp" | ||
| 9 | #include "../../model/ModelObject.hpp" | ||
| 10 | #include "../../model/ExternalInterfaceActuator.hpp" | ||
| 11 | #include "../../model/ExternalInterfaceActuator_Impl.hpp" | ||
| 12 | |||
| 13 | #include <utilities/idd/ExternalInterface_Actuator_FieldEnums.hxx> | ||
| 14 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 15 | #include <utilities/idd/IddEnums.hxx> | ||
| 16 | |||
| 17 | using namespace openstudio::model; | ||
| 18 | |||
| 19 | using namespace std; | ||
| 20 | |||
| 21 | namespace openstudio { | ||
| 22 | |||
| 23 | namespace energyplus { | ||
| 24 | |||
| 25 | 1 | boost::optional<IdfObject> ForwardTranslator::translateExternalInterfaceActuator(ExternalInterfaceActuator& modelObject) { | |
| 26 | 1 | boost::optional<std::string> s; | |
| 27 | 1 | boost::optional<double> d; | |
| 28 | |||
| 29 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject(openstudio::IddObjectType::ExternalInterface_Actuator); |
| 30 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(idfObject); |
| 31 | //Name | ||
| 32 |
1/1✓ Branch 1 taken 1 time.
|
1 | s = modelObject.name(); |
| 33 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (s) { |
| 34 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setName(*s); |
| 35 | } | ||
| 36 | |||
| 37 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | const boost::optional<ModelObject> m = modelObject.actuatedComponentUnique(); |
| 38 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (m.is_initialized()) { |
| 39 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | idfObject.setString(ExternalInterface_ActuatorFields::ActuatedComponentUniqueName, m.get().nameString()); |
| 40 | } | ||
| 41 | |||
| 42 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | s = modelObject.actuatedComponentType(); |
| 43 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (s.is_initialized()) { |
| 44 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ExternalInterface_ActuatorFields::ActuatedComponentType, s.get()); |
| 45 | } | ||
| 46 | |||
| 47 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | s = modelObject.actuatedComponentControlType(); |
| 48 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (s.is_initialized()) { |
| 49 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ExternalInterface_ActuatorFields::ActuatedComponentControlType, s.get()); |
| 50 | } | ||
| 51 | |||
| 52 |
1/1✓ Branch 1 taken 1 time.
|
1 | d = modelObject.optionalInitialValue(); |
| 53 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (d.is_initialized()) { |
| 54 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(ExternalInterface_ActuatorFields::OptionalInitialValue, d.get()); |
| 55 | } | ||
| 56 | |||
| 57 |
1/1✓ Branch 1 taken 1 time.
|
2 | return idfObject; |
| 58 | 1 | } | |
| 59 | |||
| 60 | } // namespace energyplus | ||
| 61 | |||
| 62 | } // namespace openstudio | ||
| 63 |