Data sharing between models
A model may share data with its submodels under certain conditions: any initialisation performed by the master model on these shared entities is available to the submodels at their startup and any modification carried out by both the master model and its submodels are effective for all models.
Entities to be shared must be global and identified by the declaration qualifier shared (they do not need to be public). Only scalars of basic types and native types supporting sharing, as well as sets, lists and arrays of basic types can be shared. For the arrays, index sets must be either shared or constants of basic types, shared hashmap arrays cannot have more than 1 dimension.
declarations sci: shared integer ss: shared set of string sa: shared dynamic array(ss,1..2) of real end-declarations
Data sharing is possible only between a model (the master model) and its clones (i.e. submodels loaded from the running model see load). The master model can manipulate its shared entities just like any other data structure as long as no compatible submodel is running. However, as soon as a submodel using shared data is started the sharing mode is enabled and access to shared entities is altered as follows: sets and lists behave as if they were constant, the structure of arrays is locked (i.e. it is no longer possible to add or remove cells of sparse arrays). Normal access to shared entities is restored when all submodels using them are reset (reset) or unloaded (unload). The current status of the sharing mode can be obtained from the sharingstatus control parameter (getparam).
model "shared example" uses 'mmjobs' declarations a: shared array(1..3) of integer m: Model end-declarations if getparam("sharingstatus")<>2 then ! in master model ('a' is empty) forall(i in 1..3) a(i):=i ! initialise 'a' writeln("master:",a) ! output: master:[1,2,3] load(m) ! clone master then run it run(m) waitforend(m) ! wait for its termination writeln("aftersub:",a) ! output: aftersub:[2,3,4] else ! in submodel ('a' is already initialised) writeln("sub:",a) ! output: sub:[1,2,3] forall(i in 1..3) a(i)+=1 ! modify 'a' end-if end-model
© 2001-2021 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.