Package: scaleup
ScaleupScale-up Suite Automation. This library provides a set of high level methods for scripting automation of Dynochem(R) and Reaction Lab(TM) models through theRunScript Automationinterface. These methods wrap the COM calls to Scale-up Suite'sModelAutomation.exeallowing end users to write shorter and simpler scripts and focus on what they want to achieve rather than the mechanics of doing it.Contact yourScale-up Systemsrepresentative to obtain access to theRunScript Automationproduct to which this library connects.Dependenciespywin32pandasopenpyxlInstallationpipinstallscaleupscaleup packageThescaleuppackage contains the routines for invoking automation, and helper routines to set up runs, along with classes representing the result of a script invocation along with results for the individual steps.scaleup.scriptsscaleup.scripts.ScriptResultThis class contains the result for a script run.Fieldserror_message(str) -- If an erorr occurred when running the script then this field with contain the error message. Otherwise None or empty.steps(list) -- This contains a list of results for the steps executed. One step result per step.scaleup.scripts.SimulationStepResultThis contains the result of a Simulation step. It contains apandas.DataFramewhich holds the results for each scenario along with (if requested) a list ofSimulationProfileinstances which holds the profiles for each scenario.Fieldstype(str) -- 'SIMULATION'endpoints(DataFrame) -- DataFrame containing the results for the scenarios.profiles(list) -- list ofSimulationProfileinstances, one per scenario (if requested).scaleup.scripts.SimulationProfileDetails of the scenario profileFieldsscenario_name(str)  -- the name of the scenariosolver_steps(float) --  number of stepstotal_time(float) --  total time (seconds)matrix_size(float) --  matrix sizeplotted_points(float) -- plotted pointsintegration_method(str) -- integration methodaccuracy(float) -- accuractrun_time(float) -- run time (seconds)results(DataFrame) -- profile values for the scenarioscaleup.scripts.FittingStepResultContains the result of a Fitting Simulation step.Fieldstype(str) -- 'FITTING'report(list) -- The Fitting reportscaleup.scripts.OptimizationStepResultContains the result of a Optimization Simulation step.Fieldstype(str) -- 'OPTIMIZATION'report(list) -- The Optimization reportscaleup.scripts.VerificationStepResultContains the result of a Verification Simulation step.Fieldstype(str) -- 'VERIFICATION'report(list) -- The Verification reportscaleup.scaleup moduleShort-cut routines for quick running of stepsscaleup.scaleup.run_simulation(file_name: str, scenarios=[], return_profiles: bool = False, show_progress=True, alt_reader=True)Runs a Simulation stepParametersfile_name(str) -- name of the model filescenarios(list*, *optional) -- String representations of the scenarios to be run. To run scenarios from the model, pass in the scenario name. If empty, runs all scenarios in the model, defaults to []return_profiles(bool*, *optional) -- Return the profiles as well as the endpoints, defaults to Falseshow_progress(bool*, *optional) -- Show the progress indicator when running, defaults to Truealt_reader(bool*, *optional) -- Use the alternate reader for Excel Models (i.e. not Excel Interop), defaults to TrueReturnsScriptResult objectscaleup.scaleup.run_fitting(file_name: str, scenarios, parameters, fit_to_each: bool = False, show_progress: bool = True, alt_reader: bool = True, update_to_source: bool = False)Runs a Fitting stepParametersfile_name(str) -- name of the model filescenarios(list) -- the names of the scenarios to be fittedparameters(list) -- string representations of the parameters to be fittedfit_to_each(bool*, *optional) -- Whether to fit to each scenario, defaults to Falseshow_progress(bool*, *optional) -- Shoe the UI when running, defaults to Truealt_reader(bool*, *optional) -- Use the alternate reader for Excel Models (i.e. not Excel Interop), defaults to Trueupdate_to_source(bool*, *optional) -- Write back the fitted values to the original model, defaults to FalseReturnsScriptResult objectscaleup.scaleup.run_optimization(file_name: str, scenario: str, factors, responses, show_progress: bool = True, alt_reader: bool = True, update_to_source: bool = False)Runs an Optimization stepParametersfile_name(str) -- name of the model filescenario(str) -- The name of the scenario to be optimizedfactors(list) -- string respresentations of the factors to be variedresponses(list) -- string representations of the responses to optimizeshow_progress(bool*, *optional) -- Shoe the UI when running, defaults to Truealt_reader(bool*, *optional) -- Use the alternate reader for Excel Models (i.e. not Excel Interop), defaults to Trueupdate_to_source(bool*, *optional) -- Write back the fitted values to the original model, defaults to FalseReturnsScriptResult objectscaleup.scaleup.run_verification(file_name: str, scenarios=[], verification_type: int = 1, show_progress=True, alt_reader=True)Runs a Verification stepParametersfile_name(str) -- name of the model filescenarios(list*, *optional) -- Names of the scenarios to be run. If empty, runs all scenarios in the model, defaults to []verification_type(int*, *optional) -- Verification type. 1 for full report, 2 for residuals, 3 for SSQs, defaults to 1show_progress(bool*, *optional) -- Shoe the UI when running, defaults to Truealt_reader(bool*, *optional) -- Use the alternate reader for Excel Models (i.e. not Excel Interop), defaults to TrueReturnsScriptResult objectscaleup.scaleup.run_multiple_steps(file_name: str, steps, show_progress: bool = True, alt_reader: bool = True, update_to_source: bool = False)Run multiple steps in sequenceParametersfile_name(str) -- name of the model filesteps(list) -- the steps to runshow_progress(bool*, *optional) -- Shoe the UI when running, defaults to Truealt_reader(bool*, *optional) -- Use the alternate reader for Excel Models (i.e. not Excel Interop), defaults to Trueupdate_to_source(bool*, *optional) -- Write back the fitted values to the original model, defaults to FalseReturnsScriptResult objectscaleup.dynochem_automation moduleHelper routines for COM automation of Dynochem Runtime scriptingscaleup.dynochem_automation.create_fitting_step(scenarios, parameters, fitEachScenario: bool, updateToSource: bool = False)Creates a Fitting stepParametersscenarios(list) -- The scenarios to be fittedparameters(list) -- The parameters to be fittedfitEachScenario(bool) -- Fit to each scenario or notupdateToSource(bool*, *optional) -- Write the fitted values back to the model, defaults to FalseReturnsScript stepReturn typeCOM Objectscaleup.dynochem_automation.create_optimization_step(scenarioName: str, factors, responses, updateToSource: bool = False)Creates an Optimization stepParametersscenarioName(str) -- The name of the scenario to be usedfactors(list) -- The factors to varyresponses(list) -- The Responses to be optimizedupdateToSource(bool*, *optional) -- Whether the optimized scenario and data sheet are written back to the model, defaults to FalseReturnsScript stepReturn typeCOM Objectscaleup.dynochem_automation.create_script_parameters(name: str, file_name: str, options: str = '', dataSheets=None, injected_headers=None)Creates a script parameters classParametersname(str) -- Name of the automation jobfile_name(str) -- Name of the model fileoptions(str*, *optional) -- Options e.g. Show/Hide the UI, defaults to ''dataSheets(list*, *optional) -- Custom Datasheets, defaults to Noneinjected_header(list*, *optional) -- Additional headers for scenarios (e.g. process sheet parameters), defaults to NoneRaisesValueError-- If the model is not of a supported type (must be .xls? or .rxm)ReturnsCOM object of script parametersReturn typeCOM objectscaleup.dynochem_automation.create_simulation_step(scenarios=[], writeProfiles: bool = False, returnProfiles: bool = False, calc_wssq = False)Creates a simulation stepParametersscenarios(list*, *optional) -- The scenarios to be run. To run existing scenarios, pass in their names. If empty, all are run, defaults to []writeProfiles(bool*, *optional) -- Write the profiles to an file, defaults to FalsereturnProfiles(bool*, *optional) -- return the profiles as well as the endpoints, defaults to Falsecalc_wssq(bool*, *optional) -- include the calculated WSSQ as a return column, defaults to FalseReturnsScript stepReturn typeCOM Objectscaleup.dynochem_automation.create_verification_step(scenarios=[], verificationType: int = 1)Creates a Verification stepParametersscenarios(list*, *optional) -- The names of the scenarios to be run. If empty, all scenarios are run, defaults to []verificationType(int*, *optional) -- The Verification Type. 1 for full report, 2 for residuals, 3 for SSQs, defaults to 1ReturnsScript stepReturn typeCOM Objectscaleup.dynochem_automation.run_script(file_name: str, script_name: str, steps, options: str = '', dataSheets=None, injected_headers=None)Runs a scriptParametersfile_name(str) -- The file name for the modelscript_name(str) -- The name of the job - displayed in the UI if visiblesteps(list) -- The steps to be executedoptions(str*, *optional) -- Option string for run (Show/Hide UI, Use Excel interop or not for Excel Models), defaults to ''dataSheets(list*, *optional) -- Replacement Datasheets to inject data into the model, defaults to Noneinjected_header(list*, *optional) -- Additional headers for scenarios (e.g. process sheet parameters), defaults to NoneReturnsScript ResultReturn typeCOM Objectscaleup.dynochem_automation.set_datasheets(script, datasheets)scaleup.dynochem_automation_defs moduleCOM Object creation Helpersscaleup.dynochem_automation_defs.create_fitting_parameters_w32()Create a fitting parameters objectReturnsCOM Object with fitting specific parametersReturn typeCOM Objectscaleup.dynochem_automation_defs.create_model_automate_w32()Creates ModelAutomate objectReturnsModelAutomate COM object for running scriptsReturn typeCOM Objectscaleup.dynochem_automation_defs.create_optimization_parameters_w32()Create an optimization parameters objectReturnsCOM Object with optimization specific parametersReturn typeCOM Objectscaleup.dynochem_automation_defs.create_script_parameters_w32()Creates Script parameters COM ObjectReturnsScript parameters COM ObjectReturn typeCOM Objectscaleup.dynochem_automation_defs.create_script_step_w32(stepType: str)Create a script step objectParametersstepType(str) -- Creates a script stepReturns[description]Return type[type]scaleup.dynochem_automation_defs.create_simulation_parameters_w32()Create a simulation parameters objectReturnsCOM Object with simulation specific parametersReturn typeCOM Objectscaleup.dynochem_automation_defs.create_verification_parameters_w32()Create a verification parameters objectReturnsCOM Object with verification specific parametersReturn typeCOM Objectscaleup.script_utils moduleVarious utilities for using with scriptsclassscaleup.script_utils.OptTarget(value)Bases:enum.EnumEnumeration for Optimization TargetMax(_ = _ )Min(_ = (2,_ )Target(_ = (1,_ )scaleup.script_utils.create_fitting_parameter(parameter_name: str, unit: str, initial_value: float, max_value: float, min_value: float, fit_to_log: bool = False)Create a fitting parameterParametersparameter_name(str) -- name of the parameterunit(str) -- unit of measure for the parameterinitial_value(float) -- inital valuemax_value(float) -- max valuemin_value(float) -- min valuefit_to_log(bool*, *optional) -- Fit to the log of the value, defaults to FalseReturnsFormatted parameter details for use with fitting stepReturn typestrscaleup.script_utils.create_max_optimization_response(name: str, weighting: float = 1.0)Creates a 'Maximize' target for a responseParametersname(str) -- name of the response to maximizeweighting(float*, *optional) -- Weighting for this parameter, defaults to 1.0ReturnsFormatted response for use in the Optimization stepReturn typestrscaleup.script_utils.create_min_optimization_response(name: str, weighting: float = 1.0)Creates a 'Minimize' target for a responseParametersname(str) -- name of the response to minimizeweighting(float*, *optional) -- Weighting for this parameter, defaults to 1.0ReturnsFormatted response for use in the Optimization stepReturn typestrscaleup.script_utils.create_optimization_factor(name: str, unit: str, initial_value: float, min=None, max=None)Create optimization FactorParametersname(str) -- Factor nameunit(str) -- factor unitinitial_value(float) -- initial valuemin(float*, *optional) -- min value for factor. If not set, uses half of the initial valuemax(float*, *optional) -- max value for factor. If not set, uses twice the initial valueReturnsFormatted factor for use in optimization stepReturn typestrscaleup.script_utils.create_optimization_response(name: str, target: scaleup.script_utils.OptTarget, value: float = 0.0, weighting: float = 1.0)Create a response for the optimization stepParametersname(str) -- name of the responsetarget(OptTarget) -- Type of response. Min|Max|Targetvalue(float*, *optional) -- Target Value, defaults to 0.0weighting(float*, *optional) -- Weighting for the parameter, defaults to 1.0ReturnsFormatted response for use in the Optimization stepReturn typestrscaleup.script_utils.create_script_option_string(showInUi: bool = True, altReader: bool = False)Generates the script option stringParametersshowInUi(bool*, *optional) -- Show the Automation UI when running, defaults to TruealtReader(bool*, *optional) -- Use the alternate file reader for Excel models (i.e. not Excel Interop), defaults to FalseReturnsFormatted string of optionsReturn typestrscaleup.script_utils.create_simulation_scenario(scen_name: str, ds_name: str, values=[])Creates a simulation scenario for use with Simulation and Verification steps.Parametersscen_name(str) -- scenario nameds_name(str) -- datasheet namevalues(list*, *optional) -- parameter values for the scenario, defaults to []ReturnsString representation of the scenario for use with Simulation and Verification steps.Return typestrscaleup.script_utils.create_target_optimization_response(name: str, value: float, weighting: float = 1.0)Creates a 'Target' target for a responseParametersname(str) -- name of the responsevalue(float) -- Target value for the responseweighting(float*, *optional) -- Weighting for this parameter, defaults to 1.0ReturnsFormatted response for use in the Optimization stepReturn typestrscaleup.script_utils.escape_name(scenName: str)Escapes a name containing tilde (~) characters, replacing each ~ with &TLD;This is used when generating tilde delimited strings to safely send names which contains tildes.ParametersscenName(str) -- name to be escapedReturnsEscaped version of the input stringReturn typestrscaleup.script_utils.get_file_path(file_name: str, folder_name: Optional[str] = None)Returns the path of a file relative to the current folderParametersfile_name(str) -- the name of the filefolder_name(str*, *optional) -- sub-folder in which the file can be found, defaults to NoneReturnsFull path to the fileReturn typestrscaleup.script_utils.get_run_type(file_name: str)Ascertains the run type of a file based on the extension.Excel models "*.xls(?)" are 1Reaction Lab Models "*.rxm" are 2All others return 0Parametersfile_name(str) -- name of the fileReturns0, 1, or 2, depending on the file extensionReturn typeintscaleup.script_utils.write_result(result, writer=None, separator: str = ',')Write the contents of a script result.
A script result contain have an error message or an array of step results.
If it contains an error message, then this is written
If it contains step results, each result (each of which may contain multiple pages) is written as
lines of values separated by the passed in separator or a comma.If no 'writer' method is passed in, then we print to console.Parametersresult(COM Object) -- Script Result object from RunScript()writer(method) -- Method which takes in a string, if not set, 'print' is used.scaleup.script_utils.write_result_to_file(result, file_name: str, append: bool = True)Write the contents of a script result.
A script result contain have an error message or an array of step results.
If it contains an error message, then this is written
If it contains step results, each result (each of which may contain multiple pages) is written as
lines of values separated by the passed in separator or a comma.If no 'writer' method is passed in, then we print to console.Parametersresult(COM Object) -- Script Result object from RunScript()writer(method) -- Method which takes in a string, if not set, 'print' is used.append(bool) -- Append the output to the file (or overwrite). Default is True (append)Module contents