Generated reference › Pressure Altitude — Robotics/Atmosphere
kind: generated#block#robotics-atmosphere

Pressure Altitude — Robotics/Atmosphere

P → h

Robotics/Atmosphere/Pressure_Altitude · 1 input / 1 output port(s) at insert · exports to Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Description#

The block's own DESCRIPTION_HTML, rendered verbatim — the same text the config dialog's info panel and the library navigator show. Fix a wrong sentence in the block's .cpp (R-D9), never here.

Pressure Altitude

Robotics / Atmosphere

Converts a static pressure into the pressure altitude – the geopotential altitude at which the 1976 COESA-extended U.S. Standard Atmosphere holds that pressure. It is what an altimeter set to the standard datum of 1013.25 hPa displays, and it is the inverse of the pressure column that COESA Atmosphere produces.

Inside the layer the pressure falls in, with base altitude h₀, base pressure p₀, base temperature T₀, lapse rate L and GMR = g₀M/R*, and writing r = p/p₀:

  • h = h₀ + ((1 − rL/GMR) / (L·rL/GMR))·T₀ on a layer with a lapse rate
  • h = h₀ − (T₀/GMR)·ln r on an isothermal layer

Ports

  • P – the static pressure, in pascals. Any size [m,n]; the block works entry by entry.
  • h – the pressure altitude, in metres of geopotential altitude. Same size as the input.

Parameters

  • Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.

The atmosphere itself has no parameters: the 1976 standard fixes every breakpoint, lapse rate and constant, which is exactly what makes a pressure altitude a shared datum rather than a setting. A block whose constants you want to choose is ISA Atmosphere.

Code export

All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text.

The seven layers are unrolled into the emitted arithmetic at export time rather than shipped as a table: which layer a pressure falls in is a comparison chain, and each branch then carries only its own four constants. They are printed at 17 significant digits, so all ten backends and this block's own simulation compute with the same doubles.

The three hardware targets are simulation-only: a power with a fractional exponent and a logarithm have no Q16.16 form, so values convert at the port boundary and the arithmetic runs in floating point. And a fixed-point port cannot carry a sea-level pressure at all – Q16.16 saturates past about 32767, while standard sea level is 101325 – so a hardware export of this block is for the thin part of the atmosphere, above roughly 9 km, where both the pressure and the altitude fit.

Simulink bridge

Import and export, mapped to Aerospace Blockset's aerolibatmos2/Pressure Altitude. The block has no configuration to carry, so no parameter pairs cross.

Two Simulink parameters are always implied: units is always Metric (MKS), this block being metric throughout, and action is always None – that parameter only chooses whether Simulink warns when a pressure leaves the table's range, and ICore reports nothing there. The Simulink block defines no SampleTime parameter, measured, so the rate stays on the ICore side.

Notes

  • Algebraic and stateless: the output depends on this sample alone.
  • Not linear, so the block carries no state space and model reduction correctly reports it as unmergeable.
  • Nothing clamps at either end. A pressure above 101325 Pa answers a negative altitude and one below the top of the table extrapolates the last layer – which is what the reference implementation does, and not what a real altimeter would do.
  • A pressure of zero or less answers 0, where the reference answers a NaN. The divergence is forced rather than chosen: VHDL's LOG and its real ** assert on a non-positive argument, which aborts a simulation rather than producing a bad number, so the guard has to exist and all ten targets carry the same one.
  • Verified against R2026a over fourteen pressures from 200000 Pa down to 0.1 Pa: thirteen agree to the last bit and the fourteenth by one unit in the last place.

Code facts#

FactValue
registered typeRobotics/Atmosphere/Pressure_Altitude
familyRobotics/Atmosphere
solver environment classICoreBlock_0_Robotics_1_Atmosphere_2_Pressure_Altitude
sourcesrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Robotics/Atmosphere/Pressure_Altitude/ICoreBlock_0_Robotics_1_Atmosphere_2_Pressure_Altitude.cpp
headersrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Robotics/Atmosphere/Pressure_Altitude/ICoreBlock_0_Robotics_1_Atmosphere_2_Pressure_Altitude.h
default size on canvas150 × 78 px
ports at insert1 in, 1 out
code generators implementedPython, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Ports#

#DirectionSignal typeDescription label
1inICoreDoubleP
2outICoreDoubleh

Ports the constructor creates. A block whose port list changes with its configuration adds or removes ports at load time; the count above is the one a freshly inserted block has.

Configuration variables#

No config variable beyond the Sampling Time (s) every block carries.

Every block also carries Sampling Time (s) from ICoreBlockSolverEnvironment: zero or less inherits the solver's rate, a positive value runs the block at that period.

