The adoption fraction in our model is constant each period. Actually it changes in a complex way since the demand on our product follows the cycle of the seasons. The peak of the demand is in summer while in winter the product is in little demand. There is also a little peak in adopter activity before the New Year holiday. We want to model the demand cycle and its affect on the adoption fraction in our model.
Assume that we have experimental data how the average demand on the product changes during the year. We will use a table function to add this data to our model. Table function is a function defined in the table form. It returns tabulated values for defined argument values. If the function argument does not correspond to any of the tabulated values, table function computes a value based on the chosen interpolation.
Finally you will see how the demand curve looks in the function's preview chart on the function's properties page:
Now we want to model how the adoption fraction depends on the current demand on the product. Therefore we will define a custom function and replace the AdoptionFraction parameter with the dynamic variable, which value is calculated according to this function.
Define
a function evaluating the adoption fraction
This expression calculates the demand for the current month. Finally, to obtain the adoption fraction value, the demand value is divided on the conversion factor.
getMonth() is AnyLogic predefined function. You can use frequently used functions (sin, time, getDay(), etc.) in your expressions. Entering expressions, you can use code completion, where predefined functions are listed as well as variables.
Finally, we will replace the adoption fraction constant with the dynamic variable evaluating its value with the created function.
Replace
AdoptionFraction
parameter with a dynamic variable
Set DiscardRate to be displayed by the lower time
plot
Set model to stop at time 20 and run the model. You can see that now the behavior of a model deviates above and below an equilibrium point since the adoption rate and the discard rate oscillate.
Reference model: Bass Diffusion - Phase 4