modelLinearInteraction
Extends from Interfaces.Basics.GenericFlow (Flow Template with two FlowPorts), Interfaces.Basics.Interaction4SO (Output connectors for interaction elements reporting rates), Icons.Interaction (Icon for interactional flow classes).
Information
This information is part of the Business Simulation Library (BSL). Please support this work and ► donate.
The LinearInteraction component allows to model the interaction between two stocks A (portA) and B (portB) as linear equations:
Note: Capital letters were chosen to represent the stocks (state variables) connected at portA and portB in the formula above. Also dot notation is used for a stock's rate of flow—its first derivative with respect to time.
| Coefficient | Unit | Description |
|---|---|---|
a_0 |
base units for flow to A ( |
Rate of growth for stock A |
|
|
base units for flow to B ( |
Rate of growth for stock B |
|
|
1/s |
Fractional rate of growth for stock A |
|
|
1/s |
Fractional rate of growth for stock B |
|
|
base units for flow to A ( |
Rate of growth for stock A per stock B |
|
|
base units for flow to B ( |
Rate of growth for stock B per stock A |
The coefficients can be given as parameters or as variables via the expandable connector dataIn.
Examples
A linear harmonic oscillator can be modeled as a special case of linear interactions where the rates for the mutual influences (e.g., fractionalGrowthRate_B_per_A and fractionalGrowthRate_A_per_B) are negative. In that case, positive stock A will decrease stock B and vice versa.
The Linear Interaction can be used to model Strogatz' famous model for the dynamics of a love affair (conspicuously between "Romeo" and "Juliet") as shown in →LoveHateDynamics [16].
Notes
- The type selectors
OutputType_AandOutputType_Bwill be used to conveniently set the types, e.g., units, of the parametersa_0,a_Bandb_0, b_A. - The coupling coefficient
a_Bmight have rather convoluted units, e.g.,base units of A/(base units of B.s). For convenient modeling,a_Bwill be divided byrefB, which allows to usedisplayUnitshould unit conversion be required. SinceTypeBby default is set toUnspecifiedin most cases nothing needs to be done. - This will, conversely, also apply to
b_A.
See also
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| OutputType_A | a_0 | unspecified | Constant rate of growth for stock A [OutputType_A] |
| OutputType_B | b_0 | unspecified | Constant rate of growth for stock B [OutputType_B] |
| Rate | a_A | unspecified | Constant fractional rate of growth for stock A (self-coupling) |
| Rate | b_B | unspecified | Constant fractional rate of growth for stock B (self-coupling) |
| OutputType_A | a_B | unspecified | Constant rate of growth for stock A per reference units of B (coupling B to A) |
| TypeB | refB | 1 | Reference value for B, i.e., divisor for a_B |
| OutputType_B | b_A | unspecified | Constant rate of growth for stock B per reference units of A (coupling A to B) |
| TypeA | refA | 1 | Reference value for A, i.e., divisor for b_A |
| Structural Parameters | |||
| Boolean | hasConstantGrowthRates | false | = true, if the linear growth rates are given by constant parameters |
| Boolean | hasConstantFractionalGrowthRates | false | = true, if the fractional growth rates are given by constant parameters |
| Boolean | hasConstantCouplingCoefficients | false | = true, if the induced growth rates are given by constant parameters |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Connectors.FlowPort | portA (from GenericFlow) | Flow from/to Stock A | |
| Connectors.FlowPort | portB (from GenericFlow) | Flow to/from Stock B | |
| RealOutput_B | y_B (from Interaction4SO) | Rate for flow to and from B (positive value indicates inflow) | |
| RealOutput_B | y1_B (from Interaction4SO) | Rate for flow to and from B (positive value indicates inflow) | |
| RealOutput_A | y1_A (from Interaction4SO) | Rate for flow to and from A (positive value indicates inflow) | |
| RealOutput_A | y_A (from Interaction4SO) | Rate for flow to and from A (positive value indicates inflow) | |
| Input_Connector | dataIn | Continuous inputs for the component |
Contents
| Name | Description |
|---|---|
| TypeA | Type selector for stock A (default = Unspecified) |
| TypeB | Type selector for stock B (default = Unspecified) |
| Data bus for inputs |
Revisions
Input_Connectordefined asencapsulated expandable connectorin v2.1.0.- Values for optional parameters changed to
unspecifiedin v2.1.0. - Adapted types and added divisors for compliance with unit checking and convenient unit conversions in v2.2.