Model.alter#
- Model.alter(src, idx, value, attr='v')[source]#
Alter values of input parameters or constant service.
If the method operates on an input parameter, the new data should be in the same base as that in the input file. This function will convert
value
to per unit in the system base whenever necessary.The values for storing the input data, i.e., the parameter's
vin
field, will be overwritten. As a result, altered values will be reflected in the dumped case file.- Parameters:
- srcstr
The parameter name to alter
- idxstr, float, int
The device to alter
- valuefloat
The desired value
- attrstr
The attribute to alter, default is 'v'.
Notes
New in version 1.9.3: Added the attr parameter and the feature to alter specific attributes. This feature is useful when you need to manipulate parameter values in the system base and ensure that these changes are reflected in the dumped case file.
Examples
>>> import andes >>> ss = andes.load(andes.get_case('5bus/pjm5bus.xlsx'), setup=True) >>> ss.GENCLS.alter(src='M', idx=2, value=1, attr='v') >>> ss.GENCLS.get(src='M', idx=2, attr='v') 3.0 >>> ss.GENCLS.alter(src='M', idx=2, value=1, attr='vin') >>> ss.GENCLS.get(src='M', idx=2, attr='v') 1.0