src/model/ExternalInterfaceFunctionalMockupUnitImportToActuator.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 "ExternalInterfaceFunctionalMockupUnitImportToActuator.hpp" | ||
| 7 | #include "ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl.hpp" | ||
| 8 | |||
| 9 | #include "ExternalInterfaceFunctionalMockupUnitImport.hpp" | ||
| 10 | #include "ExternalInterfaceFunctionalMockupUnitImport_Impl.hpp" | ||
| 11 | |||
| 12 | #include "Model.hpp" | ||
| 13 | #include "Model_Impl.hpp" | ||
| 14 | |||
| 15 | #include <utilities/idd/IddEnums.hxx> | ||
| 16 | #include <utilities/idd/OS_ExternalInterface_FunctionalMockupUnitImport_To_Actuator_FieldEnums.hxx> | ||
| 17 | |||
| 18 | #include "../utilities/units/Unit.hpp" | ||
| 19 | |||
| 20 | #include "../utilities/core/Assert.hpp" | ||
| 21 | |||
| 22 | namespace openstudio { | ||
| 23 | namespace model { | ||
| 24 | |||
| 25 | namespace detail { | ||
| 26 | |||
| 27 | 3 | ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl(const IdfObject& idfObject, | |
| 28 | Model_Impl* model, | ||
| 29 | 3 | bool keepHandle) | |
| 30 | 3 | : ModelObject_Impl(idfObject, model, keepHandle) { | |
| 31 |
4/6✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3 times.
✗ Branch 13 not taken.
|
3 | OS_ASSERT(idfObject.iddObject().type() == ExternalInterfaceFunctionalMockupUnitImportToActuator::iddObjectType()); |
| 32 | 3 | } | |
| 33 | |||
| 34 | ✗ | ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl( | |
| 35 | ✗ | const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 36 | ✗ | : ModelObject_Impl(other, model, keepHandle) { | |
| 37 | ✗ | OS_ASSERT(other.iddObject().type() == ExternalInterfaceFunctionalMockupUnitImportToActuator::iddObjectType()); | |
| 38 | ✗ | } | |
| 39 | |||
| 40 | 1 | ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl( | |
| 41 | 1 | const ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl& other, Model_Impl* model, bool keepHandle) | |
| 42 | 1 | : ModelObject_Impl(other, model, keepHandle) {} | |
| 43 | |||
| 44 | ✗ | const std::vector<std::string>& ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::outputVariableNames() const { | |
| 45 | ✗ | static const std::vector<std::string> result; | |
| 46 | ✗ | return result; | |
| 47 | } | ||
| 48 | |||
| 49 | ✗ | IddObjectType ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::iddObjectType() const { | |
| 50 | ✗ | return ExternalInterfaceFunctionalMockupUnitImportToActuator::iddObjectType(); | |
| 51 | } | ||
| 52 | |||
| 53 | 5 | ModelObject ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::actuatedComponentUnique() const { | |
| 54 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
|
5 | return this->getTarget(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::ActuatedComponentUniqueName)->cast<ModelObject>(); |
| 55 | } | ||
| 56 | |||
| 57 | 5 | std::string ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::actuatedComponentType() const { | |
| 58 |
1/1✓ Branch 1 taken 5 times.
|
5 | boost::optional<std::string> value = getString(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::ActuatedComponentType, true); |
| 59 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (value) { |
| 60 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | return value.get(); |
| 61 | } | ||
| 62 | ✗ | return ""; | |
| 63 | 5 | } | |
| 64 | |||
| 65 | 5 | std::string ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::actuatedComponentControlType() const { | |
| 66 | boost::optional<std::string> value = | ||
| 67 |
1/1✓ Branch 1 taken 5 times.
|
5 | getString(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::ActuatedComponentControlType, true); |
| 68 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (value) { |
| 69 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | return value.get(); |
| 70 | } | ||
| 71 | ✗ | return ""; | |
| 72 | 5 | } | |
| 73 | |||
| 74 | 4 | ExternalInterfaceFunctionalMockupUnitImport ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::fMUFile() const { | |
| 75 |
1/1✓ Branch 1 taken 4 times.
|
8 | return this->getTarget(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::FMUFileName) |
| 76 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
8 | ->cast<ExternalInterfaceFunctionalMockupUnitImport>(); |
| 77 | } | ||
| 78 | |||
| 79 | 3 | std::string ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::fMUInstanceName() const { | |
| 80 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<std::string> value = getString(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::FMUInstanceName, true); |
| 81 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (value) { |
| 82 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | return value.get(); |
| 83 | } | ||
| 84 | ✗ | return ""; | |
| 85 | 3 | } | |
| 86 | |||
| 87 | 3 | std::string ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::fMUVariableName() const { | |
| 88 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<std::string> value = getString(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::FMUVariableName, true); |
| 89 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (value) { |
| 90 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | return value.get(); |
| 91 | } | ||
| 92 | ✗ | return ""; | |
| 93 | 3 | } | |
| 94 | |||
| 95 | 3 | double ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::initialValue() const { | |
| 96 |
1/1✓ Branch 1 taken 3 times.
|
3 | boost::optional<double> value = getDouble(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::InitialValue, true); |
| 97 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (value) { |
| 98 |
1/1✓ Branch 1 taken 3 times.
|
3 | return value.get(); |
| 99 | } | ||
| 100 | ✗ | return -9999; | |
| 101 | } | ||
| 102 | |||
| 103 | 4 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::setActuatedComponentUnique(const ModelObject& modelObject) { | |
| 104 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | bool result = setPointer(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::ActuatedComponentUniqueName, modelObject.handle()); |
| 105 | 4 | return result; | |
| 106 | } | ||
| 107 | |||
| 108 | 5 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::setActuatedComponentType(const std::string& actuatedComponentType) { | |
| 109 | 5 | bool result = setString(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::ActuatedComponentType, actuatedComponentType); | |
| 110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | OS_ASSERT(result); |
| 111 | 5 | return result; | |
| 112 | } | ||
| 113 | |||
| 114 | bool | ||
| 115 | 5 | ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::setActuatedComponentControlType(const std::string& actuatedComponentControlType) { | |
| 116 | bool result = | ||
| 117 | 5 | setString(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::ActuatedComponentControlType, actuatedComponentControlType); | |
| 118 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | OS_ASSERT(result); |
| 119 | 5 | return result; | |
| 120 | } | ||
| 121 | |||
| 122 | 4 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::setFMUFile(const ExternalInterfaceFunctionalMockupUnitImport& fMUFile) { | |
| 123 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | bool result = setPointer(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::FMUFileName, fMUFile.handle()); |
| 124 | 4 | return result; | |
| 125 | //TODO in forward translator set this to the file name | ||
| 126 | } | ||
| 127 | |||
| 128 | 4 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::setFMUInstanceName(const std::string& fMUInstanceName) { | |
| 129 | 4 | bool result = setString(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::FMUInstanceName, fMUInstanceName); | |
| 130 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | OS_ASSERT(result); |
| 131 | 4 | return result; | |
| 132 | } | ||
| 133 | |||
| 134 | 4 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::setFMUVariableName(const std::string& fMUVariableName) { | |
| 135 | 4 | bool result = setString(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::FMUVariableName, fMUVariableName); | |
| 136 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | OS_ASSERT(result); |
| 137 | 4 | return result; | |
| 138 | } | ||
| 139 | |||
| 140 | 4 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::setInitialValue(double initialValue) { | |
| 141 | 4 | bool result = setDouble(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::InitialValue, initialValue); | |
| 142 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | OS_ASSERT(result); |
| 143 | 4 | return result; | |
| 144 | } | ||
| 145 | |||
| 146 | } // namespace detail | ||
| 147 | |||
| 148 | 3 | ExternalInterfaceFunctionalMockupUnitImportToActuator::ExternalInterfaceFunctionalMockupUnitImportToActuator( | |
| 149 | const ModelObject& modelObject, const std::string& actuatedComponentType, const std::string& actuatedComponentControlType, | ||
| 150 | const ExternalInterfaceFunctionalMockupUnitImport& fMUFile, const std::string& fMUInstanceName, const std::string& fMUVariableName, | ||
| 151 | 3 | double initialValue) | |
| 152 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | : ModelObject(ExternalInterfaceFunctionalMockupUnitImportToActuator::iddObjectType(), modelObject.model()) { |
| 153 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 5 not taken.
|
3 | OS_ASSERT(getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()); |
| 154 | |||
| 155 |
1/1✓ Branch 1 taken 3 times.
|
3 | bool ok = setActuatedComponentUnique(modelObject); |
| 156 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (!ok) { |
| 157 | ✗ | remove(); | |
| 158 | ✗ | LOG_AND_THROW("Unable to set " << briefDescription() << "'s ActuatedComponentUnique to " << modelObject.nameString() << "."); | |
| 159 | } | ||
| 160 |
1/1✓ Branch 1 taken 3 times.
|
3 | setActuatedComponentType(actuatedComponentType); |
| 161 |
1/1✓ Branch 1 taken 3 times.
|
3 | setActuatedComponentControlType(actuatedComponentControlType); |
| 162 |
1/1✓ Branch 1 taken 3 times.
|
3 | ok = setFMUFile(fMUFile); |
| 163 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (!ok) { |
| 164 | ✗ | remove(); | |
| 165 | ✗ | LOG_AND_THROW("Unable to set " << briefDescription() << "'s FMUFileName to " << fMUFile.fMUFileName() << "."); | |
| 166 | } | ||
| 167 |
1/1✓ Branch 1 taken 3 times.
|
3 | setFMUInstanceName(fMUInstanceName); |
| 168 |
1/1✓ Branch 1 taken 3 times.
|
3 | setFMUVariableName(fMUVariableName); |
| 169 |
1/1✓ Branch 1 taken 3 times.
|
3 | setInitialValue(initialValue); |
| 170 | 3 | } | |
| 171 | |||
| 172 | 7604 | IddObjectType ExternalInterfaceFunctionalMockupUnitImportToActuator::iddObjectType() { | |
| 173 |
1/1✓ Branch 1 taken 7604 times.
|
7604 | return {IddObjectType::OS_ExternalInterface_FunctionalMockupUnitImport_To_Actuator}; |
| 174 | } | ||
| 175 | |||
| 176 | 5 | ModelObject ExternalInterfaceFunctionalMockupUnitImportToActuator::actuatedComponentUnique() const { | |
| 177 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->actuatedComponentUnique(); |
| 178 | } | ||
| 179 | |||
| 180 | 5 | std::string ExternalInterfaceFunctionalMockupUnitImportToActuator::actuatedComponentType() const { | |
| 181 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->actuatedComponentType(); |
| 182 | } | ||
| 183 | |||
| 184 | 5 | std::string ExternalInterfaceFunctionalMockupUnitImportToActuator::actuatedComponentControlType() const { | |
| 185 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->actuatedComponentControlType(); |
| 186 | } | ||
| 187 | |||
| 188 | 4 | ExternalInterfaceFunctionalMockupUnitImport ExternalInterfaceFunctionalMockupUnitImportToActuator::fMUFile() const { | |
| 189 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->fMUFile(); |
| 190 | } | ||
| 191 | |||
| 192 | 3 | std::string ExternalInterfaceFunctionalMockupUnitImportToActuator::fMUInstanceName() const { | |
| 193 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->fMUInstanceName(); |
| 194 | } | ||
| 195 | |||
| 196 | 3 | std::string ExternalInterfaceFunctionalMockupUnitImportToActuator::fMUVariableName() const { | |
| 197 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->fMUVariableName(); |
| 198 | } | ||
| 199 | |||
| 200 | 3 | double ExternalInterfaceFunctionalMockupUnitImportToActuator::initialValue() const { | |
| 201 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->initialValue(); |
| 202 | } | ||
| 203 | |||
| 204 | 4 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator::setActuatedComponentUnique(const ModelObject& modelObject) { | |
| 205 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->setActuatedComponentUnique(modelObject); |
| 206 | } | ||
| 207 | |||
| 208 | 5 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator::setActuatedComponentType(const std::string& actuatedComponentType) { | |
| 209 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->setActuatedComponentType(actuatedComponentType); |
| 210 | } | ||
| 211 | |||
| 212 | 5 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator::setActuatedComponentControlType(const std::string& actuatedComponentControlType) { | |
| 213 |
1/1✓ Branch 3 taken 5 times.
|
10 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->setActuatedComponentControlType( |
| 214 | 10 | actuatedComponentControlType); | |
| 215 | } | ||
| 216 | |||
| 217 | 4 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator::setFMUFile(const ExternalInterfaceFunctionalMockupUnitImport& fMUFile) { | |
| 218 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->setFMUFile(fMUFile); |
| 219 | } | ||
| 220 | |||
| 221 | 4 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator::setFMUInstanceName(const std::string& fMUInstanceName) { | |
| 222 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->setFMUInstanceName(fMUInstanceName); |
| 223 | } | ||
| 224 | |||
| 225 | 4 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator::setFMUVariableName(const std::string& fMUVariableName) { | |
| 226 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->setFMUVariableName(fMUVariableName); |
| 227 | } | ||
| 228 | |||
| 229 | 4 | bool ExternalInterfaceFunctionalMockupUnitImportToActuator::setInitialValue(double initialValue) { | |
| 230 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl>()->setInitialValue(initialValue); |
| 231 | } | ||
| 232 | |||
| 233 | /// @cond | ||
| 234 | 1 | ExternalInterfaceFunctionalMockupUnitImportToActuator::ExternalInterfaceFunctionalMockupUnitImportToActuator( | |
| 235 | 1 | std::shared_ptr<detail::ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl> impl) | |
| 236 |
1/1✓ Branch 2 taken 1 time.
|
1 | : ModelObject(impl) {} |
| 237 | /// @endcond | ||
| 238 | |||
| 239 | } // namespace model | ||
| 240 | } // namespace openstudio | ||
| 241 |