I add two numbers in Xcos and would like to show the result in the diagram. I managed to do so using a CSCOPE element and adding an extra CLOCK_c element:
However, I would prefer a display element that simply shows the number:
=> What component could I use for that?
If there is no existing display component for plain numbers, how can I create one?
Related questions:
How to show results of a static model in Modeling view with OpenModelica?
xcos example file:
xcos_demo.xcos
<?xml version="1.0" ?>
<XcosDiagram debugLevel="0" finalIntegrationTime="30.0" integratorAbsoluteTolerance="1.0E-6" integratorRelativeTolerance="1.0E-6" toleranceOnTime="1.0E-10" maxIntegrationTimeInterval="100001.0" maximumStepSize="0.0" realTimeScaling="0.0" solver="1.0" background="-1" gridEnabled="1" title="Untitled"><!--Xcos - 2.0 - scilab-2023.1.0 - 20230523 0919-->
<Array as="context" scilabClass="String[]"></Array>
<mxGraphModel as="model">
<root>
<mxCell id="0:1:0"/>
<mxCell id="0:2:0" parent="0:1:0"/>
<BasicBlock id="7ca5d227:1887764bffb:-7ff9" parent="0:2:0" interfaceFunctionName="CONST_m" blockType="d" dependsOnU="0" dependsOnT="0" simulationFunctionName="cstblk4_m" simulationFunctionType="C_OR_FORTRAN" style="CONST_m">
<ScilabString as="exprs" height="1" width="1">
<data line="0" column="0" value="1"/>
</ScilabString>
<ScilabDouble as="realParameters" height="0" width="0"/>
<ScilabDouble as="integerParameters" height="0" width="0"/>
<Array as="objectsParameters" scilabClass="ScilabList">
<ScilabDouble height="1" width="1">
<data line="0" column="0" realPart="1.0"/>
</ScilabDouble>
</Array>
<ScilabInteger as="nbZerosCrossing" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabInteger as="nmode" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabDouble as="state" height="0" width="0"/>
<ScilabDouble as="dState" height="0" width="0"/>
<Array as="oDState" scilabClass="ScilabList"/>
<Array as="equations" scilabClass="ScilabList"/>
<mxGeometry as="geometry" x="170.0" y="270.0" width="40.0" height="40.0"/>
</BasicBlock>
<ExplicitOutputPort id="7ca5d227:1887764bffb:-7ff8" parent="7ca5d227:1887764bffb:-7ff9" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="1" initialState="0.0" style="ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0" value=""/>
<BigSom id="7ca5d227:1887764bffb:-7ff1" parent="0:2:0" interfaceFunctionName="BIGSOM_f" blockType="c" dependsOnU="1" dependsOnT="0" simulationFunctionName="sum" simulationFunctionType="TYPE_2" style="BIGSOM_f">
<ScilabString as="exprs" height="1" width="1">
<data line="0" column="0" value="[1;1]"/>
</ScilabString>
<ScilabDouble as="realParameters" height="1" width="2">
<data line="0" column="0" realPart="1.0"/>
<data line="0" column="1" realPart="1.0"/>
</ScilabDouble>
<ScilabDouble as="integerParameters" height="0" width="0"/>
<Array as="objectsParameters" scilabClass="ScilabList"/>
<ScilabInteger as="nbZerosCrossing" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabInteger as="nmode" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabDouble as="state" height="0" width="0"/>
<ScilabDouble as="dState" height="0" width="0"/>
<Array as="oDState" scilabClass="ScilabList"/>
<Array as="equations" scilabClass="ScilabList"/>
<mxGeometry as="geometry" x="430.0" y="310.0" width="40.0" height="60.0"/>
</BigSom>
<ExplicitInputPort id="7ca5d227:1887764bffb:-7ff0" parent="7ca5d227:1887764bffb:-7ff1" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="-1" initialState="0.0" style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0" value=""/>
<ExplicitInputPort id="7ca5d227:1887764bffb:-7fef" parent="7ca5d227:1887764bffb:-7ff1" ordering="2" dataType="REAL_MATRIX" dataColumns="1" dataLines="-1" initialState="0.0" style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0" value=""/>
<ExplicitOutputPort id="7ca5d227:1887764bffb:-7fee" parent="7ca5d227:1887764bffb:-7ff1" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="-1" initialState="0.0" style="ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0" value=""/>
<BasicBlock id="7ca5d227:1887764bffb:-7fec" parent="0:2:0" interfaceFunctionName="CONST_m" blockType="d" dependsOnU="0" dependsOnT="0" simulationFunctionName="cstblk4_m" simulationFunctionType="C_OR_FORTRAN" style="CONST_m">
<ScilabString as="exprs" height="1" width="1">
<data line="0" column="0" value="1"/>
</ScilabString>
<ScilabDouble as="realParameters" height="0" width="0"/>
<ScilabDouble as="integerParameters" height="0" width="0"/>
<Array as="objectsParameters" scilabClass="ScilabList">
<ScilabDouble height="1" width="1">
<data line="0" column="0" realPart="1.0"/>
</ScilabDouble>
</Array>
<ScilabInteger as="nbZerosCrossing" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabInteger as="nmode" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabDouble as="state" height="0" width="0"/>
<ScilabDouble as="dState" height="0" width="0"/>
<Array as="oDState" scilabClass="ScilabList"/>
<Array as="equations" scilabClass="ScilabList"/>
<mxGeometry as="geometry" x="170.0" y="360.0" width="40.0" height="40.0"/>
</BasicBlock>
<ExplicitOutputPort id="7ca5d227:1887764bffb:-7feb" parent="7ca5d227:1887764bffb:-7fec" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="1" initialState="0.0" style="ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0" value=""/>
<BasicBlock id="7ca5d227:1887764bffb:-7fd6" parent="0:2:0" interfaceFunctionName="CSCOPE" blockType="c" dependsOnU="1" dependsOnT="0" simulationFunctionName="cscope" simulationFunctionType="C_OR_FORTRAN" style="CSCOPE;verticalLabelPosition=bottom;verticalAlign=top;spacing=2;displayedLabel=">
<ScilabString as="exprs" height="10" width="1">
<data line="0" column="0" value="1 3 5 7 9 11 13 15"/>
<data line="1" column="0" value="-1"/>
<data line="2" column="0" value="[]"/>
<data line="3" column="0" value="[600;400]"/>
<data line="4" column="0" value="-15"/>
<data line="5" column="0" value="15"/>
<data line="6" column="0" value="30"/>
<data line="7" column="0" value="20"/>
<data line="8" column="0" value="0"/>
<data line="9" column="0" value=""/>
</ScilabString>
<ScilabDouble as="realParameters" height="1" width="4">
<data line="0" column="0" realPart="0.0"/>
<data line="0" column="1" realPart="-15.0"/>
<data line="0" column="2" realPart="15.0"/>
<data line="0" column="3" realPart="30.0"/>
</ScilabDouble>
<ScilabInteger as="integerParameters" height="1" width="15" intPrecision="sci_int32">
<data line="0" column="0" value="-1"/>
<data line="0" column="1" value="1"/>
<data line="0" column="2" value="20"/>
<data line="0" column="3" value="1"/>
<data line="0" column="4" value="3"/>
<data line="0" column="5" value="5"/>
<data line="0" column="6" value="7"/>
<data line="0" column="7" value="9"/>
<data line="0" column="8" value="11"/>
<data line="0" column="9" value="13"/>
<data line="0" column="10" value="15"/>
<data line="0" column="11" value="-1"/>
<data line="0" column="12" value="-1"/>
<data line="0" column="13" value="600"/>
<data line="0" column="14" value="400"/>
</ScilabInteger>
<Array as="objectsParameters" scilabClass="ScilabList"/>
<ScilabInteger as="nbZerosCrossing" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabInteger as="nmode" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabDouble as="state" height="0" width="0"/>
<ScilabDouble as="dState" height="0" width="0"/>
<Array as="oDState" scilabClass="ScilabList"/>
<Array as="equations" scilabClass="ScilabList"/>
<mxGeometry as="geometry" x="610.0" y="320.0" width="40.0" height="40.0"/>
</BasicBlock>
<ExplicitInputPort id="7ca5d227:1887764bffb:-7fd5" parent="7ca5d227:1887764bffb:-7fd6" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="-1" initialState="0.0" style="ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0" value=""/>
<ControlPort id="7ca5d227:1887764bffb:-7fd4" parent="7ca5d227:1887764bffb:-7fd6" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="1" initialState="0.0" style="ControlPort;align=center;verticalAlign=top;spacing=10.0;rotation=90" value=""/>
<BasicBlock id="7ca5d227:1887764bffb:-7fd1" parent="0:2:0" interfaceFunctionName="CLOCK_c" blockType="h" dependsOnU="0" dependsOnT="0" simulationFunctionName="csuper" simulationFunctionType="DEFAULT" style="CLOCK_c">
<ScilabDouble as="exprs" height="0" width="0"/>
<ScilabDouble as="realParameters" height="0" width="0"/>
<ScilabDouble as="integerParameters" height="0" width="0"/>
<Array as="objectsParameters" scilabClass="ScilabList"/>
<ScilabInteger as="nbZerosCrossing" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabInteger as="nmode" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabDouble as="state" height="0" width="0"/>
<ScilabDouble as="dState" height="0" width="0"/>
<Array as="oDState" scilabClass="ScilabList"/>
<Array as="equations" scilabClass="ScilabList"/>
<mxGeometry as="geometry" x="610.0" y="180.0" width="40.0" height="40.0"/>
<SuperBlockDiagram as="child" background="-1" gridEnabled="1" title="">
<Array as="context" scilabClass="String[]"></Array>
<mxGraphModel as="model">
<root>
<mxCell id="7ca5d227:1887764bffc:-7fd1"/>
<mxCell id="7ca5d227:1887764bffd:-7fd1" parent="7ca5d227:1887764bffc:-7fd1"/>
<EventOutBlock id="7ca5d227:1887764bffb:-7fbc" parent="7ca5d227:1887764bffd:-7fd1" interfaceFunctionName="CLKOUT_f" blockType="d" dependsOnU="0" dependsOnT="0" simulationFunctionName="output" simulationFunctionType="DEFAULT" style="">
<ScilabString as="exprs" height="1" width="1">
<data line="0" column="0" value="1"/>
</ScilabString>
<ScilabDouble as="realParameters" height="0" width="0"/>
<ScilabInteger as="integerParameters" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="1"/>
</ScilabInteger>
<Array as="objectsParameters" scilabClass="ScilabList"/>
<ScilabInteger as="nbZerosCrossing" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabInteger as="nmode" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabDouble as="state" height="0" width="0"/>
<ScilabDouble as="dState" height="0" width="0"/>
<Array as="oDState" scilabClass="ScilabList"/>
<Array as="equations" scilabClass="ScilabList"/>
<mxGeometry as="geometry" x="399.0" y="162.0" width="20.0" height="20.0"/>
</EventOutBlock>
<ControlPort id="7ca5d227:1887764bffb:-7fbb" parent="7ca5d227:1887764bffb:-7fbc" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="1" initialState="0.0" style="" value=""/>
<BasicBlock id="7ca5d227:1887764bffb:-7fba" parent="7ca5d227:1887764bffd:-7fd1" interfaceFunctionName="EVTDLY_c" blockType="d" dependsOnU="0" dependsOnT="0" simulationFunctionName="evtdly4" simulationFunctionType="C_OR_FORTRAN" style="">
<ScilabString as="exprs" height="2" width="1">
<data line="0" column="0" value="0.1"/>
<data line="1" column="0" value="0.1"/>
</ScilabString>
<ScilabDouble as="realParameters" height="1" width="2">
<data line="0" column="0" realPart="0.1"/>
<data line="0" column="1" realPart="0.1"/>
</ScilabDouble>
<ScilabDouble as="integerParameters" height="0" width="0"/>
<Array as="objectsParameters" scilabClass="ScilabList"/>
<ScilabInteger as="nbZerosCrossing" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabInteger as="nmode" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabDouble as="state" height="0" width="0"/>
<ScilabDouble as="dState" height="0" width="0"/>
<Array as="oDState" scilabClass="ScilabList"/>
<Array as="equations" scilabClass="ScilabList"/>
<mxGeometry as="geometry" x="320.0" y="232.0" width="40.0" height="40.0"/>
</BasicBlock>
<ControlPort id="7ca5d227:1887764bffb:-7fb9" parent="7ca5d227:1887764bffb:-7fba" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="1" initialState="0.0" style="" value=""/>
<CommandPort id="7ca5d227:1887764bffb:-7fb8" parent="7ca5d227:1887764bffb:-7fba" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="1" initialState="0.1" style="" value=""/>
<SplitBlock id="7ca5d227:1887764bffb:-7fb7" parent="7ca5d227:1887764bffd:-7fd1" interfaceFunctionName="CLKSPLIT_f" blockType="d" dependsOnU="0" dependsOnT="0" simulationFunctionName="split" simulationFunctionType="DEFAULT" style="">
<ScilabDouble as="exprs" height="0" width="0"/>
<ScilabDouble as="realParameters" height="0" width="0"/>
<ScilabDouble as="integerParameters" height="0" width="0"/>
<Array as="objectsParameters" scilabClass="ScilabList"/>
<ScilabInteger as="nbZerosCrossing" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabInteger as="nmode" height="1" width="1" intPrecision="sci_int32">
<data line="0" column="0" value="0"/>
</ScilabInteger>
<ScilabDouble as="state" height="0" width="0"/>
<ScilabDouble as="dState" height="0" width="0"/>
<Array as="oDState" scilabClass="ScilabList"/>
<Array as="equations" scilabClass="ScilabList"/>
<mxGeometry as="geometry" x="380.71066" y="172.0" width="0.3333333333333333" height="0.3333333333333333"/>
</SplitBlock>
<ControlPort id="7ca5d227:1887764bffb:-7fb6" parent="7ca5d227:1887764bffb:-7fb7" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="1" initialState="0.0" style="" value=""/>
<CommandPort id="7ca5d227:1887764bffb:-7fb5" parent="7ca5d227:1887764bffb:-7fb7" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="1" initialState="-1.0" style="" value=""/>
<CommandPort id="7ca5d227:1887764bffb:-7fb4" parent="7ca5d227:1887764bffb:-7fb7" ordering="2" dataType="REAL_MATRIX" dataColumns="1" dataLines="1" initialState="-1.0" style="" value=""/>
<CommandControlLink id="7ca5d227:1887764bffb:-7fb3" parent="7ca5d227:1887764bffd:-7fd1" source="7ca5d227:1887764bffb:-7fb8" target="7ca5d227:1887764bffb:-7fb6" style="" value="">
<mxGeometry as="geometry">
<mxPoint as="sourcePoint" x="340.0" y="226.29"/>
<Array as="points">
<mxPoint x="340.0" y="172.0"/>
</Array>
<mxPoint as="targetPoint" x="380.71" y="172.0"/>
</mxGeometry>
</CommandControlLink>
<CommandControlLink id="7ca5d227:1887764bffb:-7fb2" parent="7ca5d227:1887764bffd:-7fd1" source="7ca5d227:1887764bffb:-7fb5" target="7ca5d227:1887764bffb:-7fbb" style="" value="">
<mxGeometry as="geometry">
<mxPoint as="sourcePoint" x="380.71" y="172.0"/>
<Array as="points"></Array>
<mxPoint as="targetPoint" x="399.0" y="172.0"/>
</mxGeometry>
</CommandControlLink>
<CommandControlLink id="7ca5d227:1887764bffb:-7fb1" parent="7ca5d227:1887764bffd:-7fd1" source="7ca5d227:1887764bffb:-7fb4" target="7ca5d227:1887764bffb:-7fb9" style="" value="">
<mxGeometry as="geometry">
<mxPoint as="sourcePoint" x="380.71" y="172.0"/>
<Array as="points">
<mxPoint x="380.71" y="302.0"/>
<mxPoint x="340.0" y="302.0"/>
</Array>
<mxPoint as="targetPoint" x="340.0" y="277.71"/>
</mxGeometry>
</CommandControlLink>
</root>
</mxGraphModel>
<mxCell as="defaultParent" id="7ca5d227:1887764bffd:-7fd1" parent="7ca5d227:1887764bffc:-7fd1"/>
</SuperBlockDiagram>
</BasicBlock>
<CommandPort id="7ca5d227:1887764bffb:-7fd0" parent="7ca5d227:1887764bffb:-7fd1" ordering="1" dataType="REAL_MATRIX" dataColumns="1" dataLines="1" initialState="-1.0" style="CommandPort;align=center;verticalAlign=bottom;spacing=10.0;rotation=90" value=""/>
<ExplicitLink id="7ca5d227:1887764bffb:-7fed" parent="0:2:0" source="7ca5d227:1887764bffb:-7ff8" target="7ca5d227:1887764bffb:-7ff0" style="ExplicitLink" value="">
<mxGeometry as="geometry">
<mxPoint as="sourcePoint" x="44.0" y="20.0"/>
<Array as="points"></Array>
<mxPoint as="targetPoint" x="-4.0" y="20.0"/>
</mxGeometry>
</ExplicitLink>
<ExplicitLink id="7ca5d227:1887764bffb:-7fea" parent="0:2:0" source="7ca5d227:1887764bffb:-7feb" target="7ca5d227:1887764bffb:-7fef" style="ExplicitLink" value="">
<mxGeometry as="geometry">
<mxPoint as="sourcePoint" x="44.0" y="20.0"/>
<Array as="points"></Array>
<mxPoint as="targetPoint" x="-4.0" y="40.0"/>
</mxGeometry>
</ExplicitLink>
<ExplicitLink id="7ca5d227:1887764bffb:-7fd2" parent="0:2:0" source="7ca5d227:1887764bffb:-7fee" target="7ca5d227:1887764bffb:-7fd5" style="ExplicitLink" value="">
<mxGeometry as="geometry">
<mxPoint as="sourcePoint" x="44.0" y="30.0"/>
<Array as="points"></Array>
<mxPoint as="targetPoint" x="-4.0" y="20.0"/>
</mxGeometry>
</ExplicitLink>
<CommandControlLink id="7ca5d227:1887764bffb:-7fce" parent="0:2:0" source="7ca5d227:1887764bffb:-7fd0" target="7ca5d227:1887764bffb:-7fd4" style="CommandControlLink" value="">
<mxGeometry as="geometry">
<mxPoint as="sourcePoint" x="20.0" y="44.0"/>
<Array as="points"></Array>
<mxPoint as="targetPoint" x="20.0" y="-4.0"/>
</mxGeometry>
</CommandControlLink>
</root>
</mxGraphModel>
<mxCell as="defaultParent" id="0:2:0" parent="0:1:0"/>
</XcosDiagram>
Use the AFFICH_m block (https://help.scilab.org/AFFICH_m). However, be warned that you still have to run the simulation to see the value: