This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @brief Newtype pattern impl for cpp. Derives a new type from one that | |
* implements arithmetic operations to allow typesafe arithmetic. | |
* | |
* # Purpose: | |
* It is useful to restrict arithmetic on builtin types to | |
* variables that represent the same quantity, e.g. only allow 'meters' to be | |
* added to 'meters'. This struct provides a template definition for easily | |
* deriving these 'new types'. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdexcept> | |
// inherit from this class (privately) to ensure only a single instance | |
// of the derived class is created using runtime checking. | |
template <typename D> // CRTP (to give each instantiation its own flag) | |
class single_instance | |
{ | |
protected: // protected constructors to ensure this is used as a mixin | |
single_instance() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyfmi import load_fmu | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# Runs the "Actuator" example provided by EnergyPlusToFMU | |
# Adapted from https://gist.github.com/TStesco/d02d19e7e382ab8c37d51c96d7891f6d | |
# Tested with: | |
# - Fedora 31 (up to date as of 2020-03-25) | |
# - EnergyPlus v9.0.1 | |
# - EnergyPlusToFMU v2.1.0 |