Feature | ver. 0.4.23 | ver. 0.3.1 (Deprecated) |
---|---|---|
from cadCAD.configuration import Experiment
exp = Experiment()
exp.append_configs(...) |
from cadCAD.configuration import append_configs
append_configs(…) |
|
from cadCAD.engine import ExecutionMode, ExecutionContext
exec_mode = ExecutionMode()
local_ctx = ExecutionContext(context=exec_mode.local_mode) |
Multi-Threaded from cadCAD.engine import ExecutionMode, ExecutionContext
exec_mode = ExecutionMode()
single_ctx = ExecutionContext(context=exec_mode.multi_proc) Single-Threaded from cadCAD.engine import ExecutionMode, ExecutionContext
exec_mode = ExecutionMode()
multi_ctx = ExecutionContext(context=exec_mode.single_proc)
|
|
import pandas as pd
from tabulate import tabulate
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
import system_model_A, system_model_B
from cadCAD import configs
exec_mode = ExecutionMode()
local_ctx = ExecutionContext(context=exec_mode.local_mode)
simulation = Executor(exec_context=local_ctx, configs=configs)
raw_result, sys_model, _ = simulation.execute()
result = pd.DataFrame(raw_result)
print(tabulate(result, headers='keys', tablefmt='psql')) |
import pandas as pd
from tabulate import tabulate
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
import system_model_A, system_model_B
from cadCAD import configs
exec_mode = ExecutionMode()
multi_ctx = ExecutionContext(context=exec_mode.multi_proc)
simulation = Executor(exec_context=multi_ctx, configs=configs)
i = 0
config_names = ['sys_model_A', 'sys_model_B']
for raw_result, _ in simulation.execute():
result = pd.DataFrame(raw_result)
print()
print(f"{config_names[i]} Result: System Events DataFrame:")
print(tabulate(result, headers='keys', tablefmt='psql'))
print()
i += 1
|
|
def state_update(_params, substep, sH, s, _input, **kwargs):
…
return 'state_variable_name', new_value
def policy(_params, substep, sH, s, **kwargs):
…
return {'signal_1': value_1, …, 'signal_N': value_N}
|
def state_update(_params, substep, sH, s, _input):
…
return 'state_variable_name', new_value
def policy(_params, substep, sH, s):
…
return {'signal_1': value_1, …, 'signal_N': value_N}
|