Closed sjanzou closed 1 week ago
@tyneises, can you take a look at the failing MSLF configurations?
MSLF configurations fail because REQUIRED_IF is not set for all required variables.
add-temp-mspt_cmod_var and patch branch work fine for MSPT configurations.
Added fcall_var_exists to facilitate desired functionality of #1634
Working and running for add-temp-mspt_cmod_var and patch branches of ssc as requested.
@tyneises, @taylorbrown75 please review and let me know if you have any questions.
Logic is clear and works well. I produced the following table showing performance depending on required_if type and whether the variable is defined in the UI. Works as described.
Seems we can stop using SIMULATION_PARAMETER? Conditional required_if works with sim_type. (i.e. use REQUIRED_IF="sim_type=1")
@taylorbrown75 thanks for the detailed review! @tyneises can we get stop using SIMULATION_PARAMETER as @taylorbrown75 suggests?
The fundamental issue for the ssc_auto_exec in the EqnDatabase is that the EqnDatabase is constructed at load up on a page by page basis and has no idea on which UI variables will be available in whatever configuration the page is used. The ssc_auto_exec was constructed to avoid having to manually set each variable when the compute module referenced was called. Initially, any variables that were not to be set by the ssc_auto_exec function were designated by the UIHINT=”SIMULATION_PARAMETER” which is still in effect.
For SAM issue 1634, there is no way for ssc_auto_exec to have the same functionality as clicking the Simulate button in the UI. This is because ssc_auto_exec in constructed at page loadup when SAM starts and has no concept of a case or a configuration. That is, the list of UI variables is not available when the ssc_auto_exec function is evaluated.
To address SAM issue 1634 as much as possible, no UI variable will be used for any ssc variable that has the “REQUIRED_IF=*”. If the ssc variable is not required or has a default or a different REQUIRED_IF value, then ssc_auto_exec will skip the assignment to a UI variable.
Tested with add-temp-mspt_cmod_var branch of ssc - no equation errors![image](https://github.com/NREL/SAM/assets/6498311/f426a8fb-d8ea-439f-a1b3-f12fdf82cfc1)