These functions draw the common aeronautical diagrams as SVG drawings using an SvgScene: the runway wind diagram on the departure and destination pages, the fuel and time diagram on the enroute page, and the weight and balance diagram on the weight and balance page.
Each function is designed to be assigned as the value of an svg state variable. The state variable calls the function with the wrapper DOM node of the drawing, and the function renders the diagram into the node by setting its innerHTML. If node is falsy, nothing is drawn. The functions read the current state variable values when called, so the drawing must be re-rendered by assigning the function to the state variable again when its inputs change. For example:
io.dep_runwayDiagram.value = (node) => drawRunwaySvg(node, 'dep');
The diagrams use the dark mode setting (nav_darkMode state variable) to select the text and line colors.
The diagram functions are available for import from common/aero/export.js.
drawEnrtDiagramSvg() drawEnrtDiagramSvg(node, io)
Draws the enroute fuel and time diagram into node. The diagram has a horizontal fuel bar and a horizontal time bar that both span from zero fuel to the fuel on board (FOB). Between the bars, the fuel on board is divided into colored zones:
If the fuel on board is less than the minimum reserve, the whole bar is red. If the required values are not valid, the bar area is grey.
A solid blue line marks the fuel (and time) to the destination, with boxes showing the fuel to the destination and the estimated time enroute. It is drawn if the fuel remaining at the destination is at least the minimum reserve. A dotted blue line marks the fuel to the alternate airport. It is drawn if the fuel at the alternate is at least the minimum reserve, the alternate is farther than the destination, and the alternate reserve is at least the minimum reserve. The labels at the ends of the bars show the zero values, the fuel on board and the endurance.
nodesvg state variable. The function sets its innerHTML to the diagram.iosv). The function uses the following state variables from io:wb_totalFuel, enrt_fuelToDest, enrt_fuelToAlt, enrt_fuelAtDest, enrt_fuelAtAlt, enrt_minReserve, and enrt_reservecurSv value is used, and the fmtUnit() of wb_totalFuel supplies the fuel units label.enrt_fuelOnBoard_minenrt_ete_minNone.
drawRunwaySvg() drawRunwaySvg(node, pageId)
Draws the takeoff or landing runway wind diagram into node. The diagram contains:
acData.aircraftIcon) at the start of the runway, darkened for contrast.VRB) or calm winds.Wind around arrows on the right of the diagram. Gusts are shown as G values. A crosswind that exceeds the aircraft's maximum demonstrated crosswind (acData.maxXwind) is drawn in red. If there is no wind, a headwind of 0 is shown.node
The wrapper DOM node of an svg state variable. The function sets its innerHTML to the diagram.
pageId
The page ID string of the page to draw the diagram for, such as 'dep', 'dest', or 'alt'. The function uses the following state variables from the page, where ${pageId}_ is the page ID prefix:
${pageId}_runwayId'01' is used.${pageId}_runwayLength_ft${pageId}_roll_ft${pageId}_safeRunwayLength_ft${pageId}_runwayMagDir The wind is created from the page using new Wind(pageId).
None.
drawWBSvg() drawWBSvg(node, io, bewCg)
drawWBSvg(node, io, bewCg, tkoCg, ldgCg, zfCg)
drawWBSvg(node, io, bewCg, tkoCg, ldgCg, zfCg, cgFn)
Draws the weight and balance diagram into node. The diagram always contains the aircraft's CG envelope (the normal category, or the utility category for utility-only aircraft) with the weight on the vertical axis and the arm on the horizontal axis, a dotted line at the maximum landing weight (if it is lower than the maximum takeoff weight), Fwd and Aft labels, and the basic empty weight (BEW) label.
If the takeoff and zero-fuel CG points are valid, the diagram also contains:
The function asserts that the takeoff weight is not less than the landing weight, and that the landing weight is not less than the zero-fuel weight.
nodesvg state variable. The function sets its innerHTML to the diagram.iosv). The function uses the wb_payload_lb, wb_totalFuel_gal, and wb_fuelWeight_lb unit state variables from io. The curSv value and fmtUnit() of each are used for the labels.bewCgCgPoint for the basic empty weight. The weight sets the bottom of the diagram.tkoCg (optional)CgPoint for the takeoff weight and balance. If omitted or not valid, only the envelope is drawn.ldgCg (optional)CgPoint for the landing weight and balance. The landing point is not drawn if it is not valid.zfCg (optional)CgPoint for the zero-fuel weight and balance. If omitted or not valid, only the envelope is drawn.cgFn (optional)cgFn(fuel) that returns an object with arm and weight properties (like a CgPoint) for the aircraft with fuel gallons of fuel on board. It is used for aircraft whose fuel arm changes as fuel is burned (aircraft with multiple tanks) so the CG path is drawn as a curve. If omitted, the fuel arm is fixed and the CG path is a straight line.The aircraft data (acData) supplies the envelope (wb.cgEnvelope), the maximum takeoff, landing and zero-fuel weights (wb.maxTkoWeight, wb.maxLdgWeight, and wb.maxZfWeight), and the fuel density (fuel.lbToGal()).
None.