from gas import KeroseneCombustionProducts import functions as func import logging import matplotlib.pyplot as plt from gas_dynamics import * from scipy.optimize import fsolve import os log_filename = os.path.join(os.path.dirname(__file__), 'average_streamline_calculation.log') logger = func.create_logger(__name__, logging.DEBUG, filename=log_filename, filemode='a', add_console_handler=False) class InvalidStageSizeValue(Exception): def __init__(self, message): Exception.__init__(self, message) self.message = message class StageGeomAndHeatDrop: def __init__(self): self._gamma_out = None self._gamma_in = None self._gamma_av = None self._l1_b_sa_ratio = None self._l2_b_rk_ratio = None self._delta_a_b_sa_ratio = 0.22
import logging.config import pandas import functions as func import gas_dynamics as gd from cycle_calculation.gas_turbine_units_input import * from cycle_calculation.gas_turbine_units_input import OutletInput from cycle_calculation.gas_turbine_units_output import * import os log_file_name = os.path.join(os.path.dirname(__file__), 'cycle_calculation.log') logger = func.create_logger(loggerlevel=logging.INFO, filename=log_file_name, filemode='w', name=__name__) def compute_comp_output(work_fluid: Air, pi_comp_stag: np.array, eta_comp_stag_p, T_in_stag): work_fluid.__init__() dk_rel = 1 k_air_ret = np.array([work_fluid.k]) work_fluid.T1 = T_in_stag eta_comp_stag = None k = 0 k_air_old = None while dk_rel >= 0.01: k += 1 eta_comp_stag = func.eta_comp_stag(pi_comp_stag, k_air_ret, eta_comp_stag_p) work_fluid.T2 = T_in_stag * (1 + (pi_comp_stag ** ((k_air_ret - 1) / k_air_ret) - 1) / eta_comp_stag) k_air_ret_new = work_fluid.k_av_int dk_rel = max(abs(k_air_ret - k_air_ret_new) / k_air_ret) k_air_old = k_air_ret k_air_ret = k_air_ret_new
#!/usr/bin/env python3 import sys import Adafruit_DHT import logging from time import sleep from functions import get_data, create_logger from PCF8574 import PCF8574_GPIO from Adafruit_LCD1602 import Adafruit_CharLCD # set sleep duration for test purposes sleep_duration = 30 # # set up logging for debugging logger = create_logger('display.log') def clear_display(): lcd.clear() logger.info("Display cleared.") ## setup display stuff (copied from example from freenove) ######### PCF8574_address = 0x27 # I2C address of the PCF8574 chip. PCF8574A_address = 0x3F # I2C address of the PCF8574A chip. # Create PCF8574 GPIO adapter. try: mcp = PCF8574_GPIO(PCF8574_address) except: try: mcp = PCF8574_GPIO(PCF8574A_address)
#!/usr/bin/env python3 import json from kubernetes import client, watch from functions import MysqlControllerConfig, process_event, create_logger, parse_too_old_failure runtime_config = MysqlControllerConfig() crds = client.CustomObjectsApi() logger = create_logger(log_level=runtime_config.args.log_level) resource_version = '' if __name__ == "__main__": logger.info('mysql-controller initializing') while True: stream = watch.Watch().stream(crds.list_cluster_custom_object, 'signifly.io', 'v1', 'mysqldatabases', resource_version=resource_version) try: for event in stream: event_type = event["type"] obj = event["object"] metadata = obj.get('metadata') spec = obj.get('spec') code = obj.get('code') if code == 410: logger.debug('Error code 410') new_version = parse_too_old_failure(obj.get('message'))
import logging import Adafruit_DHT from datetime import datetime from functions import format_result, get_data, create_logger from bot_secrets import channels, bottoken # import numpy as np c = channels b = bottoken updater = Updater(token=b.token(), use_context=True) dispatcher = updater.dispatcher j = updater.job_queue # set up logging for debugging logger = create_logger('bot.log') def status(update, context): results = get_data() message = format_result(*results) context.bot.send_message(chat_id=update.effective_chat.id, text=message) logger.info('Sending status: ' + message) def monitor_humidity(context: CallbackContext): job = context.job results = get_data() humidity = results[1]
#!/usr/bin/env python3 import json import sys from kubernetes import client, watch from functions import get_config, process_event, create_logger, parse_too_old_failure runtime_config = get_config() crds = client.CustomObjectsApi() logger = create_logger(log_level=runtime_config['log_level']) resource_version = '' if __name__ == "__main__": logger.info('newrelic-controller initializing') while True: stream = watch.Watch().stream(crds.list_cluster_custom_object, 'newrelic.com', 'v1', 'newrelicsettings', resource_version=resource_version) try: for event in stream: event_type = event["type"] obj = event["object"] metadata = obj.get('metadata') spec = obj.get('spec') code = obj.get('code') if code == 410: logger.debug('Error code 410')