supportSupport::Both
Simulink pathaerolibatmos2/Pressure Altitude
port-count rulePortsParam::None
SampleTime parameterno — the counterpart defines none; the rate stays on the ICore side
always setunits = Metric (MKS), action = None

Caveat (shown to the user): the pressure is in PASCALS and the altitude in METRES of geopotential altitude. 'units' is always written as Metric (MKS) because this block is metric throughout, and 'action' as None: that parameter only chooses whether Simulink warns when a pressure leaves the table's range, and ICore reports nothing there. The Simulink block has no SampleTime parameter, so the rate stays on the ICore side

Catalog contract: src/ICoreBlocks/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h

Description vs code#

The lists agree. check_block_descriptions.py finds no disagreement between the description's Ports, Parameters, Code export and Simulink bridge lists and the code's.

The verdict above is tools/docs/check_block_descriptions.py (P7.1), which compares LISTS. It cannot read a sentence: "stateless" on a block with a state, an initial-value semantic the recursion does not implement, a "not synthesizable" caveat the HDL banner contradicts. That is the agent audit (P7.3) on BLOCK_DESCRIPTION_AUDIT.md, and this tool's green is not a substitute for one.

File banner (developer view)#

The top comment of the block's .cpp — the maths, the realization and the export strategy, addressed to whoever changes it. It must not contradict the description above (P7.5).

Pressure Altitude -- the 1976 COESA standard atmosphere's pressure column, read backwards r = p / p0 p0, h0, T0 and L are the layer's base state h = h0 + ((1 - r^(L/GMR)) / (L * r^(L/GMR))) * T0 layer with a lapse rate h = h0 - (T0 / GMR) * ln(r) isothermal layer

The seven layers live in ICoreCoesa1976Support, shared with COESA Atmosphere, which reads the same table the other way. Every constant the export targets carry is printed from that table at 17 significant digits, so the ten of them and this block's own simulation share one set of numbers rather than ten transcriptions.

⚠ THE ANSWER WAS MEASURED, NOT DERIVED. Driven against R2026a's own block over fourteen pressures spanning 200000 Pa down to 0.1 Pa, thirteen agree TO THE LAST BIT and the fourteenth differs by one unit in the last place -- a difference in the reference's own power routine, not in the arrangement, and six orders of magnitude below the tolerance any suite here applies.

⚠ THE LAYER TEST IS <=, NOT <. A pressure sitting exactly on a breakpoint belongs to the layer ABOVE it. Both branches then answer that breakpoint's altitude exactly -- the ratio is 1, so the lapse form's numerator is exactly zero and the isothermal form's logarithm is exactly zero -- which is why no branch tests for the equality: it cannot change an answer.

⚠ A PRESSURE OF ZERO OR LESS ANSWERS 0 WHERE THE REFERENCE ANSWERS NaN, and the divergence is forced rather than chosen: VHDL's LOG and its real "**" ASSERT on a non-positive argument, aborting a simulation instead of producing a bad number. The guard therefore has to exist, and all ten targets and this file carry the same one.

ALGEBRAIC and STATELESS, and nonlinear in its input, so no state space.

Sample results#

Pressure Altitude — Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per samplePressure Altitude — Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample02e44e46e48e4-2-10123inputoutput
tin ICoreDouble-Out-0out ICoreDouble-Out-0
0-20
0.40.58.324e4
0.8-20
1.20.58.324e4
1.6-20
20.58.324e4
2.4-20
2.80.58.324e4
3.2-20
3.60.58.324e4
4-20
4.40.58.324e4
4.8-20
5.20.58.324e4

Every 4th of 60 samples, from the table stimulus.

The same rig also ran:

StimulusWhat it isOutput range
impulseImpulse: one sample of 1 at k = 5, 0 elsewhere (Repeating Sequence Stair)0 … 7.93e4
rampRamp: slope 1 from t = 00 … 9.179e4
sineSine Wave: amplitude 1, 2 rad/s, no phase, no bias0 … 9.858e4
stepStep: 0 -> 1 at t = 1 s0 … 7.93e4

Plotted: table — Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample

Category static · sample time 0.1 · 60 steps · commit 7df85021459493e38f84f64127a6774c411e769c · produced by docsSample --out <folder> --blocks COESA_Atmosphere ISA_Atmosphere Pressure_Altitude --steps 60 · data docs/generated/samples/Robotics__Atmosphere__Pressure_Altitude.json · the SVG is generated from those numbers by tools/docs/plot_svg.py, so it is a run and not a drawing (R-D10).