|
1 | 1 | # Internal
|
2 | 2 |
|
3 | 3 | This chapter documents internal functions that are typically only
|
4 |
| -for use of the developers of package Modia. |
| 4 | +for use of the developers of a model library or of Modia. |
5 | 5 |
|
6 |
| -## Code Generation |
7 |
| - |
8 |
| -This section provides functions to **generate Julia code** of the |
9 |
| -transformed equations. |
| 6 | +## Variables of built-in Components |
10 | 7 |
|
11 | 8 | ```@meta
|
12 | 9 | CurrentModule = Modia
|
13 | 10 | ```
|
14 | 11 |
|
| 12 | +The following functions are provided to define and access new variables |
| 13 | +in built-in components (seee for example model `InsulatedRod2` in `Modia/models/HeatTransfer.jl`). |
| 14 | + |
| 15 | +| Functions | Description | |
| 16 | +|:--------------------------------------------------------|:----------------------------------------------------------------------------------| |
| 17 | +| [`new_x_segmented_variable!`](@ref) | Generate new state variable (`x_segmented` and `der_x_segmented` variables) | |
| 18 | +| [`new_w_segmented_variable!`](@ref) | Generate new local variable (`w_segmented` variable) | |
| 19 | +| [`new_alias_segmented_variable!`](@ref) | Generate new alias variable | |
| 20 | +| [`new_z_segmented_variable!`](@ref) | Generate new zero crossing variables (`z_segmented` variables) | |
| 21 | +| [`get_x_startIndex_from_x_segmented_startIndex`](@ref) | Return start index of `x_segmented` variable with respect to state vector `x` | |
| 22 | +| [`copy_scalar_x_segmented_value_from_state`](@ref) | Return value of scalar `x_segmented` variable from state vector `x` | |
| 23 | +| [`copy_SVector3_x_segmented_value_from_state`](@ref) | Return value of `SVector{3,FloatType}` x_segmented variable from state vector `x` | |
| 24 | +| [`copy_Vector_x_segmented_value_from_state`](@ref) | Return value of `Vector{FloatType}` x_segmented variable from state vector `x` | |
| 25 | +| [`copy_der_x_segmented_value_to_state`](@ref) | Copy value of `der_x_segmented` variable to state derivative vector `der(x)` | |
| 26 | +| [`copy_w_segmented_value_to_result`](@ref) | Copy value of local variable (`w-segmented`) to result | |
| 27 | + |
| 28 | + |
15 | 29 | ```@docs
|
16 |
| -SimulationModel |
17 |
| -generate_getDerivatives! |
18 |
| -init! |
19 |
| -outputs! |
20 |
| -terminate! |
21 |
| -derivatives! |
22 |
| -DAEresidualsForODE! |
23 |
| -affectEvent! |
24 |
| -zeroCrossings! |
25 |
| -affectStateEvent! |
26 |
| -timeEventCondition! |
27 |
| -affectTimeEvent! |
28 |
| -addToResult! |
29 |
| -getFloatType |
30 |
| -measurementToString |
| 30 | +new_x_segmented_variable! |
| 31 | +new_w_segmented_variable! |
| 32 | +new_alias_segmented_variable! |
| 33 | +new_z_segmented_variable! |
| 34 | +get_x_startIndex_from_x_segmented_startIndex |
| 35 | +copy_scalar_x_segmented_value_from_state |
| 36 | +copy_SVector3_x_segmented_value_from_state |
| 37 | +copy_Vector_x_segmented_value_from_state |
| 38 | +copy_der_x_segmented_value_to_state |
| 39 | +copy_w_segmented_value_to_result |
31 | 40 | ```
|
32 | 41 |
|
33 |
| -## Inquiries in Model |
| 42 | +## Inquiries in built-in Components |
34 | 43 |
|
35 |
| -The functions in this section can be called in the model code or in |
36 |
| -functions that are called from the model code. |
| 44 | +The following functions are provided to inquire properties |
| 45 | +in built-in components at the current state of the simulation |
| 46 | +(see for example model `InsulatedRod2` in `Modia/models/HeatTransfer.jl`). |
37 | 47 |
|
38 | 48 | ```@docs
|
39 | 49 | isInitial
|
| 50 | +isFirstInitialOfAllSegments |
40 | 51 | isTerminal
|
| 52 | +isTerminalOfAllSegments |
41 | 53 | isEvent
|
42 | 54 | isFirstEventIteration
|
43 | 55 | isFirstEventIterationDirectlyAfterInitial
|
| 56 | +isFullRestart |
44 | 57 | isAfterSimulationStart
|
45 | 58 | isZeroCrossing
|
46 | 59 | storeResults
|
47 | 60 | getTime
|
48 | 61 | ```
|
49 | 62 |
|
50 |
| -## Variable definitions in functions |
| 63 | +## Code Generation |
51 | 64 |
|
52 |
| -The following functions can be used to define states and algebraic variables inside functions: |
| 65 | +This section lists internal functions to **generate Julia code** of the |
| 66 | +transformed equations. |
53 | 67 |
|
54 |
| -```@docs |
55 |
| -new_x_segmented_variable! |
56 |
| -new_w_segmented_variable! |
57 |
| -new_alias_segmented_variable! |
58 |
| -new_z_segmented_variable! |
59 |
| -get_x_startIndex_from_x_segmented_startIndex |
60 |
| -get_scalar_x_segmented_value |
61 |
| -get_SVector3_x_segmented_value |
62 |
| -get_Vector_x_segmented_value! |
63 |
| -add_der_x_segmented_value! |
64 |
| -add_w_segmented_value! |
| 68 | +```@meta |
| 69 | +CurrentModule = Modia |
65 | 70 | ```
|
66 | 71 |
|
| 72 | +```@docs |
| 73 | +InstantiatedModel |
| 74 | +generate_getDerivatives! |
| 75 | +init! |
| 76 | +outputs! |
| 77 | +terminate! |
| 78 | +derivatives! |
| 79 | +DAEresidualsForODE! |
| 80 | +affectEvent! |
| 81 | +zeroCrossings! |
| 82 | +affectStateEvent! |
| 83 | +timeEventCondition! |
| 84 | +affectTimeEvent! |
| 85 | +addToResult! |
| 86 | +getFloatType |
| 87 | +measurementToString |
| 88 | +``` |
67 | 89 |
|
68 | 90 |
|
69 | 91 |
|
|
0 commit comments