Toto je starší verze dokumentu!
Definovať spustiteľný simulátor je možné pomocou SimCompoment-u ako komponentového stromu. Je to zloženie základných komponent, ktorých vstupy a výstupy sú navzájom prepojené. Základná komponenta (list stromu) môže byť dvoch druhov.
Je dobré si uvedomiť, že pri práci s definíciami komponent a ich prepojení sa nepracuje s hodnotami premenných(resp. udalostí). Hodnotu premennej(resp. udalosti) za behu aplikácie je lepšie držať pevne v rukách komponenty, ktorá danú hodnotu vytvorila(v prípade udalostí je to komponenta, ktorá dané udalosti spracováva). Ukazuje sa, že nie je nutné ani vhodné aby túto hodnotu menili iné komponenty. Inštancia základnej komponenty tak definuje v SimKernel-e každú jej výstupnú premennú(resp. poslucháča udalostí) avšak nedefinuje v SimKernel-e žiadne vstupné premenné (resp. samotnú hodnotu udalosti). Prepojenie výstupných premenných na vstupné zabezpečujú atribúty „inputRef“ a „outputRef“. Hodnotou atribútu je lokálny názov vstupu spolu so skupinovým názvom výstupu. Prepojenie udalostí(outputEvent) na poslucháčov udalostí(inputEvents) zabezpečujú atribúty „inputEventsRefs“ a „outputEventsRefs“. Hodnotou atribútu je lokálny názov udalosti spolu so skupinovým názvom poslucháča. Premenné skupiny je z pohľadu z vnútra skupiny nutné chápať obrátene, tak aby platilo: vonkajší výstup zo skupiny je výstupom z jej potomka(output), vonkajší vstup do skupiny je napojený na vstupy potomkov(inputs), vonkajší poslucháč skupiny je poslucháčom potomoka(inputEvents), vonkajšia udalosť skupiny je napojená na udalosti potomkov(outputEvents).
Na jednom SimKernel-u môže v jeden moment bežať viacero inštancií viacerých aplikácií. V tomto režime, keď SimKernel beží nonstop ako služba je nutné riešiť réžie s rôznymi časťami =komponentmi rôznych aplikácií.
Definície SimComponent
SimKernel request | answer type | description |
---|---|---|
get(1) | long[] | Pointer array to component definitions identificators. |
get(get(1)[i]) | long[] | Pointer array to attributes identificators of i-th component definition . |
get(get(get(1)[i])[0]) | long[] | Instances of i-th component definition. |
get(get(get(1)[i])[0]) | long[] | Pointer array to component instances of i-th component definition. |
get(get(get(get(1)[i])[0])[j]) | long[] | Pointer array to attributes identificators (j-th component instance,i-th component definition). |
get(get(get(get(get(1)[i])[0])[j])[0]) | byte[] | InputEvents current mask of last events requests (j-th component instance,i-th component definition). |
get(get(get(get(get(1)[i])[0])[j])[1]) | long[] | Pointer array to children component instances identificators (j-th component instance,i-th component definition). Only for node! |
get(get(get(get(get(1)[i])[0])[j]))[1])[k] | long | ChildID k-th child component instance identificator (j-th component instance,i-th component definition). Only for node! |
get(get(get(get(get(1)[i])[0])[j]))[2+m]) | byte[] | Output current value of m-th output variable (j-th component instance,i-th component definition). |
get(get(get(1)[i])[1]) | string | Name of i-th component definition. |
get(get(get(1)[i])[2]) | string[] | Input names of i-th component definition. |
get(get(get(1)[i])[3]) | string[] | Output names of i-th component definition. |
get(get(get(1)[i])[4]) | string[] | Shared names of i-th component definition. |
get(get(get(1)[i])[5]) | string[] | InputEvent names of i-th component definition. |
get(get(get(1)[i])[6]) | string[] | OutputEvent names of i-th component definition. |
get(get(get(1)[i])[7]) | string[] | Bus names of i-th component definition . |
get(get(1)[i])[8] | long | BaseID pointer to base definition if this is extension, -1 otherwise. |
get(get(1)[i])[9] | long | EnvironmentInstID pointer to environment driver instance of i-th component definition. |
get(get(get(1)[i])[10])) | int[] | OutputFromRef of i-th component definition. Only for node! |
get(get(get(1)[i])[10])[0+k*3] | int | Index of child from which is k-th output connected (internal variable connection in i-th component definition). |
get(get(get(1)[i])[10])[1+k*3] | int | Index of bus(or -1) from which is k-th output connected (internal variable connection in i-th component definition). |
get(get(get(1)[i])[10])[2+k*3] | int | Index of output from which is k-th output connected (internal variable connection in i-th component definition). |
get(get(get(1)[i])[11]) | long[] | InputEventToRefs as pointer array to identificators of internal event connections in i-th component definition. Only for node! |
get(get(get(get(1)[i])[11])[m])[0+n*3] | int | Indexes of child to which is m-th input event connected (internal event connection in i-th component definition). |
get(get(get(get(1)[i])[11])[m])[1+n*3] | int | Indexes of bus(or -1) to which is m-th input event connected (internal event connection in i-th component definition). |
get(get(get(get(1)[i])[11])[m])[2+n*3] | int | Indexes of input event to which is m-th input event connected (internal event connection in i-th component definition). |
get(get(get(1)[i])[12]) | long[] | BusOutputFromRef of i-th component definition . |
get(get(get(1)[i])[12])[0+k*4] | int | Bus index of variable. |
get(get(get(1)[i])[12])[1+k*4] | int | Index of child from which is bus output connected (internal variable connection in i-th component definition). |
get(get(get(1)[i])[12])[2+k*4] | int | Index of bus(or -1) from which is bus output connected (internal variable connection in i-th component definition). |
get(get(get(1)[i])[12])[3+k*4] | int | Index of output from which is bus output connected (internal variable connection in i-th component definition). |
get(get(get(1)[i])[13]) | long[] | BusInputEventToRefs of i-th component definition . |
get(get(get(get(1)[i])[13])[m])[0+n*4] | int | Bus index of variable. |
get(get(get(get(1)[i])[13])[m])[1+n*4] | int | Indexes of child to which is bus input event connected (internal event connection in i-th component definition). |
get(get(get(get(1)[i])[13])[m])[2+n*4] | int | Indexes of bus(or -1) to which is bus input event connected (internal event connection in i-th component definition). |
get(get(get(get(1)[i])[13])[m])[3+n*4] | int | Indexes of input event to which is bus input event connected (internal event connection in i-th component definition). |
get(get(get(1)[i])[14+j*6]) | string | LocalName of j-th child in i-th component definition . |
get(get(1)[i])[15+j*6] | long | CompDefID component definition identificator of j-th child in i-th component definition . |
get(get(get(1)[i])[16+j*6]) | int[] | InputFromToRef of j-th child input variables connections in i-th component definition. |
get(get(get(1)[i])[16+j*6])[0+k*3] | int | Index of sibling (resp. -1 for parent) from which is k-th input connected (variable connection of j-th child in i-th component definition. |
get(get(get(1)[i])[16+j*6])[1+k*3] | int | Index of bus (or -1) from which is k-th input connected (variable connection of j-th child in i-th component definition. |
get(get(get(1)[i])[16+j*6])[2+k*3] | int | Index of output (resp. parent's input) variable from which is k-th input connected (variable connection of j-th child in i-th component definition. |
get(get(get(1)[i])[17+j*6]) | int[] | SharedEqualRef as parent shared variable indexes for each local shared variable of j-th child in i-th component definition. |
get(get(get(1)[i])[17+j*6])[0+2*s] | int | Parent bus (or -1) of shared variable for s-th local shared variable of j-th child in i-th component definition. |
get(get(get(1)[i])[17+j*6])[1+2*s] | int | Parent shared variable index(resp. -1 if not sharing above) for s-th local shared variable of j-th child in i-th component definition. |
get(get(get(1)[i])[18+j*6]) | long[] | OutputEventToRefs as pointer array to identificators of j-th child output event connections in i-th component definition). |
get(get(get(get(1)[i])[18+j*6])[m])[0+n*3] | int | Indexes of siblings (res. -1 for parent) to which is m-th input event connected (event connection of j-th child in i-th component definition). |
get(get(get(get(1)[i])[18+j*6])[m])[1+n*3] | int | Indexes of buses (or -1) to which is m-th input event connected (event connection of j-th child in i-th component definition). |
get(get(get(get(1)[i])[18+j*6])[m])[2+n*3] | int | Indexes of input event (resp. output event indexes for parent) to which is m-th output event connected (event connection of j-th child in i-th component definition). |
get(get(get(1)[i])[19+j*6]) | int[] | BusEqualRef as pointer array to bus indexes for each bus of j-th child in i-th component definition. |
get(get(get(get(1)[i])[19+j*6])[m])[0+b*2] | int | Indexes of siblings (res. -1 for parent) to which is b-th bus connected (bus connection of j-th child in i-th component definition). |
get(get(get(get(1)[i])[19+j*6])[m])[1+b*2] | int | Indexes of buses to which is b-th bus connected (bus connection of j-th child in i-th component definition). |
Dátové typy
type | description |
---|---|
double | 64 bitové číslo s desatinnou čiarkou v little endian |
long | 64 bitové celé číslo v little endian |
int | 32 bitové celé číslo v little endian |
string | pole 8 bitových znakov v UTF-8 zakončené nulou |
long[] | pole typu long |
string[] | pole typu string |
int[] | pole typu int |
double[] | pole typu double |
byte[] | pole bajtov ako univerzálny typ |
Prvým komponentom je vždy SimSystem, ktorý umožní definovanie ďalších komponent, spúšťanie ich inštancií a registrovanie spustenej inštancie ako ovládač pre konkrétne prostredie (SimEnvironmentDriver). Každé prostredie, ktoré bude chcieť plne podporovať služby SimKernel-u bude implementovať rozhranie SimEnvironmentDriver, ktoré bude podporovať spúšťanie inštancií komponentu daného prostredia podľa jeho definície sprostredkovane cez inštanciu SimSystem.
Komponentové stromy, ktorých všetky komponenty sú v zaregistrovaných prostrediach, je možné spúšťať jednotným príkazom (START:SimSystem:inputEvent), ktorý vyžaduje na vstup názov definície komponenty (compDefName:SimSystem:input, prípadne localName:SimSystem:input alebo globalName:SimSystem:input) a na výstup poskytuje číslo inštancie komponentu (compID:SimSystem:output). Po vytvorení komponent je ich možné spájať (RECONNECT:SimComponent:inputEvent), keď sú známe všetky zdielané premenné (sharedIDs:SimComponent:input) a všetky identifikátory súrodeneckých komponent (siblingIDs:SimComponent:input, a prípadne aj siblingIdx:SimComponent:input v prípade, keď sa znova prepája len jedna komponenta).