{"id":3689,"date":"2019-02-12T16:09:37","date_gmt":"2019-02-12T16:09:37","guid":{"rendered":"https:\/\/cyflexdoc.wpengine.com\/usage-help-manual\/19-variables-and-computations\/get_comp\/"},"modified":"2025-08-26T11:57:39","modified_gmt":"2025-08-26T16:57:39","slug":"get_comp","status":"publish","type":"page","link":"https:\/\/cyflex.com\/index.php\/usage-help-manual\/19-fluid-flow-computations\/get_comp\/","title":{"rendered":"get_comp"},"content":{"rendered":"<h3>Purpose:<\/h3>\n<dl>\n<dd>\n<p>Display or return the value of a computed expression in the specified units.<br \/>\nRefer to Section 7 of &#8220;CyFlex Variables, Units, and Computed Expressions&#8221; for the rules of syntax.\u00a0<\/p>\n<\/dd>\n<\/dl>\n<h3>Enter:<\/h3>\n<dl>\n<dd>\n<p><strong>get_comp<\/strong> &lt;expression&gt; [u=units] [option=output options]<\/p>\n<\/dd>\n<\/dl>\n<h3>Where:<\/h3>\n<dl>\n<dd>\n<table style=\"width: 100%;\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col \/>\n<col \/> <\/colgroup>\n<tbody>\n<tr>\n<td style=\"width: 23.3577%;\">\n<p>expression<\/p>\n<\/td>\n<td style=\"width: 76.3504%;\">\n<p>Specify the expression to compute. Enclose in double quotes as shown in <strong>Examples<\/strong>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 23.3577%;\">\n<p>u=units<\/p>\n<\/td>\n<td style=\"width: 76.3504%;\">\n<p>Optional. Specify the units for the results of the computation and the display. The default is to use the default units.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 23.3577%;\">\n<p>option<\/p>\n<\/td>\n<td style=\"width: 76.3504%;\">\n<p>Optional. Specify an output content preference:<\/p>\n<ul>\n<li><span style=\"font-family: inherit; font-size: inherit;\">verbose to display output with equal signs and units. This is the default.<\/span><\/li>\n<li>simple to display output with units and without equal signs or carriage returns. This option is intended for automated scripts.<\/li>\n<li>no-units to display output without equal signs, carriage returns, and units. This option is intended for automated scripts.<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/dd>\n<\/dl>\n<h3>Examples:<\/h3>\n<dl>\n<dd>\n<p><strong>get_comp<\/strong> &#8221; RPM * Torque&#8221;\u00a0 \u00a0u=hp<\/p>\n<p>The above command displays the current power in units of horsepower.<\/p>\n<p><strong>get_comp<\/strong> &#8221; &#8216;date=&#8217; + @year_month_day() &#8220;<\/p>\n<p>This example demonstrates string concatenation.\u00a0 The single quote is used to enclose a literal string, the @year_month_day() function returns a string such &#8216;220217&#8217; for Feb 17, 2022 and the + symbol is used to concatenate the 2 strings resulting in an output of\u00a0<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#8216;date=220217&#8217;<\/p>\n<p><strong>get_comp\u00a0 <\/strong><span style=\"font-family: georgia, palatino, serif; font-size: 12pt;\">&#8221; if( hr_meter_run ) then 100[psi] else 0[psi] &#8221;\u00a0 u=psi<\/span><span style=\"font-family: georgia, palatino, serif; font-size: 12pt;\">\u00a0<\/span><\/p>\n<p>This example demonstrates a simple logical expression that will return either 100[psi] or 0[psi] depending on whether the logical variable &#8216;hr_meter_run&#8217; is TRUE of FALSE.\u00a0 \u00a0If the &#8220;u=psi&#8221; argument is specified, the value would be returned in units of PA (pascals).<\/p>\n<p>The following illustrates different outputs based on the specified output option.<\/p>\n<p><strong>get_comp<\/strong> &#8220;1[in_hg] + vap_pa&#8221; u=in_h2o option=verbose= 27.1407330011252199142291[in_h2o]<\/p>\n<p><strong>get_comp<\/strong> &#8220;1[in_hg] + vap_pa&#8221; u=in_h2o option=simple<br \/>\n27.1407330011252199142291[in_h2o]<\/p>\n<p><strong>get_comp<\/strong> &#8220;1[in_hg] + vap_pa&#8221; u=in_h2o option=no-units<br \/>\n27.1407330011252199142291<\/p>\n<\/dd>\n<\/dl>\n<h3>Notes:<\/h3>\n<dl>\n<dd>\n<p>You can wrap the [units] argument in &#8221; &#8221; or &#8216; &#8216; if you get an issue.<\/p>\n<p>An example problem is:<\/p>\n<p>\u00a0\u00a0\u00a0 get_comp &#8220;200[gm\/kw_hr]&#8221; u=lb\/(hp_hr)<\/p>\n<p>returns:<\/p>\n<p>\u00a0\u00a0\u00a0 bash: syntax error near unexpected token &#8216;(&#8216;<\/p>\n<p>To fix this, run it as follows:<\/p>\n<p>\u00a0\u00a0\u00a0 get_comp &#8220;200[gm\/kw_hr]&#8221;\u00a0 &#8220;u=lb\/(hp_hr)&#8221;<\/p>\n<\/dd>\n<\/dl>\n<p>&nbsp;<\/p>\n<h3>See Also:<\/h3>\n<dl>\n<dd>\n<p><a href=\"\/wp-content\/uploads\/CyFlex-Variables-Units-and-Computed-Expressions.pdf\">CyFlex Variables, Units and Computed Expressions<\/a>, <a href=\"\/wp-content\/uploads\/Creating-User-Computations-and-User-Variables.pdf\">Creating User Computations and User Variables<\/a><\/p>\n<\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Purpose: Display or return the value of a computed expression in the specified units. Refer to Section 7 of &#8220;CyFlex Variables, Units, and Computed Expressions&#8221; for the rules of syntax.\u00a0 Enter: get_comp &lt;expression&gt; [u=units] [option=output options] Where: expression Specify the expression to compute. Enclose in double quotes as shown in Examples. u=units Optional. Specify the [&hellip;]<\/p>\n","protected":false},"author":47,"featured_media":0,"parent":1959,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3689","page","type-page","status-publish","hentry"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/3689","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/comments?post=3689"}],"version-history":[{"count":0,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/3689\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/1959"}],"wp:attachment":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/media?parent=3689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}