{"id":3998,"date":"2019-02-12T16:10:18","date_gmt":"2019-02-12T16:10:18","guid":{"rendered":"https:\/\/cyflexdoc.wpengine.com\/usage-help-manual\/19-variables-and-computations\/svar\/"},"modified":"2026-05-20T12:59:29","modified_gmt":"2026-05-20T17:59:29","slug":"svar","status":"publish","type":"page","link":"https:\/\/cyflex.com\/index.php\/usage-help-manual\/2-variables-and-computations\/svar\/","title":{"rendered":"svar"},"content":{"rendered":"<h3>Purpose:<\/h3>\n<dl>\n<dd>\n<p>Set the value of a variable or list of variables.<\/p>\n<p>Only REAL, REAL_ARRAY, INTEGER, INTEGER_ARRAY, LOGICAL, LOGICAL_ARRAY, STRING, and STRING_ARRAY variable types are supported. COMPOSITION, PROPERTY, STATISTICAL and EMISSION types cannot be set with this command.<\/p>\n<p>Note that there are many optional ways to express the value, such as a constant, variable label, or computed expression. Special consideration is given to certain cases of REAL variables:<\/p>\n<ol>\n<li>Changing the value of the &#8220;Cell_meter&#8221; hour meter value is not allowed.<\/li>\n<li>Changing the value of the \u201cPAM_point\u201d variable is not allowed. Use the &#8220;setPAMpoint&#8221; command to do this.<\/li>\n<li>If you set the value of a counter (CI) channel or a Gantner counter channel from a 2143 module, a message is sent to the transfer layer task so that this new value can be &#8216;synchronized&#8217; to the current raw data value from the input channel.<\/li>\n<\/ol>\n<p>In version CyFlex.6.2 and newer releases, dimensional consistency checking has been added.<\/p>\n<\/dd>\n<\/dl>\n<h3>Enter:<\/h3>\n<dl>\n<dd>\n<div>\n<table style=\"width: 80.2906%;\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col \/>\n<col \/> <\/colgroup>\n<tbody>\n<tr>\n<td style=\"width: 9.84%;\"><strong>svar<\/strong><\/td>\n<td style=\"width: 201.057%;\">&lt;variable_label&gt; &lt;value&gt;<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 9.84%;\"><strong>svar<\/strong><\/td>\n<td style=\"width: 201.057%;\">&lt;label1&gt; &lt;value1&gt; label2 value2 label3 value3 \u2026<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 9.84%;\">\u00a0<\/td>\n<td style=\"width: 201.057%;\">(etc.\u00a0list of variable_label,value pairs)<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 9.84%;\"><strong>svar<\/strong><\/td>\n<td style=\"width: 201.057%;\">[-f &lt;format&gt;] &lt;variable_label&gt; &lt;value&gt;<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 9.84%;\"><strong>svar<\/strong><\/td>\n<td style=\"width: 201.057%;\">&lt;filename&gt;<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 9.84%;\"><strong>svar<\/strong><\/td>\n<td style=\"width: 201.057%;\">&lt;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 stdin_file \u00a0 \u00a0 \u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 9.84%;\"><strong>svar<\/strong><\/td>\n<td style=\"width: 201.057%;\">[&#8211;updated_by &lt;\/path\/to\/script&gt;] &lt;variable_label&gt; &lt;value&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/dd>\n<\/dl>\n<h3>Where:<\/h3>\n<dl>\n<dd>\n<div>\n<table style=\"width: 100%; height: 1402px;\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col \/>\n<col \/> <\/colgroup>\n<tbody>\n<tr style=\"height: 104px;\">\n<td style=\"width: 21.41%; height: 104px;\">\n<p>filename<\/p>\n<\/td>\n<td style=\"width: 78.16%; height: 104px;\">\n<p>Specify a text file containing an indefinite number of lines, each containing a label, value pair of entries. All the options for &#8216;value&#8217; described below are supported in the file entries. This form, where the argument is NOT a redirected stdin, may contain #comment lines, blank lines, etc., similar to a normal CyFlex spec file.<\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 104px;\">\n<td style=\"width: 21.41%; height: 104px;\">\n<p>stdin_file<\/p>\n<\/td>\n<td style=\"width: 78.16%; height: 104px;\">\n<p>Specify a text file containing an indefinite number of lines, each containing a label, value pair of entries. All the options for &#8216;value&#8217; described below are supported in the file entries. When the input file is stdin_file, #comment lines and blank lines are not ignored and will produce an error.<\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 56px;\">\n<td style=\"width: 21.41%; height: 56px;\">\n<p>variable_label<\/p>\n<\/td>\n<td style=\"width: 78.16%; height: 56px;\">\n<p>Specify the label of the variable to be modified. A CSAR variable label may also be specified.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 21.41%;\">\n<p>-f &lt;format&gt;<\/p>\n<\/td>\n<td style=\"width: 78.16%;\">\n<p>Enter a format specifier. The format string must be valid for the type of variable that is being set. Only int and real type general use variables are supported.\u00a0<\/p>\n<p>The format matching should be: %[flags][width][.precision][length]specifier<\/p>\n<p>The &#8216;%&#8217; and specifier are required.<\/p>\n<p>Flags: 0, #, +, &#8211;<\/p>\n<p>Width: number only, NOT *<\/p>\n<p>Precision: number only, NOT .*<\/p>\n<p>Length:<br \/>\nfloating point: L<br \/>\nintegers: h, l, j, z, t<\/p>\n<p>Specifiers:<br \/>\nfloating point: e, E, f, F, g, G, a, A<br \/>\nintegers: d, i, u, o, x, X<\/p>\n<p>Example:\u00a0<br \/>\n<strong>svar<\/strong> -f %10.4f myReal 12.345<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 21.41%;\">\n<p>&#8211;updated_by &lt;\/path\/to\/script&gt;<\/p>\n<\/td>\n<td style=\"width: 78.16%;\">\n<p>This argument is intended to allow the application to override the variables field for the last process to update the variable. This can make it easier if a shell script is used to call svar on variables when troubleshooting.<br \/>\nSpecify a string, which will often be a path to a script. The path needs to be 23 characters or less. If longer than 23 characters, only the first 23 characters of the script name will be used.\u00a0<\/p>\n<\/td>\n<\/tr>\n<tr style=\"height: 1138px;\">\n<td style=\"width: 21.41%; height: 1138px;\">\n<p>value<\/p>\n<\/td>\n<td style=\"width: 78.16%; height: 1138px;\">\n<p>The value to which variable is set.<\/p>\n<p>For REAL or REAL_ARRAY variables, the value may be expressed in 4 different ways.<\/p>\n<ol>\n<li>As a number where the units are assumed to be the same units as the target variable.\n<p>Example: <strong>svar<\/strong> engine_hrs 13.5<\/p>\n<p>The above command sets the hour meter to 13.5 hours<\/p>\n<\/li>\n<li>As a number with concatenated units. The value will be converted to the units of the target variable.\n<p>Example: <strong>svar<\/strong> engine_hrs 1[sec]<\/p>\n<p>Assuming that engine_hrs variable has units of [hr], the result will be .0064[hr]<\/p>\n<\/li>\n<li>As a variable label\n<p>Example: <strong>svar<\/strong> engine_hrs test_hrs<\/p>\n<p>The value of the test_hrs variable will be copied to the engine_hrs variable with appropriate units conversion<\/p>\n<\/li>\n<li>As a computed expression<\/li>\n<\/ol>\n<p style=\"padding-left: 40px;\"><strong>svar<\/strong> engine_hrs &#8220;test_hrs + 1[min]&#8221;<\/p>\n<p style=\"padding-left: 40px;\">The quoted expression will be evaluated and the result will be placed in the engine_hrs variable with appropriate units conversion.<\/p>\n<p>For INTEGER variables, the value may be entered as a decimal or hex number. Both below commands have the same result.<br \/>\n<strong>svar\u00a0<\/strong> count 16<br \/>\n<b>svar<\/b><span style=\"text-align: left; color: #333333; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; float: none; display: inline !important; white-space: normal; cursor: text; orphans: 2; background-color: transparent; -webkit-text-stroke-width: 0px;\"> count 0x10<\/span><\/p>\n<p><span style=\"text-align: left; color: #333333; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; float: none; display: inline !important; white-space: normal; cursor: text; orphans: 2; background-color: transparent; -webkit-text-stroke-width: 0px;\">For LOGICAL variables, the value may be entered in any of the following forms:<\/span><\/p>\n<p><span style=\"text-align: left; color: #333333; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; float: none; display: inline !important; white-space: normal; cursor: text; orphans: 2; background-color: transparent; -webkit-text-stroke-width: 0px;\">TRUE, ON\u00a0 (not case sensitive)<br \/>\nFALSE, OFF (not case sensitive)<br \/>\nstate_description<\/p>\n<p><strong>svar\u00a0<\/strong>water_value\u00a0 On<br \/>\n<strong>svar\u00a0<\/strong> water_value\u00a0 false<br \/>\n<strong>svar<\/strong>\u00a0 water_value\u00a0 Open<\/p>\n<p>In the last case, the string &#8220;Open&#8221; is assumed to match the &#8220;true_desc&#8221; field used when the variable was created.\u00a0 See the example output from the &#8220;gvar&#8221; command below.\u00a0 The true and false descriptions can also be obtained from the &#8216;dumpit&#8217; command.<\/span><\/p>\n<p>gvar water_valve<br \/>\nwater_valve is OFF which is &#8216;Closed&#8217; with status = NO, mem.index=33<\/p>\n<p>&#8216;Closed&#8217; is the &#8220;false_desc&#8221;<\/p>\n<p>&nbsp;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/dd>\n<\/dl>\n<h3>Example:<\/h3>\n<p style=\"padding-left: 40px;\">See above descriptions for <strong>Enter<\/strong> and <strong>Where<\/strong>.<\/p>\n<h3>Notes:<\/h3>\n<dl>\n<dd>\n<p>The svar command sets the value of the specified variable in the units of the specified variable.<\/p>\n<p>Some variables have their values continuously updated by another CyFlex process, which can overwrite any value set with this command. Analog inputs are an example of variables in this category. The &#8216;gvar&#8217; command will show the name of the last process which modified the variable value.<\/p>\n<\/dd>\n<\/dl>\n<h3>See Also:<\/h3>\n<dl>\n<dd>\n<p><a href=\"\/index.php\/usage-help-manual\/11-utilities-and-user-commands\/gvar\/\">gvar<\/a>, <a href=\"https:\/\/cyflex.com\/index.php\/usage-help-manual\/2-variables-and-computations\/rvar\/\">rvar<\/a>, <a href=\"https:\/\/cyflex.com\/index.php\/usage-help-manual\/2-variables-and-computations\/sovr\/\">sovr<\/a>, <a href=\"\/index.php\/usage-help-manual\/11-utilities-and-user-commands\/dumpit\/\">dumpit,<\/a> <a href=\"https:\/\/cyflex.com\/index.php\/usage-help-manual\/2-variables-and-computations\/override_mon\/\">override_mon<\/a>, <a href=\"https:\/\/cyflex.com\/index.php\/usage-help-manual\/2-variables-and-computations\/override_status\/\">override_status<\/a>, <a href=\"\/wp-content\/uploads\/Array-Variables.pdf\">Array Variables<\/a><\/p>\n<\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Purpose: Set the value of a variable or list of variables. Only REAL, REAL_ARRAY, INTEGER, INTEGER_ARRAY, LOGICAL, LOGICAL_ARRAY, STRING, and STRING_ARRAY variable types are supported. COMPOSITION, PROPERTY, STATISTICAL and EMISSION types cannot be set with this command. Note that there are many optional ways to express the value, such as a constant, variable label, or [&hellip;]<\/p>\n","protected":false},"author":47,"featured_media":0,"parent":1966,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3998","page","type-page","status-publish","hentry"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/3998","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=3998"}],"version-history":[{"count":1,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/3998\/revisions"}],"predecessor-version":[{"id":15340,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/3998\/revisions\/15340"}],"up":[{"embeddable":true,"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/pages\/1966"}],"wp:attachment":[{"href":"https:\/\/cyflex.com\/index.php\/wp-json\/wp\/v2\/media?parent=3998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}