m = pwAddA(m, *ID, *rhs, description, name, designerProps, classname,
            targetType, compartment, valueType)
 m = pwAddA(m, interactive)

 Adds an algebraic quantity (i.e. an explicit algebraic equation) to a model.
 The equation is evaluated for all time-points.
 Equations which should be applied for a single time-point only
 can be specified using pwAddTE or pwAddU.


  pwAddA(m, lhs, reactants, parameters, signature, type, timePoint, ...
          description, ID, name, ...)
 New for type = 'assignment':
  pwAddA(m, *ID, *rhs, description, name,  ...)
 New for type = 'startValueAssignment': Add a time-event via
  pwAddTE(m, *ID, *targetID, *rhs, eventTime)


Arguments for pwAddA

 ID            ID of the algebraic quantity.
 rhs           Right-hand side comprising IDs of A, X, K, U quantities.
 designerProps Layout information internally used in the model designer.
 targetType    'species', 'parameter', or 'compartment'
               This field is only required for SBML export.
 valueType     'concentration','amount'. Default: 'concentration'

 Alternative function call for interactive specification:
 interactive   If true, the user is prompted to enter the properties
               into a user interface.



 PottersWheel supports explicit algebraic equations, which are evaluated for
 each time-point (technically speaking before every integration step).
 If the assigned quantity is time-dependent, it should be used as a modifier
 in the reactions. Else as a parameter. It is not possible to use algebraic
 quantities as reactants or products or to fit them, since their value is determined
 by the algebraic equation. Likewise, in an ODE-based model an assigned quantity
 may only appear within the right-hand side of the differential equations.

 The right-hand side (rhs) of the algebraic quantity may comprise
 dynamic parameters K, dynamic variables X, driving inputs U,
 and already assigned algebraic quantities A.


Rule-based modeling

 As for pwAddY and pwAddZ, also the rhs of pwAddA may include patterns
 using e.g. # and @. See pwTutorial_Rule_based_modeling and pwAddY
 for more information.


Continuous dependency on time

 In order to make the algebraic equation time-dependent, the reserved
 letter "t" may be used in the right-hand side. It will be replaced by
 the current time-point during model integration.

 Time-discrete dependencies can be handled via pwAddTE or pwAddU.


Difference to SBML

 The notation used within PottersWheel is close to the mathematical
 representation of the dynamical system. The notation of the Systems Biology
 Markup Language (SBML) is closer  to the biochemical representation.

 In PottersWheel, a dynamic variable 'x' is always part of the set of differential
 equations and a dynamic parameter 'k' is always independent from all other parameters
 and can potentially be fitted. Algebraic assignments 'a' are (algebraically)
 calculated based on x, k, u, and other algebraic assignments.

 In SBML, a species is either determined by the
 differential equations, a rate o, or an algebraic equation. A parameter is
 either free or determined by an algebraic equation.

 Compatibility is ensured by specifying the 'targetType' of an algebraic equation
 in PottersWheel. If the target type is not specified, it is guessed by the following
 approach: If the ID appears as a dynamic variable x or driving input u, the target
 type is set to 'species'. If it appears as a parameter in a reaction, it is a 'parameter'.
 It is not allowed to use an assigned quantity as a parameter and a modifier in
 the same model. The guessing can only be applied, if all reactions are known
 before the assignment is added.


Piecewise definition

 The right-hand side may contain piecewise defined functions.

 Time-dependent piecewise functions should be implemented using pwAddU or
 pwAddTE. For other situations, PottersWheel supports the function

  piecewise(value1, condition1, value2, condition2, ..., defaultValue)

 with an arbitrary number of value/condition pairs and one required default value.
 The conditions should be specified using the functions

less thanlt(value1, value2)
greater thangt(value1, value2)
equalseq(value1, value2)
greater or equalge(value1, value2)
less or equalle(value1, value2)
andand(bool1, bool2)
oror(bool1, bool2)
Examples: Returning a value of 1 for a > 5, else 0: piecewise(1, gt(a, 5), 0) Returning b for c < d, e for f >= g, else h: piecewise(b, lt(c, d), e, ge(f, g), h) Complete example: A1 is set to K1 if X1 is smaller than 10. Else A1 is set to K1 * 0.1. m = pwAddA(m, 'A1', 'piecewise(K1, lt(X1, 10), K1 * 0.1)'); It is recommended to reduce the maximum integration step size, in order to accurately detect the event, when a different branch of the piecewise function should be evaluated. Please note that model integration and parameter calibration may be hampered when using piecewise functions, due to the non-analytic properties at the switches. Also, the Jacobian matrices for integration and calibration can not be determined, affecting e.g. the results of the profile likelihood estimation.


 Example 1: Normal assignment

 m = pwAddA(m, 'total_S_in_cytoplasm', 'cS + cpS + 2 * pS_pS');
 m = pwAddA(m, 'total_S_in_nucleus',   'nS + 2 * npS_npS');

 Example 2: Time dependent equation

 It is possible to use t in the rhs,
 e.g. for time dependent compartment sizes as in

 m = pwAddA(m, 'NucleusSize', 'InitialNucleusSize + GrowthRate * t');

 In this example, the parameters 'InitialNucleusSize' and 'GrowthRate'
 are normal parameters defined using pwAddK and can be fitted.

See also