Skip to content
Snippets Groups Projects
Commit 4b7c2b37 authored by Rolfes's avatar Rolfes
Browse files

base clas gui_api clipboard

parent d63dfff3
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:valued-saskatchewan tags:
## Binäre Bilanz
%% Cell type:markdown id:genuine-country tags:
### Kennzeichen einer binären Bilanz
* Nur __extensive__ Größen lassen sich bilanzieren
* Beispiele:
* Masse m, Stoffmenge n, Teilchenzahl N
* Volumen V
* innere Energie U
* freie Energie F, freie Enthalpie G, Entropie S
* Enthalpie H
* elektrische Ladung Q
* eine binäre Bilanz summiert __zwei__ (binär) Größen zu einer Dritten
* Beispiele:
* $ m_{AB} = m_A + m_B $
* $ n_{AB} = n_A + n_B $
* $H_{AB} = H_A + H_B $
* Gehaltsangaben erweitern die Ausdrucksweise
* Beispiele
* Verhältnisse \ Beladungen z.B. $\quad\zeta_{A}=\tfrac{m_A}{m_B}$
* Anteile \ Gehalt z.B. $\quad\xi_{A}=\tfrac{m_A}{m_A + m_B}$
* Konzentration (bezug auf Volumen) z.B. $\quad\beta_{A}=\tfrac{m_A}{V_A + V_B}$
%% Cell type:markdown id:76ca1106-5032-4a20-abaf-b2b439dbffe8 tags:
### Bedingungen zur Berechnung einer binären Bilanz
* Zwei Größen müssen vorgeben werden
* von den zwei Größen muss eine extensiv sein
* Volumenberechnung kann nur bei __gleichen Druck und Temperatur__ erfolgen
%% Cell type:markdown id:cc5ef378-a52e-4ced-9050-a82292513eb0 tags:
<img src="pics/binary_balance_1.jpg" alt="My picture"
title="A cute kitten" width="400px" />
Dieses Bild zeigt den Bilanzknoten mit den extensiven und intensiven Größen
%% Cell type:code id:ab70ee95-ce3c-4c4c-a7bc-2658a1a5d41a tags:
``` python
import nowo1_base as no_ba
import nowo1_sim_binary as no_bi
import nowo1_gui_base as no_gui
import nowo1_log_base as no_log
```
%% Cell type:code id:eec838fd-a5a9-49c8-a873-07c0e3653622 tags:
``` python
bilanz_1 = no_bi.binary_node('bilanz_1') # Umgebungs
step = no_ba.step_single('step')
gui_data = no_gui.gui_ipysheet('gui_data')
log = no_log.log_sheet('log')
```
%% Output
%% Cell type:code id:5e7dc37c-8fe1-4569-a233-e3e45f450ae2 tags:
``` python
step.Init(work_objs=[bilanz_1.Calc_A_B])
log.Init(Values=[bilanz_1.log_all], Gui_For_Data = gui_data)
```
%% Cell type:code id:9a853d13-b21f-475a-8262-b9616bad6a60 tags:
``` python
gui_data.Show_GUI()
```
%% Output
%% Cell type:code id:155a052c-b1b6-4098-8614-19388211296a tags:
``` python
bilanz_1.Show_GUI()
```
%% Output
%% Cell type:code id:aa1fe3ad-55bb-491d-a677-ea20354ba5c1 tags:
``` python
step.Show_GUI()
```
%% Output
%% Cell type:code id:6de5555e-b239-41f5-82e6-8691f8eb946a tags:
``` python
```
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -360,10 +360,32 @@ class gate_dataframe(gate_base):
self._success_flag = False
class gui_api():
def __init__(self):
self._GUI_visible = True
self._GUI_itemlist : dict = dict()
self.GUI_Item = None
self._GUI_is_visible = False
self.info = widgets.Output()
def Show_GUI(self):
if not self.GUI_Item:
self.GUI_Item = self._create_gui()
self._GUI_is_visible = True
display(self.GUI_Item)
def _create_gui(self):
for widget in self._GUI_itemlist.values():
setattr(widget, 'parent', self)
return None
#*****************************************************************
class step_base():
class step_base(gui_api):
def __init__(self, name : str, GUI : bool = False):
super().__init__()
self.name = name
self.step_nr: int = 0
self.total_steps: int = 0
......@@ -371,41 +393,35 @@ class step_base():
self.sim_funcs : dict = {}# Ersetzt self.work_objs und self.work_funcs
self._loggerlist : set = set()
self._GUI_visible = GUI
self._GUI_itemlist : dict = dict()
self.GUI_Item = self._create_gui()
self._GUI_is_visible = False
# self._GUI_visible = GUI
# self._GUI_itemlist : dict = dict()
# self.GUI_Item = self._create_gui()
# self._GUI_is_visible = False
self.info = widgets.Output()
# self.info = widgets.Output()
def on_start_clicked(self, args):
parent = args.parent
parent.reset()
#with self.info:print('on click')
# for obj in parent.work_objs:
# if obj._GUI_is_visible:
# obj.Init_Over_GUI()
parent.work()
def Show_GUI(self):
for obj in self.work_objs:
if obj._GUI_visible:
obj.Show_GUI()
if self.GUI_Item:
self._GUI_is_visible = True
display(self.GUI_Item, self.info)
#with self.info:
# print('Na dann wollen wir mal')
# def Show_GUI(self, show = True):
# for obj in self.work_objs:
# if obj._GUI_visible:
# obj.Show_GUI()
# super().Show_GUI()
# if self.GUI_Item:
# self._GUI_is_visible = True
# display(self.GUI_Item)
def _create_gui(self):
for widget in self._GUI_itemlist.values():
setattr(widget, 'parent', self)
return None
# def _create_gui(self):
# for widget in self._GUI_itemlist.values():
# setattr(widget, 'parent', self)
# return None
def reset(self):
......@@ -632,50 +648,24 @@ class step_timer(step_base):
#*****************************************************************
class work_base():
class work_base(gui_api):
def __init__(self, name: str, GUI : bool = False, **kwargs):
super().__init__()
self.name = name
self._ctrl_ok : bool = False
self._GUI_visible = GUI
self._GUI_itemlist : dict = dict()
self.GUI_Item = None
self._GUI_is_visible = False
self.info = widgets.Output()
#display(self.info)
def Init(self): pass
def ready_for_start(self, timer: step_timer): pass
def ready_for_start(self, stepper: step_base): pass
def ready_for_end(self):pass
def _create_gui(self):
for widget in self._GUI_itemlist.values():
setattr(self, 'parent', widget)
return None
def Show_GUI(self):
if not self.GUI_Item:
self.GUI_Item = self._create_gui()
self._GUI_is_visible = True
display(self.GUI_Item)
class gui_base(work_base):
def __init__(self, name: str, GUI : bool = False, **kwargs):
super().__init__(name, GUI, **kwargs)
def ready_for_start(self, stepper: step_base):pass
def ready_for_end(self):pass
def Init(self): super().Init()
def Init_by_dataframe(self, dataframe): pass
......
......@@ -3,7 +3,7 @@ import nowo1_base as nowo
import datetime as dt
import pandas as pd
import numpy as np
import nowo1_gui_base
import pyperclip
class logger(nowo.port_base):
def __init__(self, name: str, GUI : bool = False, **kwargs):
......@@ -60,6 +60,9 @@ class log_sheet(nowo.port_base):
value = self.buffer_data[key_name]
self.sheet_data.at[row_name, col_name] = value
#self.sheet_data.to_clipboard()
csv_str = self.sheet_data.to_csv()
pyperclip.copy(csv_str)
#copyDF(self.sheet_data)
if self.Gui_For_Data:
#with self.info: print(self.Gui_For_Data.name, 'ready_2')
self.Gui_For_Data.ready_for_end()
......
......@@ -2,3 +2,4 @@ voila
voila-gridstack
ipysheet
pandas
pyperclip
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment