-
Notifications
You must be signed in to change notification settings - Fork 277
Open
Labels
Priority:NormalNormal Priority Issue or PRNormal Priority Issue or PR
Description
Scaling factors forScaling hints are available on theExpressionshave been deprecated. I have a system of scaling hints for Expressions available on a branchscaling_toolboxfeature branch.- The team decided that the distinction between mutable class attributes
scaler.DEFAULT_SCALING_FACTORSandscaler.UNIT_SCALING_FACTORSand their local copiesscaler.default_scaling_factorsandscaler.unit_scaling_factorsshould be handled via documentation. This documentation needs to be written. - The scaling API doesn't allow us to filter
scaler.default_scaling_factorsfor unused inputs (either because a modeler forgot to perform scaling or because a user wanted to set some default value), nor does it allow us to apply all default scaling factors automatically. The scaling API doesn't give us an easy way to communicate to the user which scaling factors they need to set on their own.On thescaling_toolbox feature branch, we can add entries to theDEFAULT_SCALING_FACTOR` dictionary that either we recommend the user scale a property on their own, or that a user is required to set a scaling factor or else an exception is thrown.In order to do handle property packages of any complexity, we need scaling factors for more than just the state variables, yet the scaling API doesn't give us a method to solicit the user for such scaling factors, and the reliance onThe user will be solicited for these scaling factors via theCustomScalerBase.propagate_state_scalingprevents us from rolling out such scaling factors in a general manner.DEFUALT_SCALING_FACTORdictionary. There is still the problem that the user needs to create a scaler object for their property package, then create aComponentMaptelling every unit model scaler object to use that property package scaler object.- Order-of-magnitude scaling for variables is harmful, yet the entire API guides the user towards using it.
- Scaler objects rely on a
ComponentMapto handle submodel scalers. However, this means that, if we want to scale several units in series or parallel in the same way, we need to create fresh component maps for each unit. - There is no validation that every submodel scaler in the
ComponentMapis called. That means that, if a user were to try to apply the same scaling to several units with the sameComponentMap, the submodel scalers would not be used and the user would not be alerted to this fact. - Pyomo currently issues warnings if an element of a scaling suffix is not exported. However, this applies not just to
Expressionsbut also fixedVarsand deactivatedConstraints. This means that the user is going to be bombarded with warnings if they use a scaled model during initialization. We could turn off these warnings globally, but that raises the question about why they exist in the first place. Any fix will have to happen from @jsiirola or others on the Pyomo side of things. - Presently
get_scaling_factorworks by getting the parent block's suffix directly and looking for scaling factors set there. However, Pyomo allows for scaling factors for a component to be set in any block. Furthermore,get_scaling_factorreturns a value regardless of whether the scaling suffix has been deactivated or not. Also, Pyomo allows the user to set scaling factors for indexed variables/constraints, but ifget_scaling_factoris called on aVarData/ConstraintDatachild of an indexed variable/constraint, no value will be returned. Updatingget_scaling_factorto use the Pyomo suffix finder should solve all of these issues. - The scaling tutorials encourage the user to set scaling factors on the suffix directly. We should encourage them to use the
set_scaling_factorfunction instead. - Related to (7) and (8), submodel scalers cannot be given for indexed
Blocksbut must instead be given forBlockDatachildren. That meanssubmodel_scalers[m.fs.unit.control_volume.properties_in] = PropertyScaler()results in that property scaler being silently ignored. - Scaler objects have config settings for maximum and minimum scaling factors. These config options are necessary to accommodate the autoscaling methods. However, they also silently override user scaling. This is guaranteed to cause problems in PrOMMiS, where variables and constraints need extreme scaling factors when expressed in SI units.
- Presently, the
get_default_scaling_factormethod uses the component finder on the component's parent block when screening for default scaling factors. However, this method runs into a problem when we try to scale a submodel's variables. For example, theHeatExchanger1Dhas both theunit.areavariable for the heat exchange area as well asunit.hot_side.areaandunit.cold_side.areafor the cross sectional area for fluid flow. Right now all of these will look at thedefault_scaling_factors["area"]entry, when we'd like the latter two to look todefault_scaling_factors["hot_side.area"]anddefault_scaling_factors["cold_side.area"]instead.
Metadata
Metadata
Assignees
Labels
Priority:NormalNormal Priority Issue or PRNormal Priority Issue or PR