Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #5281 - Use rebuilt E+ with correct entitlements #5287

Merged
merged 32 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
48e1fc7
Fix #5281 - Use rebuilt E+ with correct entitlements
jmarrec Nov 5, 2024
1832b84
Bump to rc3
jmarrec Nov 5, 2024
cf2ee19
Fix #5290 - rename enums in Alfalfa to avoid clash with Utilities one…
jmarrec Nov 6, 2024
21af047
Rename ComponentBase to AlfalfaComponentBase for consistency with the…
jmarrec Nov 6, 2024
7464597
Fixup the SWIG files
jmarrec Nov 6, 2024
c941416
Update workflow runners
jmarrec Nov 6, 2024
db608bf
Move Alfalfa enums into Utilities to avoid "duplicate symbol '_CSharp…
jmarrec Nov 6, 2024
bbc0a94
Place Alfalfa C# in model between OSVersion and Measure
jmarrec Nov 6, 2024
d865b87
Fix namesapce for types in GTest
TShapinsky Nov 6, 2024
cab6ef6
Merge pull request #5293 from NREL/CSharp-Alfalfa-Test-Fix
jmarrec Nov 7, 2024
c666655
Adjust includes: C# MSVC fails to compile this file as it doesn't kno…
jmarrec Nov 7, 2024
31f12be
[skip ci] clang format
jmarrec Nov 7, 2024
b5a6c58
Merge pull request #5291 from NREL/CSharp
jmarrec Nov 7, 2024
5d301d8
Prepare a few broken OSWs for testing
jmarrec Nov 7, 2024
c5481ef
Don't use a measure that register an Error in the broken OSW (so they…
jmarrec Nov 7, 2024
6729e76
Add CLI tests with the broken OSWs, expect them to fail (they don't w…
jmarrec Nov 7, 2024
b249fef
Add `bool WorkflowJSON::validateMeasures() const`: non-throwy, logs E…
jmarrec Nov 7, 2024
dd6a610
Use that in the RunInitialization job, and throw if invalid
jmarrec Nov 7, 2024
290661b
Test the new method
jmarrec Nov 7, 2024
4aafb5a
When loading from a string that is actually a path, call setOswPath
jmarrec Nov 7, 2024
912124c
remove most point id requirements
TShapinsky Nov 7, 2024
257d8d3
remove unnecessary setting of point Id
TShapinsky Nov 7, 2024
25e61d0
Update src/alfalfa/AlfalfaJSON.cpp
TShapinsky Nov 8, 2024
175fd88
Update src/alfalfa/test/AlfalfaJSON_GTest.cpp
TShapinsky Nov 8, 2024
56565e9
use std::replace instead of regex
TShapinsky Nov 8, 2024
d5c11a6
fix formatting
TShapinsky Nov 8, 2024
ae56871
Merge pull request #5296 from NREL/alfalfa_id_validation
jmarrec Nov 8, 2024
8cccf80
Merge pull request #5295 from NREL/5233_ValidateOSW
kbenne Nov 11, 2024
3331df0
Fix #5281 - Use rebuilt E+ with correct entitlements
jmarrec Nov 5, 2024
fa82e5e
Bump to rc3
jmarrec Nov 5, 2024
a000d0e
Updated os-extension and os-standards for rc3.
wenyikuang Nov 12, 2024
a20a810
Merge branch '5281_python_entitlements' of https://github.com/NREL/Op…
wenyikuang Nov 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/buildCSharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
name: [Ubuntu, macOS, macOS_arm64, Windows64, Windows32]
include:
- name: Ubuntu
os: ubuntu-20.04
os: ubuntu-22.04
- name: macOS
os: macos-11
os: macos-13
- name: macOS_arm64
os: macos-14
- name: Windows64
Expand Down
28 changes: 16 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ get_directory_property(hasParent PARENT_DIRECTORY)

# TODO: Modify the more specific variables as needed to indicate prerelease, etc
# Keep in beta in-between release cycles. Set to empty string (or comment out) for official)
set(PROJECT_VERSION_PRERELEASE "rc2")
set(PROJECT_VERSION_PRERELEASE "rc3")

# OpenStudio version: Only include Major.Minor.Patch, eg "3.0.0", even if you have a prerelease tag
set(OPENSTUDIO_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
Expand Down Expand Up @@ -638,11 +638,15 @@ endif()

if(UNIX)
if(APPLE)
# TODO: temp for #5281 - Resigned with a different entitlements to avoid an issue when we pip install stuff into the E+ dir with native comps (numpy for eg)
set(ENERGYPLUS_REPO "jmarrec")
set(ENERGYPLUS_RELEASE_NAME "v24.2.0a-entitlements")

if (ARCH MATCHES "arm64")
set(ENERGYPLUS_EXPECTED_HASH f36afc055a675ae95523d6f41ec478c0)
set(ENERGYPLUS_EXPECTED_HASH 29616d6aa23e2fc0f71362da9794ef08)
set(ENERGYPLUS_PLATFORM "Darwin-macOS13-arm64")
else()
set(ENERGYPLUS_EXPECTED_HASH b2003c461277c0bd4e91a4c003b350ac)
set(ENERGYPLUS_EXPECTED_HASH 21bdad40fbc560b4b382469ef9f96936)
set(ENERGYPLUS_PLATFORM "Darwin-macOS12.1-x86_64")
endif()
elseif(LSB_RELEASE_ID_SHORT MATCHES "CentOS")
Expand Down Expand Up @@ -843,7 +847,7 @@ if(BUILD_CLI)
set(OPENSTUDIO_GEMS_BASEURL "http://openstudio-resources.s3.amazonaws.com/dependencies")

# TODO: temp
set(OPENSTUDIO_GEMS_BASEURL "https://github.com/NREL/openstudio-gems/releases/download/v3.9.0-RC2")
set(OPENSTUDIO_GEMS_BASEURL "https://github.com/NREL/openstudio-gems/releases/download/v3.9.0-RC3")

# To use the package produced by a PR to https://github.com/NREL/openstudio-gems
set(USE_OPENSTUDIO_GEMS_PR FALSE)
Expand All @@ -855,28 +859,28 @@ if(BUILD_CLI)
if(UNIX)
if(APPLE)
if (ARCH MATCHES arm64)
set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20241101-darwin_arm64-3.2.2.tar.gz")
set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "c4cf7754444937e5df496f23af6d76ad")
set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20241112-darwin_arm64-3.2.2.tar.gz")
set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "cb6a884366780c8ba5da2852ca60e98a")
else()
set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20241101-darwin-3.2.2.tar.gz")
set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "5754b6ba7cff435d33f6c4dcdcd6bfc4")
set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20241112-darwin-3.2.2.tar.gz")
set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "ce81fcf1bf707281082cde3d87dac114")
endif()
else()
if (ARCH MATCHES "arm64")
set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20240517-linux_arm64-3.2.2.tar.gz")
set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "f6d094a3bdaf1476ce7911e74276993b")
else()
set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20241101-linux-3.2.2.tar.gz")
set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "972a9246fd2a6d43bc7eb23e2ad2b715")
set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20241112-linux-3.2.2.tar.gz")
set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "7551691c842a86cc8198959b5d0f1ee9")
endif()
if (USE_OPENSTUDIO_GEMS_PR)
set(OPENSTUDIO_GEMS_BASEURL "${OPENSTUDIO_GEMS_BASEURL}/openstudio-gems-linux/${OPENSTUDIO_GEMS_PR_NUMBER}")
endif()
endif()
elseif(WIN32)
# OpenStudio gems are only supported on 64 bit windows
set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20241101-windows-3.2.2.tar.gz")
set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "a5f1fde7ab2555e736d3d21ba5beb683")
set(OPENSTUDIO_GEMS_ZIP_FILENAME "openstudio3-gems-20241112-windows-3.2.2.tar.gz")
set(OPENSTUDIO_GEMS_ZIP_EXPECTED_MD5 "8f1cdcca664a1d3d80908230a00981ef")
if (USE_OPENSTUDIO_GEMS_PR)
set(OPENSTUDIO_GEMS_BASEURL "${OPENSTUDIO_GEMS_BASEURL}/openstudio-gems-windows/${OPENSTUDIO_GEMS_PR_NUMBER}")
endif()
Expand Down
1 change: 1 addition & 0 deletions ProjectMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ macro(MAKE_SWIG_TARGET NAME SIMPLENAME KEY_I_FILE I_FILES PARENT_TARGET PARENT_S

set( model_names
OpenStudioMeasure
OpenStudioAlfalfa
OpenStudioModel
OpenStudioModelAirflow
OpenStudioModelAvailabilityManager
Expand Down
1 change: 1 addition & 0 deletions csharp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ set(translator_wrappers

set(model_wrappers
csharp_OpenStudioMeasure_wrap.cxx
csharp_OpenStudioAlfalfa_wrap.cxx
csharp_OpenStudioModel_wrap.cxx
csharp_OpenStudioModelAirflow_wrap.cxx
csharp_OpenStudioModelAvailabilityManager_wrap.cxx
Expand Down
19 changes: 19 additions & 0 deletions resources/workflow/invalid_measures/missing_a_measure.osw
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"weather_file": "../../Examples/compact_osw/files/srrl_2013_amy.epw",
"seed_file": "../example_model.osm",
"measure_paths": ["../measures/"],
"steps": [
{
"measure_dir_name": "FakeModelMeasure",
"arguments": {}
},
{
"measure_dir_name": "NON_EXISTING_MEASURE_THIS_SHOULD_BE_CAUGHT",
"arguments": {}
},
{
"measure_dir_name": "FakeReport",
"arguments": {}
}
]
}
19 changes: 19 additions & 0 deletions resources/workflow/invalid_measures/unloadable_measure.osw
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"weather_file": "../../Examples/compact_osw/files/srrl_2013_amy.epw",
"seed_file": "../example_model.osm",
"measure_paths": ["../measures/"],
"steps": [
{
"measure_dir_name": "FakeModelMeasure",
"arguments": {}
},
{
"measure_dir_name": "UnloadableMeasure",
"arguments": {}
},
{
"measure_dir_name": "FakeReport",
"arguments": {}
}
]
}
15 changes: 15 additions & 0 deletions resources/workflow/invalid_measures/wrong_measure_type_order.osw
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"weather_file": "../../Examples/compact_osw/files/srrl_2013_amy.epw",
"seed_file": "../example_model.osm",
"measure_paths": ["../measures/"],
"steps": [
{
"measure_dir_name": "FakeReport",
"arguments": {}
},
{
"measure_dir_name": "FakeModelMeasure",
"arguments": {}
}
]
}
42 changes: 42 additions & 0 deletions resources/workflow/measures/FakeModelMeasure/measure.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
class FakeModelMeasure < OpenStudio::Measure::ModelMeasure
# human readable name
def name
# Measure name should be the title case of the class name.
return 'A dumb ModelMeasure'
end

# human readable description
def description
return 'Does nothing'
end

# human readable description of modeling approach
def modeler_description
return 'Just for testing'
end

# define the arguments that the user will input
def arguments(model)
args = OpenStudio::Measure::OSArgumentVector.new

return args
end

# define what happens when the measure is run
def run(model, runner, user_arguments)
super(model, runner, user_arguments) # Do **NOT** remove this line

# use the built-in error checking
if !runner.validateUserArguments(arguments(model), user_arguments)
return false
end

# report final condition of model
runner.registerFinalCondition("The FakeModelMeasure run.")

return true
end
end

# register the measure to be used by the application
FakeModelMeasure.new.registerWithApplication
44 changes: 44 additions & 0 deletions resources/workflow/measures/FakeModelMeasure/measure.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0"?>
<measure>
<schema_version>3.1</schema_version>
<name>fake_model_measure</name>
<uid>677b8fd3-2627-4516-b090-f6e47dc99fea</uid>
<version_id>162465e5-b6f6-419f-ab5f-c2fc4bd549e0</version_id>
<version_modified>2024-11-07T11:55:10Z</version_modified>
<xml_checksum>82D8F881</xml_checksum>
<class_name>FakeModelMeasure</class_name>
<display_name>A dumb ModelMeasure</display_name>
<description>Does nothing</description>
<modeler_description>Just for testing</modeler_description>
<arguments />
<outputs />
<provenances />
<tags>
<tag>Envelope.Form</tag>
</tags>
<attributes>
<attribute>
<name>Measure Type</name>
<value>ModelMeasure</value>
<datatype>string</datatype>
</attribute>
<attribute>
<name>Measure Language</name>
<value>Ruby</value>
<datatype>string</datatype>
</attribute>
</attributes>
<files>
<file>
<version>
<software_program>OpenStudio</software_program>
<identifier>3.9.0</identifier>
<min_compatible>3.9.0</min_compatible>
</version>
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>DDA977B0</checksum>
</file>
</files>
</measure>
1 change: 1 addition & 0 deletions resources/workflow/measures/UnloadableMeasure/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This doesnt have a xml
Empty file.
8 changes: 4 additions & 4 deletions src/alfalfa/Alfalfa.i
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
#endif

%include <utilities/UtilitiesAPI.hpp>
#define ALFALFA_API

%include <utilities/core/CommonInclude.i>
%import <utilities/core/CommonImport.i>
%import <utilities/Utilities.i>

%ignore openstudio::alfalfa::detail;

%{
#include <alfalfa/AlfalfaAPI.hpp>
#include <alfalfa/AlfalfaComponent.hpp>
#include <alfalfa/AlfalfaActuator.hpp>
#include <alfalfa/AlfalfaConstant.hpp>
Expand All @@ -33,15 +34,14 @@
using namespace openstudio::alfalfa;
%}

%ignore openstudio::alfalfa::ComponentBase;
%ignore openstudio::alfalfa::AlfalfaComponentBase;
%ignore openstudio::alfalfa::AlfalfaActuator::clone;
%ignore openstudio::alfalfa::AlfalfaConstant::clone;
%ignore openstudio::alfalfa::AlfalfaMeter::clone;
%ignore openstudio::alfalfa::AlfalfaGlobalVariable::clone;
%ignore openstudio::alfalfa::AlfalfaOutputVariable::clone;

%include <alfalfa/AlfalfaAPI.hpp>
%include <alfalfa/ComponentBase.hpp>
%include <alfalfa/AlfalfaComponentBase.hpp>
%include <alfalfa/AlfalfaComponent.hpp>
%include <alfalfa/AlfalfaActuator.hpp>
%include <alfalfa/AlfalfaConstant.hpp>
Expand Down
14 changes: 7 additions & 7 deletions src/alfalfa/AlfalfaActuator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#define ALFALFA_COMPONENT_ACTUATOR_HPP

#include "AlfalfaAPI.hpp"
#include "ComponentBase.hpp"
#include "AlfalfaComponentBase.hpp"

#include "../utilities/idf/IdfObject.hpp"

namespace openstudio {
namespace alfalfa {
class ALFALFA_API AlfalfaActuator : public ComponentBase
class ALFALFA_API AlfalfaActuator : public AlfalfaComponentBase
{
public:
/**
Expand All @@ -26,15 +26,15 @@ namespace alfalfa {

Json::Value toJSON() const override;

ComponentCapability capability() const override {
return ComponentCapability::Bidirectional;
AlfalfaComponentCapability capability() const override {
return AlfalfaComponentCapability::Bidirectional;
}

ComponentType type() const override {
return ComponentType::Actuator;
AlfalfaComponentType type() const override {
return AlfalfaComponentType::Actuator;
}

std::unique_ptr<ComponentBase> clone() const override {
std::unique_ptr<AlfalfaComponentBase> clone() const override {
return std::make_unique<AlfalfaActuator>(*this);
}

Expand Down
4 changes: 2 additions & 2 deletions src/alfalfa/AlfalfaComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ namespace alfalfa {
return m_component->toJSON();
}

ComponentCapability AlfalfaComponent::capability() const {
AlfalfaComponentCapability AlfalfaComponent::capability() const {
return m_component->capability();
}

ComponentType AlfalfaComponent::type() const {
AlfalfaComponentType AlfalfaComponent::type() const {
return m_component->type();
}

Expand Down
10 changes: 5 additions & 5 deletions src/alfalfa/AlfalfaComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
#include <type_traits>

#include "AlfalfaAPI.hpp"
#include "ComponentBase.hpp"
#include "AlfalfaComponentBase.hpp"

namespace openstudio {
namespace alfalfa {
class ALFALFA_API AlfalfaComponent
{
public:
template <typename T, std::enable_if_t<std::is_base_of<ComponentBase, T>::value, bool> = true>
template <typename T, std::enable_if_t<std::is_base_of<AlfalfaComponentBase, T>::value, bool> = true>
AlfalfaComponent(T component) : m_component(std::make_unique<T>(std::move(component))) {}

AlfalfaComponent(const AlfalfaComponent& other) : m_component(other.m_component->clone()) {}
Expand All @@ -32,9 +32,9 @@ namespace alfalfa {

Json::Value toJSON() const;

ComponentCapability capability() const;
AlfalfaComponentCapability capability() const;

ComponentType type() const;
AlfalfaComponentType type() const;

std::string typeName() const;

Expand All @@ -46,7 +46,7 @@ namespace alfalfa {

private:
AlfalfaComponent() = default;
std::unique_ptr<ComponentBase> m_component;
std::unique_ptr<AlfalfaComponentBase> m_component;
};

inline bool operator==(const AlfalfaComponent& lhs, const AlfalfaComponent& rhs) {
Expand Down
15 changes: 15 additions & 0 deletions src/alfalfa/AlfalfaComponentBase.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "AlfalfaComponentBase.hpp"

namespace openstudio {
namespace alfalfa {

bool AlfalfaComponentBase::canInput() const {
return capability() == AlfalfaComponentCapability::Bidirectional || capability() == AlfalfaComponentCapability::Input;
}

bool AlfalfaComponentBase::canOutput() const {
return capability() == AlfalfaComponentCapability::Bidirectional || capability() == AlfalfaComponentCapability::Output;
}

} // namespace alfalfa
} // namespace openstudio
Loading
Loading