src/energyplus/ForwardTranslator/ForwardTranslateExternalInterfaceFunctionalMockupUnitExportToActuator.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/ExternalInterfaceFunctionalMockupUnitExportToActuator.hpp" | ||
| 11 | #include "../../model/ExternalInterfaceFunctionalMockupUnitExportToActuator_Impl.hpp" | ||
| 12 | |||
| 13 | #include <utilities/idd/ExternalInterface_FunctionalMockupUnitExport_To_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::translateExternalInterfaceFunctionalMockupUnitExportToActuator( | |
| 26 | ExternalInterfaceFunctionalMockupUnitExportToActuator& modelObject) { | ||
| 27 | 1 | boost::optional<std::string> s; | |
| 28 | 1 | boost::optional<double> d; | |
| 29 | |||
| 30 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | IdfObject idfObject(openstudio::IddObjectType::ExternalInterface_FunctionalMockupUnitExport_To_Actuator); |
| 31 |
1/1✓ Branch 1 taken 1 time.
|
1 | m_idfObjects.push_back(idfObject); |
| 32 | //Name | ||
| 33 |
1/1✓ Branch 1 taken 1 time.
|
1 | s = modelObject.name(); |
| 34 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (s) { |
| 35 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setName(*s); |
| 36 | } | ||
| 37 | |||
| 38 |
1/1✓ Branch 1 taken 1 time.
|
1 | const ModelObject m = modelObject.actuatedComponentUnique(); |
| 39 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ExternalInterface_FunctionalMockupUnitExport_To_ActuatorFields::ActuatedComponentUniqueName, m.nameString()); |
| 40 | |||
| 41 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | s = modelObject.actuatedComponentType(); |
| 42 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (s.is_initialized()) { |
| 43 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ExternalInterface_FunctionalMockupUnitExport_To_ActuatorFields::ActuatedComponentType, s.get()); |
| 44 | } | ||
| 45 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | s = modelObject.actuatedComponentControlType(); |
| 46 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (s.is_initialized()) { |
| 47 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ExternalInterface_FunctionalMockupUnitExport_To_ActuatorFields::ActuatedComponentControlType, s.get()); |
| 48 | } | ||
| 49 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | s = modelObject.fMUVariableName(); |
| 50 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (s.is_initialized()) { |
| 51 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setString(ExternalInterface_FunctionalMockupUnitExport_To_ActuatorFields::FMUVariableName, s.get()); |
| 52 | } | ||
| 53 | |||
| 54 |
1/1✓ Branch 1 taken 1 time.
|
1 | d = modelObject.initialValue(); |
| 55 |
1/2✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
|
1 | if (d.is_initialized()) { |
| 56 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(ExternalInterface_FunctionalMockupUnitExport_To_ActuatorFields::InitialValue, d.get()); |
| 57 | } | ||
| 58 | |||
| 59 |
1/1✓ Branch 1 taken 1 time.
|
2 | return idfObject; |
| 60 | 1 | } | |
| 61 | |||
| 62 | } // namespace energyplus | ||
| 63 | |||
| 64 | } // namespace openstudio | ||
| 65 |