Hi John,
The Python code that SAM's code generator creates sets the value of inputs to SSC, which is the underlying "SAM Simulation Core" that performs simulations and generates results.
SAM's user interface also sets the value of SSC inputs, but it has some of its own inputs that are not inputs to SSC, such as the batt_bank_size_ui variable you mention. In this case, there are some SAM inputs on the Battery Cell and System input page that allow you to size the battery using a bank power in kW and bank capacity in kWh. Special code in the user interface converts those values into values of Cells in series, Strings in parallel, Max C-rate of charge and Max C-rate of discharge that are the battery sizing inputs to SSC.
When you run an LK script in the SAM user interface, you can access the SAM user interface inputs (like batt_bank_size_ui) and the SSC inputs (like batt_num_cells). But when you interact with SSC in Python, you cannot access the user interface inputs. That means that your idea to convert the LK script that SAM creates from the Parametrics page won't work because it may include SAM user interface inputs.
If you want to be able to specify the battery size using a bank power and bank capacity, you'll have to write your own code in Python to convert those values to SSC inputs.
SAM's user interface uses LK script to make these calculations. You can see that code on the
SAM repository on GitHub
. For example:
github.com/NREL/SAM/blob/062a09e263f34b32846c5d801ae23619f60092d9/deploy/runtime/ui/Battery%20Bank%20Sizing.txt#L1151
github.com/NREL/SAM/blob/062a09e263f34b32846c5d801ae23619f60092d9/deploy/runtime/ui/Battery%20Current%20and%20Capacity.txt#L2377
Best regards,
Paul.