<jupyter_start><jupyter_text>NotationThis notebook shows the notation used in this project.<jupyter_code>%load_ext autoreload
%autoreload 2
%config IPCompleter.greedy=True<jupyter_output><empty_output><jupyter_text>Show Pre-defined Notation Collection<jupyter_code>from solara.utils.notation import NOTATION
from IPython.display import Markdown

Markdown(NOTATION.get_mrkdwn_table_str())<jupyter_output><empty_output><jupyter_text>Setting Up Power Notation Collections<jupyter_code>import solara.utils.notation
import solara.envs.wiring    

power_flow = solara.envs.wiring.PowerFlow(['solar','battery','load','grid'], 
                                          fully_connected=False)

power_flow.add_connection('solar','battery')
power_flow.add_connection('solar','load')
power_flow.add_connection('solar','grid')
power_flow.add_connection('grid','battery')
power_flow.add_connection('grid','load')
power_flow.add_connection('battery','load')
power_flow.add_connection('battery','grid')
  
power_notation = solara.utils.notation.NotationCollection(
    solara.utils.notation.create_power_variables(power_flow, include_in_out_vars=True)
)

#Markdown(power_notation.get_mrkdwn_table_str())
import solara.utils.notation
import solara.envs.wiring    

power_flow = solara.envs.wiring.PowerFlow(['x','y'], 
                                          fully_connected=True)
#power_flow.add_connection('x','y')
ex_power_notation = solara.utils.notation.NotationCollection(
    solara.utils.notation.create_power_variables(power_flow)
)

#Markdown(ex_power_notation.get_mrkdwn_table_str())
# Creating separate notation collections for variables and parameters

complete_notation_list = NOTATION.notation_list + power_notation.notation_list

cp_variables = [var_def for var_def in complete_notation_list if var_def.cp_type == "variable"]
cp_parameters = [var_def for var_def in complete_notation_list if var_def.cp_type == "parameter"]

cp_var_collection = solara.utils.notation.NotationCollection(cp_variables)
cp_par_collection = solara.utils.notation.NotationCollection(cp_parameters)
# Create summary commands listing notation

cp_var_cmds = [var_def.latex_cmd for var_def in cp_variables]
cp_par_cmds = [var_def.latex_cmd for var_def in cp_parameters]

def get_text_list_cmd(cmd_list):
    return '$' + '$, $'.join(cmd_list[:-1]) + '$, and $' + cmd_list[-1] + "$"

def get_math_list_cmd(cmd_list):
    out_str = "\\substack{"
    for i, cmd in enumerate(cmd_list):
        out_str += cmd
        if i < len(cmd_list)-1:
            out_str += ", "
            if i % 4 == 3:
                out_str += "\\\\ "
    out_str += "}"
    return out_str

get_text_list_cmd(cp_par_cmds)
print(get_math_list_cmd(cp_var_cmds))<jupyter_output>\substack{\energybattery, \isbatterycharging, \poweroutgridabovethresh, \powerflowsolar, \\ \poweroutsolar, \powerflowbattery, \powerinbattery, \poweroutbattery, \\ \powerflowload, \powerinload, \powerflowgrid, \poweringrid, \\ \poweroutgrid, \powersolartobattery, \powersolartoload, \powersolartogrid, \\ \powerbatterytoload, \powerbatterytogrid, \powergridtobattery, \powergridtoload}<jupyter_text>Creating Latex Style File Content<jupyter_code># Print output to be copied in latex style file
print(r"""
%%% AUTOMATICALLY GENERATED NOTATION %%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{autonotation}
""")
print("\n%%% Main Notation")
NOTATION.print_notation_style()
print("\n%%% Power Notation")
power_notation.print_notation_style()
print("\n%%% Example Power Notation")
ex_power_notation.print_notation_style()
print("\n%%% Convex Problem Commands")
print("\\newcommand{{\\allcpvariablesmath}}{{{}}}".format(get_math_list_cmd(cp_var_cmds)))
print("\\newcommand{{\\allcpparameterstext}}{{{}}}".format(get_text_list_cmd(cp_par_cmds)))<jupyter_output>%%% AUTOMATICALLY GENERATED NOTATION %%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{autonotation}


%%% Main Notation
\newcommand{\energybattery}[1][(t)]{E_\text{b}#1}
\newcommand{\isbatterycharging}[1][(t)]{I#1}
\newcommand{\poweroutgridabovethresh}[1][(t)]{\bar{P}_{g\rightarrow}#1}
\newcommand{\size}{B}
\newcommand{\kWhpercell}{B_\text{cell}}
\newcommand{\numcells}{n_\text{cell}}
\newcommand{\initialenergycontent}{E_b (0)}
\newcommand{\nominalvoltagec}{V_{\text{nom},c}}
\newcommand{\nominalvoltaged}{V_{\text{nom},d}}
\newcommand{\effdischarge}{\eta_d}
\newcommand{\effcharge}{\eta_c}
\newcommand{\pricebase}{\pi_b}
\newcommand{\pricepenalty}{\pi_d}
\newcommand{\gridthreshold}{\Gamma}
\newcommand{\numtimesteps}{T}
\newcommand{\lentimestep}{\Delta_t}

%%% Power Notation
\newcommand{\powerflowsolar}[1][(t)]{P_s#1}
\newcommand{\poweroutsolar}[1][(t)]{P_{s\rightarrow }#1}
\newcommand{\powerflowbattery}[1][(t)]{P_b#1}
\newcommand{\powerinbattery}[1][(t)]{P_{\rightarrow b}#1}
\newcommand{\po[...]<jupyter_text>Creating Tables for Report<jupyter_code>display(Markdown(cp_var_collection.get_latex_table_str()))
display(Markdown(cp_par_collection.get_latex_table_str()))
# Equivalent Markdown Tables
display(Markdown(cp_var_collection.get_mrkdwn_table_str()))
display(Markdown(cp_par_collection.get_mrkdwn_table_str()))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14485981308411214, 'fraction_numerical': 0.004478193146417445, 'mean_word_length': 6.690119760479042, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '41096', 'license': 'MIT', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1767, 'n_words': 239, 'path': 'notebooks/exploratory/rdnfn_012_notation.ipynb', 'repo_name': 'rdnfn/solar-agent', 'size': '5136'}