|
FhSim
3.1.0
Marine systems simulation
|
The <INITIALIZATION> section sets the initial states of SimObjects before the simulation begins.
Initial conditions are specified as attributes of an <InitialCondition> tag:
Each attribute has the form:
<InitialCondition> tag, it is initialised to zero.InitialConditionSetup() to compute initial states from their parameters or input ports (e.g. a cable computing node positions from its endpoints). These run after the XML initial conditions are applied.Initial condition values can use $Variable references defined in the VARIABLES section, and are then passed through the arithmetic evaluator:
Both apply to <InitialCondition> attributes only — not to <FromFile> or its <State> children. See Arithmetic in attribute values for exactly when a value is treated as an expression, and for the six-significant-digit rounding that comes with it.
For large models with many repeated elements (e.g. discretised cables or chains), initial conditions can be loaded from a binary file using <FromFile>.
| Attribute | Required | Description |
|---|---|---|
SimObjectName | Yes | Name of the target SimObject. |
FileName | Yes | Path to the binary file. Relative paths resolve against the working directory — see Path resolution. A missing file stops the run. |
Each <State> element describes one block of state data in the binary file:
| Attribute | Required | Description |
|---|---|---|
Name | Yes | Base name of the state (e.g. "Position"). |
Dimension | Yes | Number of doubles per element (e.g. 3 for a 3D vector). |
Range | Yes | Integer range "start,end" — reads elements start to end-1. Both indices are required. |
The binary file contains raw double values in sequence. For each <State> element, FhSim reads (end - start) × Dimension doubles and assigns them to the states named Name_start, Name_(start+1), ..., Name_(end-1), each holding Dimension values.
Range, not a position counted from zero. Range="0,100" fills Position_0 … Position_99, but Range="50,100" fills Position_50 … Position_99 from the first bytes of its block — it does not skip 50 elements of the file.The file is read sequentially: <State> elements must appear in the same order as the data was written to the file. If the file ends before the declared Dimension and Range have been satisfied, the run stops with an error naming the state it was reading.
InitialConditionSetup() details.FileName is relative to.