From 7465daea85285ba7f291b6bf6ddc45caa9e7ad65 Mon Sep 17 00:00:00 2001 From: Sunil Shetye Date: Mon, 25 Jun 2018 18:20:39 +0530 Subject: add spacing to end of block also --- js/Branching/CLKFROM.js | 41 +- js/Branching/CLKFROM.pickle | 6 +- js/Branching/CLKGOTO.js | 57 +-- js/Branching/CLKGOTO.pickle | 6 +- js/Branching/CLKGotoTagVisibility.js | 39 +- js/Branching/CLKGotoTagVisibility.pickle | 6 +- js/Branching/DEMUX.js | 75 ++-- js/Branching/DEMUX.pickle | 6 +- js/Branching/DEMUX_f.js | 75 ++-- js/Branching/DEMUX_f.pickle | 6 +- js/Branching/ESELECT_f.js | 71 ++-- js/Branching/ESELECT_f.pickle | 6 +- js/Branching/EXTRACTOR.js | 35 +- js/Branching/EXTRACTOR.pickle | 6 +- js/Branching/FROM.js | 41 +- js/Branching/FROM.pickle | 6 +- js/Branching/FROMMO.js | 41 +- js/Branching/FROMMO.pickle | 6 +- js/Branching/GOTO.js | 55 +-- js/Branching/GOTO.pickle | 6 +- js/Branching/GOTOMO.js | 55 +-- js/Branching/GOTOMO.pickle | 6 +- js/Branching/GotoTagVisibility.js | 39 +- js/Branching/GotoTagVisibility.pickle | 6 +- js/Branching/GotoTagVisibilityMO.js | 39 +- js/Branching/GotoTagVisibilityMO.pickle | 6 +- js/Branching/ISELECT_f.js | 39 +- js/Branching/ISELECT_f.pickle | 6 +- js/Branching/ISELECT_m.js | 57 +-- js/Branching/ISELECT_m.pickle | 6 +- js/Branching/MUX.js | 75 ++-- js/Branching/MUX.pickle | 6 +- js/Branching/MUX_f.js | 75 ++-- js/Branching/MUX_f.pickle | 6 +- js/Branching/M_SWITCH.js | 73 ++-- js/Branching/M_SWITCH.pickle | 6 +- js/Branching/NRMSOM_f.js | 29 +- js/Branching/NRMSOM_f.pickle | 6 +- js/Branching/RELAY_f.js | 39 +- js/Branching/RELAY_f.pickle | 6 +- js/Branching/SCALAR2VECTOR.js | 43 +- js/Branching/SCALAR2VECTOR.pickle | 6 +- js/Branching/SELECT_f.js | 39 +- js/Branching/SELECT_f.pickle | 6 +- js/Branching/SELECT_m.js | 57 +-- js/Branching/SELECT_m.pickle | 6 +- js/Branching/SELF_SWITCH.pickle | 8 +- js/Branching/SWITCH2.js | 55 +-- js/Branching/SWITCH2.pickle | 6 +- js/Branching/SWITCH2_m.js | 83 ++-- js/Branching/SWITCH2_m.pickle | 6 +- js/Branching/SWITCH_f.js | 39 +- js/Branching/SWITCH_f.pickle | 6 +- js/Electrical/CCS.js | 47 +-- js/Electrical/CCS.pickle | 6 +- js/Electrical/CVS.js | 47 +-- js/Electrical/CVS.pickle | 6 +- js/Electrical/Capacitor.js | 31 +- js/Electrical/Capacitor.pickle | 6 +- js/Electrical/ConstantVoltage.js | 31 +- js/Electrical/ConstantVoltage.pickle | 6 +- js/Electrical/CurrentSensor.js | 9 +- js/Electrical/CurrentSensor.pickle | 6 +- js/Electrical/Diode.js | 31 +- js/Electrical/Diode.pickle | 6 +- js/Electrical/Ground.js | 9 +- js/Electrical/Ground.pickle | 6 +- js/Electrical/Gyrator.js | 65 +-- js/Electrical/Gyrator.pickle | 6 +- js/Electrical/IdealTransformer.js | 65 +-- js/Electrical/IdealTransformer.pickle | 6 +- js/Electrical/Inductor.js | 31 +- js/Electrical/Inductor.pickle | 6 +- js/Electrical/MOTOR.js | 9 +- js/Electrical/MOTOR.pickle | 6 +- js/Electrical/NMOS.js | 29 +- js/Electrical/NMOS.pickle | 6 +- js/Electrical/NPN.js | 65 +-- js/Electrical/NPN.pickle | 6 +- js/Electrical/OpAmp.js | 29 +- js/Electrical/OpAmp.pickle | 6 +- js/Electrical/PMOS.js | 29 +- js/Electrical/PMOS.pickle | 6 +- js/Electrical/PNP.js | 65 +-- js/Electrical/PNP.pickle | 6 +- js/Electrical/PotentialSensor.js | 9 +- js/Electrical/PotentialSensor.pickle | 6 +- js/Electrical/Resistor.js | 31 +- js/Electrical/Resistor.pickle | 6 +- js/Electrical/SineVoltage.js | 31 +- js/Electrical/SineVoltage.pickle | 6 +- js/Electrical/Switch.js | 29 +- js/Electrical/Switch.pickle | 6 +- js/Electrical/VVsourceAC.js | 31 +- js/Electrical/VVsourceAC.pickle | 6 +- js/Electrical/VariableResistor.js | 9 +- js/Electrical/VariableResistor.pickle | 6 +- js/Electrical/VoltageSensor.js | 9 +- js/Electrical/VoltageSensor.pickle | 6 +- js/Electrical/VsourceAC.js | 31 +- js/Electrical/VsourceAC.pickle | 6 +- js/Events/ANDBLK.js | 29 +- js/Events/ANDBLK.pickle | 6 +- js/Events/ANDLOG_f.js | 5 +- js/Events/ANDLOG_f.pickle | 6 +- js/Events/CLKSOMV_f.js | 5 +- js/Events/CLKSOMV_f.pickle | 6 +- js/Events/CLKSOM_f.js | 5 +- js/Events/CLKSOM_f.pickle | 6 +- js/Events/CLKSPLIT_f.js | 5 +- js/Events/CLKSPLIT_f.pickle | 6 +- js/Events/END_c.js | 29 +- js/Events/END_c.pickle | 6 +- js/Events/EVTDLY_c.js | 39 +- js/Events/EVTDLY_c.pickle | 6 +- js/Events/EVTDLY_f.js | 39 +- js/Events/EVTDLY_f.pickle | 6 +- js/Events/EVTGEN_f.js | 29 +- js/Events/EVTGEN_f.pickle | 6 +- js/Events/EVTVARDLY.js | 25 +- js/Events/EVTVARDLY.pickle | 6 +- js/Events/HALT_f.js | 29 +- js/Events/HALT_f.pickle | 6 +- js/Events/IFTHEL_f.js | 59 +-- js/Events/IFTHEL_f.pickle | 6 +- js/Events/MCLOCK_f.js | 43 +- js/Events/MCLOCK_f.pickle | 8 +- js/Events/MFCLCK_f.js | 23 +- js/Events/MFCLCK_f.pickle | 6 +- js/Events/M_freq.js | 75 ++-- js/Events/M_freq.pickle | 8 +- js/Events/VirtualCLK0.js | 5 +- js/Events/VirtualCLK0.pickle | 6 +- js/Events/freq_div.js | 143 +++---- js/Events/freq_div.pickle | 6 +- js/Hydraulics/Bache.js | 31 +- js/Hydraulics/Bache.pickle | 6 +- js/Hydraulics/Flowmeter.js | 65 +-- js/Hydraulics/Flowmeter.pickle | 6 +- js/Hydraulics/PerteDP.js | 31 +- js/Hydraulics/PerteDP.pickle | 6 +- js/Hydraulics/PuitsP.js | 29 +- js/Hydraulics/PuitsP.pickle | 6 +- js/Hydraulics/SourceP.js | 29 +- js/Hydraulics/SourceP.pickle | 6 +- js/Hydraulics/VanneReglante.js | 31 +- js/Hydraulics/VanneReglante.pickle | 6 +- js/IntegerOp/BITCLEAR.js | 117 +++--- js/IntegerOp/BITCLEAR.pickle | 6 +- js/IntegerOp/BITSET.js | 113 ++--- js/IntegerOp/BITSET.pickle | 6 +- js/IntegerOp/CONVERT.js | 681 ++++++++++++++++--------------- js/IntegerOp/CONVERT.pickle | 6 +- js/IntegerOp/DFLIPFLOP.js | 5 +- js/IntegerOp/DFLIPFLOP.pickle | 6 +- js/IntegerOp/DLATCH.js | 5 +- js/IntegerOp/DLATCH.pickle | 6 +- js/IntegerOp/EXTRACTBITS.js | 401 +++++++++--------- js/IntegerOp/EXTRACTBITS.pickle | 6 +- js/IntegerOp/INTMUL.js | 153 +++---- js/IntegerOp/INTMUL.pickle | 6 +- js/IntegerOp/JKFLIPFLOP.js | 59 +-- js/IntegerOp/JKFLIPFLOP.pickle | 6 +- js/IntegerOp/LOGIC.js | 71 ++-- js/IntegerOp/LOGIC.pickle | 6 +- js/IntegerOp/SHIFT.js | 181 ++++---- js/IntegerOp/SHIFT.pickle | 6 +- js/IntegerOp/SRFLIPFLOP.js | 59 +-- js/IntegerOp/SRFLIPFLOP.pickle | 6 +- js/Linear/BIGSOM_f.js | 33 +- js/Linear/BIGSOM_f.pickle | 6 +- js/Linear/CLINDUMMY_f.js | 5 +- js/Linear/CLINDUMMY_f.pickle | 6 +- js/Linear/CLR.js | 73 ++-- js/Linear/CLR.pickle | 6 +- js/Linear/CLR_f.js | 73 ++-- js/Linear/CLR_f.pickle | 6 +- js/Linear/CLSS.js | 109 ++--- js/Linear/CLSS.pickle | 6 +- js/Linear/CLSS_f.js | 89 ++-- js/Linear/CLSS_f.pickle | 6 +- js/Linear/DELAYV_f.js | 53 +-- js/Linear/DELAYV_f.pickle | 6 +- js/Linear/DELAY_f.js | 125 +++--- js/Linear/DELAY_f.pickle | 6 +- js/Linear/DERIV.js | 5 +- js/Linear/DERIV.pickle | 6 +- js/Linear/DIFF_c.js | 61 +-- js/Linear/DIFF_c.pickle | 6 +- js/Linear/DLR.js | 75 ++-- js/Linear/DLR.pickle | 6 +- js/Linear/DLR_f.js | 75 ++-- js/Linear/DLR_f.pickle | 6 +- js/Linear/DLSS.js | 109 ++--- js/Linear/DLSS.pickle | 6 +- js/Linear/DLSS_f.js | 89 ++-- js/Linear/DLSS_f.pickle | 6 +- js/Linear/DOLLAR.js | 123 +++--- js/Linear/DOLLAR.pickle | 8 +- js/Linear/DOLLAR_f.js | 53 +-- js/Linear/DOLLAR_f.pickle | 6 +- js/Linear/DOLLAR_m.js | 123 +++--- js/Linear/DOLLAR_m.pickle | 8 +- js/Linear/GAINBLK.js | 231 +++++------ js/Linear/GAINBLK.pickle | 6 +- js/Linear/GAINBLK_f.js | 41 +- js/Linear/GAINBLK_f.pickle | 6 +- js/Linear/GAIN_f.js | 41 +- js/Linear/GAIN_f.pickle | 6 +- js/Linear/INTEGRAL.js | 105 ++--- js/Linear/INTEGRAL.pickle | 6 +- js/Linear/INTEGRAL_f.js | 27 +- js/Linear/INTEGRAL_f.pickle | 6 +- js/Linear/INTEGRAL_m.js | 187 ++++----- js/Linear/INTEGRAL_m.pickle | 6 +- js/Linear/PID.js | 107 ++--- js/Linear/PID.pickle | 6 +- js/Linear/REGISTER.js | 109 ++--- js/Linear/REGISTER.pickle | 6 +- js/Linear/REGISTER_f.js | 37 +- js/Linear/REGISTER_f.pickle | 6 +- js/Linear/SAMPHOLD.js | 7 +- js/Linear/SAMPHOLD.pickle | 6 +- js/Linear/SAMPHOLD_m.js | 47 +-- js/Linear/SAMPHOLD_m.pickle | 6 +- js/Linear/SAMPLEHOLD_f.js | 7 +- js/Linear/SAMPLEHOLD_f.pickle | 6 +- js/Linear/SOM_f.js | 21 +- js/Linear/SOM_f.pickle | 6 +- js/Linear/SUMMATION.js | 217 +++++----- js/Linear/SUMMATION.pickle | 6 +- js/Linear/SUM_f.js | 5 +- js/Linear/SUM_f.pickle | 6 +- js/Linear/TCLSS.js | 99 ++--- js/Linear/TCLSS.pickle | 6 +- js/Linear/TCLSS_f.js | 99 ++--- js/Linear/TCLSS_f.pickle | 6 +- js/Linear/TIME_DELAY.js | 55 +-- js/Linear/TIME_DELAY.pickle | 6 +- js/Linear/VARIABLE_DELAY.js | 53 +-- js/Linear/VARIABLE_DELAY.pickle | 6 +- js/MatrixOp/CUMSUM.js | 115 +++--- js/MatrixOp/CUMSUM.pickle | 6 +- js/MatrixOp/EXTRACT.js | 111 ++--- js/MatrixOp/EXTRACT.pickle | 6 +- js/MatrixOp/EXTTRI.js | 109 ++--- js/MatrixOp/EXTTRI.pickle | 6 +- js/MatrixOp/MATBKSL.js | 69 ++-- js/MatrixOp/MATBKSL.pickle | 6 +- js/MatrixOp/MATCATH.js | 49 +-- js/MatrixOp/MATCATH.pickle | 6 +- js/MatrixOp/MATCATV.js | 49 +-- js/MatrixOp/MATCATV.pickle | 6 +- js/MatrixOp/MATDET.js | 69 ++-- js/MatrixOp/MATDET.pickle | 6 +- js/MatrixOp/MATDIAG.js | 69 ++-- js/MatrixOp/MATDIAG.pickle | 6 +- js/MatrixOp/MATDIV.js | 69 ++-- js/MatrixOp/MATDIV.pickle | 6 +- js/MatrixOp/MATEIG.js | 111 ++--- js/MatrixOp/MATEIG.pickle | 6 +- js/MatrixOp/MATEXPM.js | 69 ++-- js/MatrixOp/MATEXPM.pickle | 6 +- js/MatrixOp/MATINV.js | 69 ++-- js/MatrixOp/MATINV.pickle | 6 +- js/MatrixOp/MATLU.js | 65 +-- js/MatrixOp/MATLU.pickle | 6 +- js/MatrixOp/MATMAGPHI.js | 77 ++-- js/MatrixOp/MATMAGPHI.pickle | 6 +- js/MatrixOp/MATMUL.js | 251 ++++++------ js/MatrixOp/MATMUL.pickle | 6 +- js/MatrixOp/MATPINV.js | 69 ++-- js/MatrixOp/MATPINV.pickle | 6 +- js/MatrixOp/MATRESH.js | 119 +++--- js/MatrixOp/MATRESH.pickle | 6 +- js/MatrixOp/MATSING.js | 117 +++--- js/MatrixOp/MATSING.pickle | 6 +- js/MatrixOp/MATSUM.js | 119 +++--- js/MatrixOp/MATSUM.pickle | 6 +- js/MatrixOp/MATTRAN.js | 77 ++-- js/MatrixOp/MATTRAN.pickle | 6 +- js/MatrixOp/MATZCONJ.js | 5 +- js/MatrixOp/MATZCONJ.pickle | 6 +- js/MatrixOp/MATZREIM.js | 77 ++-- js/MatrixOp/MATZREIM.pickle | 6 +- js/MatrixOp/RICC.js | 47 +-- js/MatrixOp/RICC.pickle | 6 +- js/MatrixOp/ROOTCOEF.js | 69 ++-- js/MatrixOp/ROOTCOEF.pickle | 6 +- js/MatrixOp/SQRT.js | 61 +-- js/MatrixOp/SQRT.pickle | 6 +- js/MatrixOp/SUBMAT.js | 111 ++--- js/MatrixOp/SUBMAT.pickle | 6 +- js/Misc/AUTOMAT.js | 187 ++++----- js/Misc/AUTOMAT.pickle | 14 +- js/Misc/BACKLASH.js | 43 +- js/Misc/BACKLASH.pickle | 6 +- js/Misc/BOUNCE.js | 137 ++++--- js/Misc/BOUNCE.pickle | 6 +- js/Misc/BOUNCEXY.js | 109 ++--- js/Misc/BOUNCEXY.pickle | 6 +- js/Misc/BPLATFORM.js | 61 +-- js/Misc/BPLATFORM.pickle | 6 +- js/Misc/CBLOCK.js | 171 ++++---- js/Misc/CBLOCK.pickle | 6 +- js/Misc/CBLOCK4.js | 167 ++++---- js/Misc/CBLOCK4.pickle | 8 +- js/Misc/CONSTRAINT2_c.js | 89 ++-- js/Misc/CONSTRAINT2_c.pickle | 6 +- js/Misc/CONSTRAINT_c.js | 49 +-- js/Misc/CONSTRAINT_c.pickle | 6 +- js/Misc/DEADBAND.js | 49 +-- js/Misc/DEADBAND.pickle | 6 +- js/Misc/DEBUG.js | 53 +-- js/Misc/DEBUG.pickle | 10 +- js/Misc/DEBUG_SCICOS.js | 5 +- js/Misc/DEBUG_SCICOS.pickle | 6 +- js/Misc/DIFF_f.js | 27 +- js/Misc/DIFF_f.pickle | 6 +- js/Misc/DSUPER.js | 47 +-- js/Misc/DSUPER.pickle | 8 +- js/Misc/EDGETRIGGER.js | 25 +- js/Misc/EDGETRIGGER.pickle | 6 +- js/Misc/EDGE_TRIGGER.js | 133 +++--- js/Misc/EDGE_TRIGGER.pickle | 10 +- js/Misc/ENDBLK.js | 129 +++--- js/Misc/ENDBLK.pickle | 10 +- js/Misc/EXPRESSION.pickle | 8 +- js/Misc/Extract_Activation.js | 9 +- js/Misc/Extract_Activation.pickle | 6 +- js/Misc/HYSTHERESIS.js | 41 +- js/Misc/HYSTHERESIS.pickle | 6 +- js/Misc/IMPSPLIT_f.js | 9 +- js/Misc/IMPSPLIT_f.pickle | 6 +- js/Misc/LOGICAL_OP.js | 169 ++++---- js/Misc/LOGICAL_OP.pickle | 6 +- js/Misc/MBLOCK.js | 465 ++++++++++----------- js/Misc/MBLOCK.pickle | 10 +- js/Misc/MEMORY_f.js | 57 +-- js/Misc/MEMORY_f.pickle | 6 +- js/Misc/MPBLOCK.js | 449 ++++++++++---------- js/Misc/MPBLOCK.pickle | 10 +- js/Misc/PAL_f.js | 15 +- js/Misc/PAL_f.pickle | 6 +- js/Misc/PENDULUM_ANIM.js | 61 +-- js/Misc/PENDULUM_ANIM.pickle | 6 +- js/Misc/RATELIMITER.js | 35 +- js/Misc/RATELIMITER.pickle | 6 +- js/Misc/RELATIONALOP.js | 133 +++--- js/Misc/RELATIONALOP.pickle | 6 +- js/Misc/SPLIT_f.js | 5 +- js/Misc/SPLIT_f.pickle | 6 +- js/Misc/SUPER_f.js | 5 +- js/Misc/SUPER_f.pickle | 6 +- js/Misc/TEXT_f.js | 77 ++-- js/Misc/TEXT_f.pickle | 6 +- js/Misc/c_block.js | 69 ++-- js/Misc/c_block.pickle | 6 +- js/Misc/fortran_block.js | 69 ++-- js/Misc/fortran_block.pickle | 6 +- js/Misc/func_block.js | 17 +- js/Misc/func_block.pickle | 8 +- js/Misc/generic_block.js | 129 +++--- js/Misc/generic_block.pickle | 6 +- js/Misc/generic_block2.js | 133 +++--- js/Misc/generic_block2.pickle | 6 +- js/Misc/generic_block3.js | 149 +++---- js/Misc/generic_block3.pickle | 8 +- js/Misc/scifunc_block.js | 101 ++--- js/Misc/scifunc_block.pickle | 6 +- js/Misc/scifunc_block_m.js | 97 ++--- js/Misc/scifunc_block_m.pickle | 6 +- js/NonLinear/ABSBLK_f.js | 5 +- js/NonLinear/ABSBLK_f.pickle | 6 +- js/NonLinear/ABS_VALUE.js | 41 +- js/NonLinear/ABS_VALUE.pickle | 6 +- js/NonLinear/COSBLK_f.js | 5 +- js/NonLinear/COSBLK_f.pickle | 6 +- js/NonLinear/DLRADAPT_f.js | 49 +-- js/NonLinear/DLRADAPT_f.pickle | 6 +- js/NonLinear/EXPBLK_f.js | 37 +- js/NonLinear/EXPBLK_f.pickle | 6 +- js/NonLinear/EXPBLK_m.js | 37 +- js/NonLinear/EXPBLK_m.pickle | 6 +- js/NonLinear/FSV_f.js | 5 +- js/NonLinear/FSV_f.pickle | 6 +- js/NonLinear/INTRP2BLK_f.js | 43 +- js/NonLinear/INTRP2BLK_f.pickle | 6 +- js/NonLinear/INTRPLBLK_f.js | 41 +- js/NonLinear/INTRPLBLK_f.pickle | 6 +- js/NonLinear/INVBLK.js | 5 +- js/NonLinear/INVBLK.pickle | 6 +- js/NonLinear/INVBLK_f.js | 5 +- js/NonLinear/INVBLK_f.pickle | 6 +- js/NonLinear/LOGBLK_f.js | 41 +- js/NonLinear/LOGBLK_f.pickle | 6 +- js/NonLinear/LOOKUP2D.js | 129 +++--- js/NonLinear/LOOKUP2D.pickle | 8 +- js/NonLinear/LOOKUP_c.pickle | 8 +- js/NonLinear/LOOKUP_f.js | 47 +-- js/NonLinear/LOOKUP_f.pickle | 6 +- js/NonLinear/MAXMIN.js | 89 ++-- js/NonLinear/MAXMIN.pickle | 6 +- js/NonLinear/MAX_f.js | 5 +- js/NonLinear/MAX_f.pickle | 6 +- js/NonLinear/MIN_f.js | 5 +- js/NonLinear/MIN_f.pickle | 6 +- js/NonLinear/POWBLK_f.js | 43 +- js/NonLinear/POWBLK_f.pickle | 6 +- js/NonLinear/PRODUCT.js | 81 ++-- js/NonLinear/PRODUCT.pickle | 6 +- js/NonLinear/PROD_f.js | 5 +- js/NonLinear/PROD_f.pickle | 6 +- js/NonLinear/QUANT_f.js | 57 +-- js/NonLinear/QUANT_f.pickle | 6 +- js/NonLinear/SATURATION.js | 49 +-- js/NonLinear/SATURATION.pickle | 6 +- js/NonLinear/SAT_f.js | 41 +- js/NonLinear/SAT_f.pickle | 6 +- js/NonLinear/SIGNUM.js | 41 +- js/NonLinear/SIGNUM.pickle | 6 +- js/NonLinear/SINBLK_f.js | 5 +- js/NonLinear/SINBLK_f.pickle | 6 +- js/NonLinear/TANBLK_f.js | 7 +- js/NonLinear/TANBLK_f.pickle | 6 +- js/NonLinear/TrigFun.js | 33 +- js/NonLinear/TrigFun.pickle | 6 +- js/PDE/PDE.js | 213 +++++----- js/PDE/PDE.pickle | 8 +- js/Sinks/AFFICH_m.js | 93 ++--- js/Sinks/AFFICH_m.pickle | 6 +- js/Sinks/BARXY.js | 67 +-- js/Sinks/BARXY.pickle | 6 +- js/Sinks/CANIMXY.js | 123 +++--- js/Sinks/CANIMXY.pickle | 6 +- js/Sinks/CANIMXY3D.js | 157 +++---- js/Sinks/CANIMXY3D.pickle | 6 +- js/Sinks/CEVENTSCOPE.js | 113 ++--- js/Sinks/CEVENTSCOPE.pickle | 6 +- js/Sinks/CFSCOPE.js | 127 +++--- js/Sinks/CFSCOPE.pickle | 6 +- js/Sinks/CLKOUTV_f.js | 37 +- js/Sinks/CLKOUTV_f.pickle | 16 +- js/Sinks/CLKOUT_f.js | 39 +- js/Sinks/CLKOUT_f.pickle | 6 +- js/Sinks/CMAT3D.js | 69 ++-- js/Sinks/CMAT3D.pickle | 8 +- js/Sinks/CMATVIEW.js | 59 +-- js/Sinks/CMATVIEW.pickle | 8 +- js/Sinks/CMSCOPE.js | 177 ++++---- js/Sinks/CMSCOPE.pickle | 6 +- js/Sinks/CSCOPE.js | 123 +++--- js/Sinks/CSCOPE.pickle | 6 +- js/Sinks/CSCOPXY.js | 123 +++--- js/Sinks/CSCOPXY.pickle | 6 +- js/Sinks/CSCOPXY3D.js | 149 +++---- js/Sinks/CSCOPXY3D.pickle | 6 +- js/Sinks/OUTIMPL_f.js | 49 +-- js/Sinks/OUTIMPL_f.pickle | 6 +- js/Sinks/OUT_f.js | 39 +- js/Sinks/OUT_f.pickle | 6 +- js/Sinks/TOWS_c.js | 63 +-- js/Sinks/TOWS_c.pickle | 8 +- js/Sinks/TRASH_f.js | 5 +- js/Sinks/TRASH_f.pickle | 6 +- js/Sinks/WFILE_f.js | 105 ++--- js/Sinks/WFILE_f.pickle | 8 +- js/Sinks/WRITEAU_f.js | 69 ++-- js/Sinks/WRITEAU_f.pickle | 8 +- js/Sinks/WRITEC_f.js | 107 ++--- js/Sinks/WRITEC_f.pickle | 10 +- js/Sources/CLKINV_f.js | 39 +- js/Sources/CLKINV_f.pickle | 6 +- js/Sources/CLKIN_f.js | 39 +- js/Sources/CLKIN_f.pickle | 6 +- js/Sources/CLOCK_c.js | 83 ++-- js/Sources/CLOCK_c.pickle | 8 +- js/Sources/CLOCK_f.js | 83 ++-- js/Sources/CLOCK_f.pickle | 6 +- js/Sources/CONST.js | 43 +- js/Sources/CONST.pickle | 6 +- js/Sources/CONST_f.js | 37 +- js/Sources/CONST_f.pickle | 6 +- js/Sources/CONST_m.js | 89 ++-- js/Sources/CONST_m.pickle | 8 +- js/Sources/CURVE_c.pickle | 8 +- js/Sources/CURV_f.js | 57 +-- js/Sources/CURV_f.pickle | 6 +- js/Sources/Counter.js | 43 +- js/Sources/Counter.pickle | 6 +- js/Sources/FROMWSB.js | 129 +++--- js/Sources/FROMWSB.pickle | 10 +- js/Sources/FROMWS_c.js | 71 ++-- js/Sources/FROMWS_c.pickle | 6 +- js/Sources/GENSIN_f.js | 43 +- js/Sources/GENSIN_f.pickle | 6 +- js/Sources/GENSQR_f.js | 33 +- js/Sources/GENSQR_f.pickle | 6 +- js/Sources/GEN_SQR.js | 45 +- js/Sources/GEN_SQR.pickle | 6 +- js/Sources/Ground_g.js | 5 +- js/Sources/Ground_g.pickle | 6 +- js/Sources/INIMPL_f.js | 49 +-- js/Sources/INIMPL_f.pickle | 6 +- js/Sources/IN_f.js | 67 +-- js/Sources/IN_f.pickle | 6 +- js/Sources/Modulo_Count.js | 43 +- js/Sources/Modulo_Count.pickle | 6 +- js/Sources/PULSE_SC.js | 49 +-- js/Sources/PULSE_SC.pickle | 6 +- js/Sources/RAMP.js | 33 +- js/Sources/RAMP.pickle | 6 +- js/Sources/RAND_f.js | 49 +-- js/Sources/RAND_f.pickle | 6 +- js/Sources/RAND_m.js | 79 ++-- js/Sources/RAND_m.pickle | 6 +- js/Sources/READAU_f.js | 81 ++-- js/Sources/READAU_f.pickle | 8 +- js/Sources/READC_f.js | 141 +++---- js/Sources/READC_f.pickle | 8 +- js/Sources/RFILE_f.js | 121 +++--- js/Sources/RFILE_f.pickle | 6 +- js/Sources/SAWTOOTH_f.js | 5 +- js/Sources/SAWTOOTH_f.pickle | 6 +- js/Sources/STEP.js | 75 ++-- js/Sources/STEP.pickle | 6 +- js/Sources/STEP_FUNCTION.js | 125 +++--- js/Sources/STEP_FUNCTION.pickle | 10 +- js/Sources/SampleCLK.js | 59 +-- js/Sources/SampleCLK.pickle | 6 +- js/Sources/Sigbuilder.js | 129 +++--- js/Sources/Sigbuilder.pickle | 16 +- js/Sources/TIME_f.js | 5 +- js/Sources/TIME_f.pickle | 6 +- js/Sources/TKSCALE.js | 15 +- js/Sources/TKSCALE.pickle | 6 +- js/Threshold/GENERAL_f.js | 49 +-- js/Threshold/GENERAL_f.pickle | 6 +- js/Threshold/NEGTOPOS_f.js | 7 +- js/Threshold/NEGTOPOS_f.pickle | 6 +- js/Threshold/POSTONEG_f.js | 7 +- js/Threshold/POSTONEG_f.pickle | 6 +- js/Threshold/ZCROSS_f.js | 49 +-- js/Threshold/ZCROSS_f.pickle | 6 +- 544 files changed, 10626 insertions(+), 9808 deletions(-) (limited to 'js') diff --git a/js/Branching/CLKFROM.js b/js/Branching/CLKFROM.js index 3f33b7be..168cf14d 100644 --- a/js/Branching/CLKFROM.js +++ b/js/Branching/CLKFROM.js @@ -9,35 +9,36 @@ function CLKFROM() { model.firing = -1; model.dep_ut = [false,false]; exprs = "A"; - x = standard_define([2,1],model,exprs," "); - x.graphics.id = "From"; + this.x = standard_define([2,1],model,exprs," "); + this.x.graphics.id = "From"; } CLKFROM.prototype.details = function CLKFROM() { + return this.x; } CLKFROM.prototype.get = function CLKFROM() { } CLKFROM.prototype.set = function CLKFROM() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,tag,exprs] = scicos_getvalue("Set block parameters","Tag",list("str",-1),exprs); - if (!ok) { -break; -} - if (model.opar!=list(tag)) { - needcompile = 4; - y = needcompile; -} - model.opar = list(tag); - model.evtout = 1; - model.firing = -1; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -needcompile=resume(needcompile) + [ok,tag,exprs] = scicos_getvalue("Set block parameters","Tag",list("str",-1),exprs); + if (!ok) { + break; + } + if (model.opar!=list(tag)) { + needcompile = 4; + y = needcompile; + } + model.opar = list(tag); + model.evtout = 1; + model.firing = -1; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + needcompile=resume(needcompile) } } diff --git a/js/Branching/CLKFROM.pickle b/js/Branching/CLKFROM.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/CLKFROM.pickle +++ b/js/Branching/CLKFROM.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/CLKGOTO.js b/js/Branching/CLKGOTO.js index e3698ab9..79bce050 100644 --- a/js/Branching/CLKGOTO.js +++ b/js/Branching/CLKGOTO.js @@ -10,43 +10,44 @@ function CLKGOTO() { model.firing = -1; model.dep_ut = [false,false]; exprs = [["A"],[sci2exp(1)]]; - x = standard_define([2,1],model,exprs," "); - x.graphics.id = "Goto"; + this.x = standard_define([2,1],model,exprs," "); + this.x.graphics.id = "Goto"; } CLKGOTO.prototype.details = function CLKGOTO() { + return this.x; } CLKGOTO.prototype.get = function CLKGOTO() { } CLKGOTO.prototype.set = function CLKGOTO() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,tag,tagvis,exprs] = scicos_getvalue("Set block parameters",[["Tag"],["Tag Visibility (1=Local 2=Scoped 3=Global)"]],list("str",-1,"vec",1),exprs); - if (!ok) { -break; -} - if (((tagvis<1)||(tagvis>3))) { -message("Tag Visibility must be between 1 and 3"); - ok = false; -} - tagvis = int(tagvis); - if (ok) { - if (((model.opar!=list(tag))||(model.ipar!=tagvis))) { - needcompile = 4; - y = needcompile; -} - model.opar = list(tag); - model.ipar = tagvis; - model.evtin = 1; - model.firing = -1; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -needcompile=resume(needcompile) + [ok,tag,tagvis,exprs] = scicos_getvalue("Set block parameters",[["Tag"],["Tag Visibility (1=Local 2=Scoped 3=Global)"]],list("str",-1,"vec",1),exprs); + if (!ok) { + break; + } + if (((tagvis<1)||(tagvis>3))) { + message("Tag Visibility must be between 1 and 3"); + ok = false; + } + tagvis = int(tagvis); + if (ok) { + if (((model.opar!=list(tag))||(model.ipar!=tagvis))) { + needcompile = 4; + y = needcompile; + } + model.opar = list(tag); + model.ipar = tagvis; + model.evtin = 1; + model.firing = -1; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Branching/CLKGOTO.pickle b/js/Branching/CLKGOTO.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/CLKGOTO.pickle +++ b/js/Branching/CLKGOTO.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/CLKGotoTagVisibility.js b/js/Branching/CLKGotoTagVisibility.js index 44d58cc1..d9fcb9de 100644 --- a/js/Branching/CLKGotoTagVisibility.js +++ b/js/Branching/CLKGotoTagVisibility.js @@ -16,34 +16,35 @@ function CLKGotoTagVisibility() { model.dep_ut = [false,false]; exprs = "A"; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CLKGotoTagVisibility.prototype.details = function CLKGotoTagVisibility() { + return this.x; } CLKGotoTagVisibility.prototype.get = function CLKGotoTagVisibility() { } CLKGotoTagVisibility.prototype.set = function CLKGotoTagVisibility() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,tag,exprs] = scicos_getvalue("Set parameters",["GotoTag"],list("str",-1),exprs); - if (!ok) { -break; -} - if (ok) { - if (model.opar!=list(tag)) { - needcompile = 4; - y = needcompile; -} - graphics.exprs = exprs; - model.opar = list(tag); - x.graphics = graphics; - x.model = model; -break; -} -} -needcompile=resume(needcompile) + [ok,tag,exprs] = scicos_getvalue("Set parameters",["GotoTag"],list("str",-1),exprs); + if (!ok) { + break; + } + if (ok) { + if (model.opar!=list(tag)) { + needcompile = 4; + y = needcompile; + } + graphics.exprs = exprs; + model.opar = list(tag); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Branching/CLKGotoTagVisibility.pickle b/js/Branching/CLKGotoTagVisibility.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/CLKGotoTagVisibility.pickle +++ b/js/Branching/CLKGotoTagVisibility.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/DEMUX.js b/js/Branching/DEMUX.js index 22d11572..1245ea5b 100644 --- a/js/Branching/DEMUX.js +++ b/js/Branching/DEMUX.js @@ -12,52 +12,53 @@ function DEMUX() { model.dep_ut = [true,false]; exprs = string(out); gr_i = []; - x = standard_define([.5,2],model,exprs,gr_i); + this.x = standard_define([.5,2],model,exprs,gr_i); } DEMUX.prototype.details = function DEMUX() { + return this.x; } DEMUX.prototype.get = function DEMUX() { } DEMUX.prototype.set = function DEMUX() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,out,exprs] = scicos_getvalue("Set DEMUX block parameters",["number of output ports or vector of sizes"],list("intvec",-1),exprs); - if (!ok) { -break; -} - if (size(out,"*")==1) { - if (out<2||out>31) { -message("Block must have at least 2 and at most 31 output ports"); - ok = false; - } else { - [model,graphics,ok] = check_io(model,graphics,0,-transpose([1:out]),[],[]); -} - } else { - if (size(out,"*")<2||or(out==0)||size(out,"*")>31) { -message([["Block must have at least 2 and at most 31 output ports"],["size 0 is not allowed"]]); - ok = false; - } else { - if (min(out)<0) { - nin = 0; - } else { - nin = sum(out); -} - [model,graphics,ok] = check_io(model,graphics,nin,out.slice(),[],[]); - if (ok) { - out = size(out,"*"); -} -} -} - if (ok) { - graphics.exprs = exprs; - model.ipar = out; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,out,exprs] = scicos_getvalue("Set DEMUX block parameters",["number of output ports or vector of sizes"],list("intvec",-1),exprs); + if (!ok) { + break; + } + if (size(out,"*")==1) { + if (out<2||out>31) { + message("Block must have at least 2 and at most 31 output ports"); + ok = false; + } else { + [model,graphics,ok] = check_io(model,graphics,0,-transpose([1:out]),[],[]); + } + } else { + if (size(out,"*")<2||or(out==0)||size(out,"*")>31) { + message([["Block must have at least 2 and at most 31 output ports"],["size 0 is not allowed"]]); + ok = false; + } else { + if (min(out)<0) { + nin = 0; + } else { + nin = sum(out); + } + [model,graphics,ok] = check_io(model,graphics,nin,out.slice(),[],[]); + if (ok) { + out = size(out,"*"); + } + } + } + if (ok) { + graphics.exprs = exprs; + model.ipar = out; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Branching/DEMUX.pickle b/js/Branching/DEMUX.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/DEMUX.pickle +++ b/js/Branching/DEMUX.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/DEMUX_f.js b/js/Branching/DEMUX_f.js index 8d9cb7eb..77c36dfd 100644 --- a/js/Branching/DEMUX_f.js +++ b/js/Branching/DEMUX_f.js @@ -12,52 +12,53 @@ function DEMUX_f() { model.dep_ut = [true,false]; exprs = string(out); gr_i = []; - x = standard_define([.5,2],model,exprs,gr_i); + this.x = standard_define([.5,2],model,exprs,gr_i); } DEMUX_f.prototype.details = function DEMUX_f() { + return this.x; } DEMUX_f.prototype.get = function DEMUX_f() { } DEMUX_f.prototype.set = function DEMUX_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,out,exprs] = scicos_getvalue("Set DEMUX block parameters",["number of output ports or vector of sizes"],list("vec",-1),exprs); - if (!ok) { -break; -} - if (size(out,"*")==1) { - if (out<2||out>8) { -message("Block must have at least 2 and at most 8 output ports"); - ok = false; - } else { - [model,graphics,ok] = check_io(model,graphics,0,-transpose([1:out]),[],[]); -} - } else { - if (size(out,"*")<2||size(out,"*")>8||or(out==0)) { -message([["Block must have at least 2 and at most 8 output ports"],["and size 0 is not allowed"]]); - ok = false; - } else { - if (min(out)<0) { - nin = 0; - } else { - nin = sum(out); -} - [model,graphics,ok] = check_io(model,graphics,nin,out.slice(),[],[]); - if (ok) { - out = size(out,"*"); -} -} -} - if (ok) { - graphics.exprs = exprs; - model.ipar = out; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,out,exprs] = scicos_getvalue("Set DEMUX block parameters",["number of output ports or vector of sizes"],list("vec",-1),exprs); + if (!ok) { + break; + } + if (size(out,"*")==1) { + if (out<2||out>8) { + message("Block must have at least 2 and at most 8 output ports"); + ok = false; + } else { + [model,graphics,ok] = check_io(model,graphics,0,-transpose([1:out]),[],[]); + } + } else { + if (size(out,"*")<2||size(out,"*")>8||or(out==0)) { + message([["Block must have at least 2 and at most 8 output ports"],["and size 0 is not allowed"]]); + ok = false; + } else { + if (min(out)<0) { + nin = 0; + } else { + nin = sum(out); + } + [model,graphics,ok] = check_io(model,graphics,nin,out.slice(),[],[]); + if (ok) { + out = size(out,"*"); + } + } + } + if (ok) { + graphics.exprs = exprs; + model.ipar = out; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Branching/DEMUX_f.pickle b/js/Branching/DEMUX_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/DEMUX_f.pickle +++ b/js/Branching/DEMUX_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/ESELECT_f.js b/js/Branching/ESELECT_f.js index 663b7638..ccfb0fe2 100644 --- a/js/Branching/ESELECT_f.js +++ b/js/Branching/ESELECT_f.js @@ -16,52 +16,53 @@ function ESELECT_f() { model.nzcross = 0; gr_i = []; exprs = [[string(out)],[string(1)],[string(model.nmode)]]; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } ESELECT_f.prototype.details = function ESELECT_f() { + return this.x; } ESELECT_f.prototype.get = function ESELECT_f() { } ESELECT_f.prototype.set = function ESELECT_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; if (size(exprs,"*")==1) { - exprs[2-1] = string(1); -} + exprs[2-1] = string(1); + } if (size(exprs,"*")==2) { - exprs[3-1] = string(0); -} + exprs[3-1] = string(0); + } model = arg1.model; while (true) { - [ok,out,inh,nmod,exprs] = scicos_getvalue("Set ESELECT block parameters",[["number of output event ports"],["Inherit (1: no, 0: yes)"],["zero-crossing (0: no, 1: yes)"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (nmod!=0) { - nmod = 1; -} - if (inh==0) { - inh = []; - } else { - inh = 1; -} - out = int(out); - if (out<2) { -message("Block must have at least two output ports"); - } else { - [model,graphics,ok] = check_io(model,graphics,1,[],inh,[ones(out,1)]); - if (ok) { - graphics.exprs = exprs; - model.evtout = ones(out,1); - model.firing = -ones(out,1); - x.graphics = graphics; - model.nmode = nmod; - model.nzcross = nmod; - x.model = model; -break; -} -} -} + [ok,out,inh,nmod,exprs] = scicos_getvalue("Set ESELECT block parameters",[["number of output event ports"],["Inherit (1: no, 0: yes)"],["zero-crossing (0: no, 1: yes)"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (nmod!=0) { + nmod = 1; + } + if (inh==0) { + inh = []; + } else { + inh = 1; + } + out = int(out); + if (out<2) { + message("Block must have at least two output ports"); + } else { + [model,graphics,ok] = check_io(model,graphics,1,[],inh,[ones(out,1)]); + if (ok) { + graphics.exprs = exprs; + model.evtout = ones(out,1); + model.firing = -ones(out,1); + this.x.graphics = graphics; + model.nmode = nmod; + model.nzcross = nmod; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Branching/ESELECT_f.pickle b/js/Branching/ESELECT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/ESELECT_f.pickle +++ b/js/Branching/ESELECT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/EXTRACTOR.js b/js/Branching/EXTRACTOR.js index c904bda2..ed4a336f 100644 --- a/js/Branching/EXTRACTOR.js +++ b/js/Branching/EXTRACTOR.js @@ -11,32 +11,33 @@ function EXTRACTOR() { model.ipar = ind; exprs = [sci2exp(ind)]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } EXTRACTOR.prototype.details = function EXTRACTOR() { + return this.x; } EXTRACTOR.prototype.get = function EXTRACTOR() { } EXTRACTOR.prototype.set = function EXTRACTOR() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,ind,exprs] = scicos_getvalue("Set block parameters",["indices to extract"],list("vec",-1),exprs); - if (!ok) { -break; -} - ind = int(ind); - ind = ind.slice(); - [model,graphics,ok] = check_io(model,graphics,[-1],size(ind,1),[],[]); - if (ok) { - model.ipar = ind; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,ind,exprs] = scicos_getvalue("Set block parameters",["indices to extract"],list("vec",-1),exprs); + if (!ok) { + break; + } + ind = int(ind); + ind = ind.slice(); + [model,graphics,ok] = check_io(model,graphics,[-1],size(ind,1),[],[]); + if (ok) { + model.ipar = ind; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Branching/EXTRACTOR.pickle b/js/Branching/EXTRACTOR.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/EXTRACTOR.pickle +++ b/js/Branching/EXTRACTOR.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/FROM.js b/js/Branching/FROM.js index 3317192f..1f582691 100644 --- a/js/Branching/FROM.js +++ b/js/Branching/FROM.js @@ -15,35 +15,36 @@ function FROM() { model.dep_ut = [false,false]; exprs = ["A"]; gr_i = []; - x = standard_define([2,1],model,exprs,gr_i); - x.graphics.id = "From"; + this.x = standard_define([2,1],model,exprs,gr_i); + this.x.graphics.id = "From"; } FROM.prototype.details = function FROM() { + return this.x; } FROM.prototype.get = function FROM() { } FROM.prototype.set = function FROM() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,tag,exprs] = scicos_getvalue("Set parameters",["Tag"],list("str",-1),exprs); - if (!ok) { -break; -} - if (ok) { - if (model.opar!=list(tag)) { - needcompile = 4; - y = needcompile; -} - graphics.exprs = exprs; - model.opar = list(tag); - x.model = model; - x.graphics = graphics; -break; -} -} -needcompile=resume(needcompile) + [ok,tag,exprs] = scicos_getvalue("Set parameters",["Tag"],list("str",-1),exprs); + if (!ok) { + break; + } + if (ok) { + if (model.opar!=list(tag)) { + needcompile = 4; + y = needcompile; + } + graphics.exprs = exprs; + model.opar = list(tag); + this.x.model = model; + this.x.graphics = graphics; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Branching/FROM.pickle b/js/Branching/FROM.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/FROM.pickle +++ b/js/Branching/FROM.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/FROMMO.js b/js/Branching/FROMMO.js index c026068b..ac7ed5aa 100644 --- a/js/Branching/FROMMO.js +++ b/js/Branching/FROMMO.js @@ -18,35 +18,36 @@ function FROMMO() { mo.outputs = "n"; exprs = ["A"]; gr_i = []; - x = standard_define([2,1],model,exprs,gr_i); - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,1],model,exprs,gr_i); + this.x.graphics.out_implicit = ["I"]; } FROMMO.prototype.details = function FROMMO() { + return this.x; } FROMMO.prototype.get = function FROMMO() { } FROMMO.prototype.set = function FROMMO() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,tag,exprs] = scicos_getvalue("Set parameters",["Tag"],list("str",-1),exprs); - if (!ok) { -break; -} - if (ok) { - if (model.opar!=list(tag)) { - needcompile = 4; - y = needcompile; -} - graphics.exprs = exprs; - model.opar = list(tag); - x.model = model; - x.graphics = graphics; -break; -} -} -needcompile=resume(needcompile) + [ok,tag,exprs] = scicos_getvalue("Set parameters",["Tag"],list("str",-1),exprs); + if (!ok) { + break; + } + if (ok) { + if (model.opar!=list(tag)) { + needcompile = 4; + y = needcompile; + } + graphics.exprs = exprs; + model.opar = list(tag); + this.x.model = model; + this.x.graphics = graphics; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Branching/FROMMO.pickle b/js/Branching/FROMMO.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/FROMMO.pickle +++ b/js/Branching/FROMMO.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/GOTO.js b/js/Branching/GOTO.js index ec23ad47..c7355935 100644 --- a/js/Branching/GOTO.js +++ b/js/Branching/GOTO.js @@ -15,42 +15,43 @@ function GOTO() { model.dep_ut = [false,false]; exprs = [["A"],[sci2exp(1)]]; gr_i = []; - x = standard_define([2,1],model,exprs,gr_i); - x.graphics.id = "Goto"; + this.x = standard_define([2,1],model,exprs,gr_i); + this.x.graphics.id = "Goto"; } GOTO.prototype.details = function GOTO() { + return this.x; } GOTO.prototype.get = function GOTO() { } GOTO.prototype.set = function GOTO() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,tag,tagvis,exprs] = scicos_getvalue("Set parameters",[["Tag"],["Tag Visibility(1=Local 2=scoped 3= global)"]],list("str",-1,"vec",1),exprs); - if (!ok) { -break; -} - tagvis = int(tagvis); - if (((tagvis<1)||(tagvis>3))) { -message("Tag Visibility must be between 1 and 3"); - ok = false; -} - if (ok) { - if (((model.ipar!=tagvis)||(model.opar!=list(tag)))) { - needcompile = 4; - y = needcompile; -} - graphics.exprs = exprs; - model.opar = list(tag); - model.ipar = tagvis; - x.model = model; - x.graphics = graphics; - arg1 = x; -break; -} -} -needcompile=resume(needcompile) + [ok,tag,tagvis,exprs] = scicos_getvalue("Set parameters",[["Tag"],["Tag Visibility(1=Local 2=scoped 3= global)"]],list("str",-1,"vec",1),exprs); + if (!ok) { + break; + } + tagvis = int(tagvis); + if (((tagvis<1)||(tagvis>3))) { + message("Tag Visibility must be between 1 and 3"); + ok = false; + } + if (ok) { + if (((model.ipar!=tagvis)||(model.opar!=list(tag)))) { + needcompile = 4; + y = needcompile; + } + graphics.exprs = exprs; + model.opar = list(tag); + model.ipar = tagvis; + this.x.model = model; + this.x.graphics = graphics; + arg1 = this.x; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Branching/GOTO.pickle b/js/Branching/GOTO.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/GOTO.pickle +++ b/js/Branching/GOTO.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/GOTOMO.js b/js/Branching/GOTOMO.js index 8ab01276..1ed448ab 100644 --- a/js/Branching/GOTOMO.js +++ b/js/Branching/GOTOMO.js @@ -18,42 +18,43 @@ function GOTOMO() { mo.inputs = "p"; exprs = [["A"],[sci2exp(1)]]; gr_i = []; - x = standard_define([2,1],model,exprs,gr_i); - x.graphics.in_implicit = ["I"]; + this.x = standard_define([2,1],model,exprs,gr_i); + this.x.graphics.in_implicit = ["I"]; } GOTOMO.prototype.details = function GOTOMO() { + return this.x; } GOTOMO.prototype.get = function GOTOMO() { } GOTOMO.prototype.set = function GOTOMO() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,tag,tagvis,exprs] = scicos_getvalue("Set parameters",[["Tag"],["Tag Visibility(1=Local 2=scoped 3= global)"]],list("str",-1,"vec",1),exprs); - if (!ok) { -break; -} - tagvis = int(tagvis); - if (((tagvis<1)||(tagvis>3))) { -message("Tag Visibility must be between 1 and 3"); - ok = false; -} - if (ok) { - if (((model.ipar!=tagvis)||(model.opar!=list(tag)))) { - needcompile = 4; - y = needcompile; -} - graphics.exprs = exprs; - model.opar = list(tag); - model.ipar = tagvis; - x.model = model; - x.graphics = graphics; - arg1 = x; -break; -} -} -needcompile=resume(needcompile) + [ok,tag,tagvis,exprs] = scicos_getvalue("Set parameters",[["Tag"],["Tag Visibility(1=Local 2=scoped 3= global)"]],list("str",-1,"vec",1),exprs); + if (!ok) { + break; + } + tagvis = int(tagvis); + if (((tagvis<1)||(tagvis>3))) { + message("Tag Visibility must be between 1 and 3"); + ok = false; + } + if (ok) { + if (((model.ipar!=tagvis)||(model.opar!=list(tag)))) { + needcompile = 4; + y = needcompile; + } + graphics.exprs = exprs; + model.opar = list(tag); + model.ipar = tagvis; + this.x.model = model; + this.x.graphics = graphics; + arg1 = this.x; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Branching/GOTOMO.pickle b/js/Branching/GOTOMO.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/GOTOMO.pickle +++ b/js/Branching/GOTOMO.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/GotoTagVisibility.js b/js/Branching/GotoTagVisibility.js index 445dc9a9..7553f37f 100644 --- a/js/Branching/GotoTagVisibility.js +++ b/js/Branching/GotoTagVisibility.js @@ -16,34 +16,35 @@ function GotoTagVisibility() { model.dep_ut = [false,false]; exprs = "A"; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } GotoTagVisibility.prototype.details = function GotoTagVisibility() { + return this.x; } GotoTagVisibility.prototype.get = function GotoTagVisibility() { } GotoTagVisibility.prototype.set = function GotoTagVisibility() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,tag,exprs] = scicos_getvalue("Set parameters",["GotoTag"],list("str",-1),exprs); - if (!ok) { -break; -} - if (ok) { - if (model.opar!=list(tag)) { - needcompile = 4; - y = needcompile; -} - graphics.exprs = exprs; - model.opar = list(tag); - x.graphics = graphics; - x.model = model; -break; -} -} -needcompile=resume(needcompile) + [ok,tag,exprs] = scicos_getvalue("Set parameters",["GotoTag"],list("str",-1),exprs); + if (!ok) { + break; + } + if (ok) { + if (model.opar!=list(tag)) { + needcompile = 4; + y = needcompile; + } + graphics.exprs = exprs; + model.opar = list(tag); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Branching/GotoTagVisibility.pickle b/js/Branching/GotoTagVisibility.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/GotoTagVisibility.pickle +++ b/js/Branching/GotoTagVisibility.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/GotoTagVisibilityMO.js b/js/Branching/GotoTagVisibilityMO.js index dce96fa2..03c26ad6 100644 --- a/js/Branching/GotoTagVisibilityMO.js +++ b/js/Branching/GotoTagVisibilityMO.js @@ -16,34 +16,35 @@ function GotoTagVisibilityMO() { model.dep_ut = [false,false]; exprs = "A"; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } GotoTagVisibilityMO.prototype.details = function GotoTagVisibilityMO() { + return this.x; } GotoTagVisibilityMO.prototype.get = function GotoTagVisibilityMO() { } GotoTagVisibilityMO.prototype.set = function GotoTagVisibilityMO() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,tag,exprs] = scicos_getvalue("Set parameters",["GotoTag"],list("str",-1),exprs); - if (!ok) { -break; -} - if (ok) { - if (model.opar!=list(tag)) { - needcompile = 4; - y = needcompile; -} - graphics.exprs = exprs; - model.opar = list(tag); - x.graphics = graphics; - x.model = model; -break; -} -} -needcompile=resume(needcompile) + [ok,tag,exprs] = scicos_getvalue("Set parameters",["GotoTag"],list("str",-1),exprs); + if (!ok) { + break; + } + if (ok) { + if (model.opar!=list(tag)) { + needcompile = 4; + y = needcompile; + } + graphics.exprs = exprs; + model.opar = list(tag); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Branching/GotoTagVisibilityMO.pickle b/js/Branching/GotoTagVisibilityMO.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/GotoTagVisibilityMO.pickle +++ b/js/Branching/GotoTagVisibilityMO.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/ISELECT_f.js b/js/Branching/ISELECT_f.js index e991df37..0a1789d5 100644 --- a/js/Branching/ISELECT_f.js +++ b/js/Branching/ISELECT_f.js @@ -14,34 +14,35 @@ function ISELECT_f() { model.dep_ut = [true,false]; exprs = [[string(nout)],[string(z0+1)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } ISELECT_f.prototype.details = function ISELECT_f() { + return this.x; } ISELECT_f.prototype.get = function ISELECT_f() { } ISELECT_f.prototype.set = function ISELECT_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nout,z0,exprs] = scicos_getvalue("Set parameters",[["number of outputs"],["initial connected output"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (z0>nout||z0<=0) { -message("initial connected input is not a valid input port number"); - } else { - [model,graphics,ok] = check_io(model,graphics,-1,-ones(nout,1),ones(nout,1),[]); - if (ok) { - graphics.exprs = exprs; - model.dstate = z0-1; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,nout,z0,exprs] = scicos_getvalue("Set parameters",[["number of outputs"],["initial connected output"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (z0>nout||z0<=0) { + message("initial connected input is not a valid input port number"); + } else { + [model,graphics,ok] = check_io(model,graphics,-1,-ones(nout,1),ones(nout,1),[]); + if (ok) { + graphics.exprs = exprs; + model.dstate = z0-1; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Branching/ISELECT_f.pickle b/js/Branching/ISELECT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/ISELECT_f.pickle +++ b/js/Branching/ISELECT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/ISELECT_m.js b/js/Branching/ISELECT_m.js index bf117d9b..20e063a5 100644 --- a/js/Branching/ISELECT_m.js +++ b/js/Branching/ISELECT_m.js @@ -22,43 +22,44 @@ function ISELECT_m() { model.dep_ut = [true,false]; exprs = [[sci2exp(1)],[sci2exp(nout)],[sci2exp(z0)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } ISELECT_m.prototype.details = function ISELECT_m() { + return this.x; } ISELECT_m.prototype.get = function ISELECT_m() { } ISELECT_m.prototype.set = function ISELECT_m() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,typ,nout,z0,exprs] = scicos_getvalue("Set parameters",[["Datatype(1= real double 2=Complex 3=int32 ...)"],["number of outputs"],["initial connected output"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (z0>nout||z0<=0) { -message("initial connected input is not a valid input port number"); - } else if (((typ<1)||(typ>8))) { -message("Datatype is not supported"); - ok = false; - } else { - it = typ; - ot = typ*ones(1,nout); - if (ok) { - out = [-ones(nout,1),-2*ones(nout,1)]; - in1 = [-1,-2]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(nout,1),[]); - if (ok) { - graphics.exprs = exprs; - model.dstate = z0; - x.graphics = graphics; - x.model = model; -break; -} -} -} -} + [ok,typ,nout,z0,exprs] = scicos_getvalue("Set parameters",[["Datatype(1= real double 2=Complex 3=int32 ...)"],["number of outputs"],["initial connected output"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (z0>nout||z0<=0) { + message("initial connected input is not a valid input port number"); + } else if (((typ<1)||(typ>8))) { + message("Datatype is not supported"); + ok = false; + } else { + it = typ; + ot = typ*ones(1,nout); + if (ok) { + out = [-ones(nout,1),-2*ones(nout,1)]; + in1 = [-1,-2]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(nout,1),[]); + if (ok) { + graphics.exprs = exprs; + model.dstate = z0; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } + } } } diff --git a/js/Branching/ISELECT_m.pickle b/js/Branching/ISELECT_m.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/ISELECT_m.pickle +++ b/js/Branching/ISELECT_m.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/MUX.js b/js/Branching/MUX.js index 1c6c4f75..c1ac2f32 100644 --- a/js/Branching/MUX.js +++ b/js/Branching/MUX.js @@ -11,52 +11,53 @@ function MUX() { model.dep_ut = [true,false]; exprs = string(in1); gr_i = []; - x = standard_define([.5,2],model,exprs,gr_i); + this.x = standard_define([.5,2],model,exprs,gr_i); } MUX.prototype.details = function MUX() { + return this.x; } MUX.prototype.get = function MUX() { } MUX.prototype.set = function MUX() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,in1,exprs] = scicos_getvalue("Set MUX block parameters","number of input ports or vector of sizes",list("intvec",-1),exprs); - if (!ok) { -break; -} - if (size(in1,"*")==1) { - if (in1<2||in1>31) { -message("Block must have at least two input ports and at most 31"); - ok = false; - } else { - [model,graphics,ok] = check_io(model,graphics,-transpose([1:in1]),0,[],[]); -} - } else { - if (size(in1,"*")<2||or(in1==0)||size(in1,"*")>31) { -message([["Block must have at least two input ports"],["and at most 31. Size 0 is not allowed. "]]); - ok = false; - } else { - if (min(in1)<0) { - nout = 0; - } else { - nout = sum(in1); -} - [model,graphics,ok] = check_io(model,graphics,in1.slice(),nout,[],[]); - if (ok) { - in1 = size(in1,"*"); -} -} -} - if (ok) { - graphics.exprs = exprs; - model.ipar = in1; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,in1,exprs] = scicos_getvalue("Set MUX block parameters","number of input ports or vector of sizes",list("intvec",-1),exprs); + if (!ok) { + break; + } + if (size(in1,"*")==1) { + if (in1<2||in1>31) { + message("Block must have at least two input ports and at most 31"); + ok = false; + } else { + [model,graphics,ok] = check_io(model,graphics,-transpose([1:in1]),0,[],[]); + } + } else { + if (size(in1,"*")<2||or(in1==0)||size(in1,"*")>31) { + message([["Block must have at least two input ports"],["and at most 31. Size 0 is not allowed. "]]); + ok = false; + } else { + if (min(in1)<0) { + nout = 0; + } else { + nout = sum(in1); + } + [model,graphics,ok] = check_io(model,graphics,in1.slice(),nout,[],[]); + if (ok) { + in1 = size(in1,"*"); + } + } + } + if (ok) { + graphics.exprs = exprs; + model.ipar = in1; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Branching/MUX.pickle b/js/Branching/MUX.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/MUX.pickle +++ b/js/Branching/MUX.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/MUX_f.js b/js/Branching/MUX_f.js index 0bc7f2f7..13cf8462 100644 --- a/js/Branching/MUX_f.js +++ b/js/Branching/MUX_f.js @@ -11,52 +11,53 @@ function MUX_f() { model.dep_ut = [true,false]; exprs = string(in1); gr_i = []; - x = standard_define([0.5,2],model,exprs,gr_i); + this.x = standard_define([0.5,2],model,exprs,gr_i); } MUX_f.prototype.details = function MUX_f() { + return this.x; } MUX_f.prototype.get = function MUX_f() { } MUX_f.prototype.set = function MUX_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,in1,exprs] = scicos_getvalue("Set MUX block parameters","number of input ports or vector of sizes",list("vec",-1),exprs); - if (!ok) { -break; -} - if (size(in1,"*")==1) { - if (in1<2||in1>8) { -message("Block must have at least two input ports and at most eight"); - ok = false; - } else { - [model,graphics,ok] = check_io(model,graphics,-transpose([1:in1]),0,[],[]); -} - } else { - if (size(in1,"*")<2||size(in1,"*")>8||or(in1==0)) { -message([["Block must have at least two input ports"],["and at most eight, and size 0 is not allowed. "]]); - ok = false; - } else { - if (min(in1)<0) { - nout = 0; - } else { - nout = sum(in1); -} - [model,graphics,ok] = check_io(model,graphics,in1.slice(),nout,[],[]); - if (ok) { - in1 = size(in1,"*"); -} -} -} - if (ok) { - graphics.exprs = exprs; - model.ipar = in1; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,in1,exprs] = scicos_getvalue("Set MUX block parameters","number of input ports or vector of sizes",list("vec",-1),exprs); + if (!ok) { + break; + } + if (size(in1,"*")==1) { + if (in1<2||in1>8) { + message("Block must have at least two input ports and at most eight"); + ok = false; + } else { + [model,graphics,ok] = check_io(model,graphics,-transpose([1:in1]),0,[],[]); + } + } else { + if (size(in1,"*")<2||size(in1,"*")>8||or(in1==0)) { + message([["Block must have at least two input ports"],["and at most eight, and size 0 is not allowed. "]]); + ok = false; + } else { + if (min(in1)<0) { + nout = 0; + } else { + nout = sum(in1); + } + [model,graphics,ok] = check_io(model,graphics,in1.slice(),nout,[],[]); + if (ok) { + in1 = size(in1,"*"); + } + } + } + if (ok) { + graphics.exprs = exprs; + model.ipar = in1; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Branching/MUX_f.pickle b/js/Branching/MUX_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/MUX_f.pickle +++ b/js/Branching/MUX_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/M_SWITCH.js b/js/Branching/M_SWITCH.js index 724ea1f0..80d0d0ca 100644 --- a/js/Branching/M_SWITCH.js +++ b/js/Branching/M_SWITCH.js @@ -13,51 +13,52 @@ function M_SWITCH() { model.dep_ut = [true,false]; exprs = [[string(nin)],[string(ipar)]]; gr_i = []; - x = standard_define([2.5,2],model,exprs,gr_i); + this.x = standard_define([2.5,2],model,exprs,gr_i); } M_SWITCH.prototype.details = function M_SWITCH() { + return this.x; } M_SWITCH.prototype.get = function M_SWITCH() { } M_SWITCH.prototype.set = function M_SWITCH() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nin,base,rule,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["zero base indexing (0), otherwise 1"],["rounding rule: int (0), round (1), ceil (2), floor (3)"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - nin = int(nin); - base = int(base); - if (nin<1) { -message("Number of inputs must be >=1 "); - } else if (!((base==1)||(base==0))) { -message("base indexing must be 1 or 0"); - } else if (!((rule==1)||(rule==0)||(rule==2)||(rule==3))) { -message("incorrect rounding rule"); - } else { - if (nin==1) { - in1 = [[1,1],[-1,1]]; - out = [1,1]; - } else { - in1 = [[1],[-ones(nin,1)]]; - in2 = [[1],[-2*ones(nin,1)]]; - in1 = [in1,in2]; - out = [-1,-2]; -} - it = [[-1],[-2*ones(nin,1)]]; - ot = -2; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - if (ok) { - graphics.exprs = exprs; - model.ipar = [[base],[rule]]; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,nin,base,rule,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["zero base indexing (0), otherwise 1"],["rounding rule: int (0), round (1), ceil (2), floor (3)"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + nin = int(nin); + base = int(base); + if (nin<1) { + message("Number of inputs must be >=1 "); + } else if (!((base==1)||(base==0))) { + message("base indexing must be 1 or 0"); + } else if (!((rule==1)||(rule==0)||(rule==2)||(rule==3))) { + message("incorrect rounding rule"); + } else { + if (nin==1) { + in1 = [[1,1],[-1,1]]; + out = [1,1]; + } else { + in1 = [[1],[-ones(nin,1)]]; + in2 = [[1],[-2*ones(nin,1)]]; + in1 = [in1,in2]; + out = [-1,-2]; + } + it = [[-1],[-2*ones(nin,1)]]; + ot = -2; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + if (ok) { + graphics.exprs = exprs; + model.ipar = [[base],[rule]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Branching/M_SWITCH.pickle b/js/Branching/M_SWITCH.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/M_SWITCH.pickle +++ b/js/Branching/M_SWITCH.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/NRMSOM_f.js b/js/Branching/NRMSOM_f.js index f9fd7ffc..726320a9 100644 --- a/js/Branching/NRMSOM_f.js +++ b/js/Branching/NRMSOM_f.js @@ -11,29 +11,30 @@ function NRMSOM_f() { model.dep_ut = [true,false]; exprs = [string(nin)]; gr_i = []; - x = standard_define([.2,2],model,exprs,gr_i); + this.x = standard_define([.2,2],model,exprs,gr_i); } NRMSOM_f.prototype.details = function NRMSOM_f() { + return this.x; } NRMSOM_f.prototype.get = function NRMSOM_f() { } NRMSOM_f.prototype.set = function NRMSOM_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nin,exprs] = scicos_getvalue("Set parameters",["number of inputs"],list("vec",1),exprs); - if (!ok) { -break; -} - [model,graphics,ok] = check_io(model,graphics,-ones(nin,1),-1,[],[]); - if (ok) { - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nin,exprs] = scicos_getvalue("Set parameters",["number of inputs"],list("vec",1),exprs); + if (!ok) { + break; + } + [model,graphics,ok] = check_io(model,graphics,-ones(nin,1),-1,[],[]); + if (ok) { + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Branching/NRMSOM_f.pickle b/js/Branching/NRMSOM_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/NRMSOM_f.pickle +++ b/js/Branching/NRMSOM_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/RELAY_f.js b/js/Branching/RELAY_f.js index ca190330..71b2d9e7 100644 --- a/js/Branching/RELAY_f.js +++ b/js/Branching/RELAY_f.js @@ -15,35 +15,36 @@ function RELAY_f() { model.dep_ut = [true,true]; exprs = [[string(nin)],[string(i0+1)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } RELAY_f.prototype.details = function RELAY_f() { + return this.x; } RELAY_f.prototype.get = function RELAY_f() { } RELAY_f.prototype.set = function RELAY_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; ipar = model.ipar; while (true) { - [ok,nin,z0,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["initial connected input"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (z0>nin||z0<=0) { -message("initial connected input is not a valid input port number"); - } else { - [model,graphics,ok] = check_io(model,graphics,-ones(nin,1),-1,ones(nin,1),[]); - if (ok) { - graphics.exprs = exprs; - model.dstate = z0-1; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,nin,z0,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["initial connected input"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (z0>nin||z0<=0) { + message("initial connected input is not a valid input port number"); + } else { + [model,graphics,ok] = check_io(model,graphics,-ones(nin,1),-1,ones(nin,1),[]); + if (ok) { + graphics.exprs = exprs; + model.dstate = z0-1; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Branching/RELAY_f.pickle b/js/Branching/RELAY_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/RELAY_f.pickle +++ b/js/Branching/RELAY_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/SCALAR2VECTOR.js b/js/Branching/SCALAR2VECTOR.js index 867ef489..a1f50ede 100644 --- a/js/Branching/SCALAR2VECTOR.js +++ b/js/Branching/SCALAR2VECTOR.js @@ -10,36 +10,37 @@ function SCALAR2VECTOR() { model.dep_ut = [true,false]; exprs = [string([nout])]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } SCALAR2VECTOR.prototype.details = function SCALAR2VECTOR() { + return this.x; } SCALAR2VECTOR.prototype.get = function SCALAR2VECTOR() { } SCALAR2VECTOR.prototype.set = function SCALAR2VECTOR() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nout,exprs] = scicos_getvalue("Set block parameters",["size of output (-1: if don\'t know)"],list("vec",1),exprs); - if (!ok) { -break; -} - nout = int(nout); - if ((nout!=-1&&(nout<=0))) { -message("size of output must be -1 or >0"); - ok = false; -} - if (ok) { - [model,graphics,ok] = check_io(model,graphics,[1],nout,[],[]); -} - if (ok) { - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nout,exprs] = scicos_getvalue("Set block parameters",["size of output (-1: if don\'t know)"],list("vec",1),exprs); + if (!ok) { + break; + } + nout = int(nout); + if ((nout!=-1&&(nout<=0))) { + message("size of output must be -1 or >0"); + ok = false; + } + if (ok) { + [model,graphics,ok] = check_io(model,graphics,[1],nout,[],[]); + } + if (ok) { + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Branching/SCALAR2VECTOR.pickle b/js/Branching/SCALAR2VECTOR.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/SCALAR2VECTOR.pickle +++ b/js/Branching/SCALAR2VECTOR.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/SELECT_f.js b/js/Branching/SELECT_f.js index 31515a65..de1fa1fa 100644 --- a/js/Branching/SELECT_f.js +++ b/js/Branching/SELECT_f.js @@ -14,34 +14,35 @@ function SELECT_f() { model.dep_ut = [true,false]; exprs = [[string(nin)],[string(z0+1)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } SELECT_f.prototype.details = function SELECT_f() { + return this.x; } SELECT_f.prototype.get = function SELECT_f() { } SELECT_f.prototype.set = function SELECT_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nin,z0,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["initial connected input"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (z0>nin||z0<=0) { -message("initial connected input is not a valid input port number"); - } else { - [model,graphics,ok] = check_io(model,graphics,-ones(nin,1),-1,ones(nin,1),[]); - if (ok) { - graphics.exprs = exprs; - model.dstate = z0-1; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,nin,z0,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["initial connected input"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (z0>nin||z0<=0) { + message("initial connected input is not a valid input port number"); + } else { + [model,graphics,ok] = check_io(model,graphics,-ones(nin,1),-1,ones(nin,1),[]); + if (ok) { + graphics.exprs = exprs; + model.dstate = z0-1; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Branching/SELECT_f.pickle b/js/Branching/SELECT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/SELECT_f.pickle +++ b/js/Branching/SELECT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/SELECT_m.js b/js/Branching/SELECT_m.js index 90fb26c3..856e759a 100644 --- a/js/Branching/SELECT_m.js +++ b/js/Branching/SELECT_m.js @@ -22,43 +22,44 @@ function SELECT_m() { model.dep_ut = [true,false]; exprs = [[sci2exp(1)],[sci2exp(nin)],[sci2exp(z0)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } SELECT_m.prototype.details = function SELECT_m() { + return this.x; } SELECT_m.prototype.get = function SELECT_m() { } SELECT_m.prototype.set = function SELECT_m() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,typ,nin,z0,exprs] = scicos_getvalue("Set parameters",[["Datatype(1= real double 2=Complex 3=int32 ..)"],["number of inputs"],["initial connected input"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (z0>nin||z0<=0) { -message("initial connected input is not a valid input port number"); - } else if (((typ<1)||(typ>8))&&(typ!=-1)) { -message("Datatype is not supported"); - ok = false; - } else { - it = typ*ones(1,nin); - ot = typ; - if (ok) { - in1 = [-ones(nin,1),-2*ones(nin,1)]; - out = [-1,-2]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(nin,1),[]); - if (ok) { - graphics.exprs = exprs; - model.dstate = z0; - x.graphics = graphics; - x.model = model; -break; -} -} -} -} + [ok,typ,nin,z0,exprs] = scicos_getvalue("Set parameters",[["Datatype(1= real double 2=Complex 3=int32 ..)"],["number of inputs"],["initial connected input"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (z0>nin||z0<=0) { + message("initial connected input is not a valid input port number"); + } else if (((typ<1)||(typ>8))&&(typ!=-1)) { + message("Datatype is not supported"); + ok = false; + } else { + it = typ*ones(1,nin); + ot = typ; + if (ok) { + in1 = [-ones(nin,1),-2*ones(nin,1)]; + out = [-1,-2]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(nin,1),[]); + if (ok) { + graphics.exprs = exprs; + model.dstate = z0; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } + } } } diff --git a/js/Branching/SELECT_m.pickle b/js/Branching/SELECT_m.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/SELECT_m.pickle +++ b/js/Branching/SELECT_m.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/SELF_SWITCH.pickle b/js/Branching/SELF_SWITCH.pickle index ad17cc4d..afd93db5 100644 --- a/js/Branching/SELF_SWITCH.pickle +++ b/js/Branching/SELF_SWITCH.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'stateOpen' +S'x' p2 -atp3 -Rp4 +aS'stateOpen' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Branching/SWITCH2.js b/js/Branching/SWITCH2.js index 7d9d8d50..e4e050c8 100644 --- a/js/Branching/SWITCH2.js +++ b/js/Branching/SWITCH2.js @@ -17,42 +17,43 @@ function SWITCH2() { model.dep_ut = [true,false]; exprs = [[string(ipar)],[string(rpar)],[string(nzz)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } SWITCH2.prototype.details = function SWITCH2() { + return this.x; } SWITCH2.prototype.get = function SWITCH2() { } SWITCH2.prototype.set = function SWITCH2() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,rule,thra,nzz,exprs] = scicos_getvalue("Set parameters",[["pass first input if: u2>=a (0), u2>a (1), u2~=a (2)"],["threshold a"],["use zero crossing: yes (1), no (0)"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - rule = int(rule); - if ((rule<0)) { - rule = 0; -} - if ((rule>2)) { - rule = 2; -} - graphics.exprs = exprs; - model.ipar = rule; - model.rpar = thra; - if (nzz!=0) { - model.nmode = 1; - model.nzcross = 1; - } else { - model.nmode = 0; - model.nzcross = 0; -} - x.graphics = graphics; - x.model = model; -break; -} + [ok,rule,thra,nzz,exprs] = scicos_getvalue("Set parameters",[["pass first input if: u2>=a (0), u2>a (1), u2~=a (2)"],["threshold a"],["use zero crossing: yes (1), no (0)"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + rule = int(rule); + if ((rule<0)) { + rule = 0; + } + if ((rule>2)) { + rule = 2; + } + graphics.exprs = exprs; + model.ipar = rule; + model.rpar = thra; + if (nzz!=0) { + model.nmode = 1; + model.nzcross = 1; + } else { + model.nmode = 0; + model.nzcross = 0; + } + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Branching/SWITCH2.pickle b/js/Branching/SWITCH2.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/SWITCH2.pickle +++ b/js/Branching/SWITCH2.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/SWITCH2_m.js b/js/Branching/SWITCH2_m.js index de8df531..29643871 100644 --- a/js/Branching/SWITCH2_m.js +++ b/js/Branching/SWITCH2_m.js @@ -20,56 +20,57 @@ function SWITCH2_m() { model.dep_ut = [true,false]; exprs = [[sci2exp(1)],[string(ipar)],[string(rpar)],[string(nzz)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } SWITCH2_m.prototype.details = function SWITCH2_m() { + return this.x; } SWITCH2_m.prototype.get = function SWITCH2_m() { } SWITCH2_m.prototype.set = function SWITCH2_m() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,ot,rule,thra,nzz,exprs] = scicos_getvalue("Set parameters",[["Datatype (1=real double 2=complex 3=int32 ...)"],["pass first input if: u2>=a (0), u2>a (1), u2~=a (2)"],["threshold a"],["use zero crossing: yes (1), no (0)"]],list("vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - rule = int(rule); - if ((rule<0)) { - rule = 0; -} - if ((rule>2)) { - rule = 2; -} - graphics.exprs = exprs; - model.ipar = rule; - model.rpar = thra; - if (nzz!=0) { - model.nmode = 1; - model.nzcross = 1; - } else { - model.nmode = 0; - model.nzcross = 0; -} - if (((ot<1)||(ot>8))&&(ot!=-1)) { -message("Datatype is not supported"); - ok = false; -} - if (ok) { - it[1-1] = ot; - it[2-1] = 1; - it[3-1] = ot; - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,ot,rule,thra,nzz,exprs] = scicos_getvalue("Set parameters",[["Datatype (1=real double 2=complex 3=int32 ...)"],["pass first input if: u2>=a (0), u2>a (1), u2~=a (2)"],["threshold a"],["use zero crossing: yes (1), no (0)"]],list("vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + rule = int(rule); + if ((rule<0)) { + rule = 0; + } + if ((rule>2)) { + rule = 2; + } + graphics.exprs = exprs; + model.ipar = rule; + model.rpar = thra; + if (nzz!=0) { + model.nmode = 1; + model.nzcross = 1; + } else { + model.nmode = 0; + model.nzcross = 0; + } + if (((ot<1)||(ot>8))&&(ot!=-1)) { + message("Datatype is not supported"); + ok = false; + } + if (ok) { + it[1-1] = ot; + it[2-1] = 1; + it[3-1] = ot; + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Branching/SWITCH2_m.pickle b/js/Branching/SWITCH2_m.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/SWITCH2_m.pickle +++ b/js/Branching/SWITCH2_m.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Branching/SWITCH_f.js b/js/Branching/SWITCH_f.js index 87b1b6e8..397de35c 100644 --- a/js/Branching/SWITCH_f.js +++ b/js/Branching/SWITCH_f.js @@ -14,35 +14,36 @@ function SWITCH_f() { model.dep_ut = [true,true]; exprs = [[string(nin)],[string(i0+1)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } SWITCH_f.prototype.details = function SWITCH_f() { + return this.x; } SWITCH_f.prototype.get = function SWITCH_f() { } SWITCH_f.prototype.set = function SWITCH_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; ipar = model.ipar; while (true) { - [ok,nin,z0,exprs] = scicos_getvalue("Set switch parameters",[["number of inputs"],["connected input"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (z0>nin||z0<=0) { -message("initial connected input is not a valid input port number"); - } else { - [model,graphics,ok] = check_io(model,graphics,-ones(nin,1),-1,[],[]); - if (ok) { - graphics.exprs = exprs; - model.ipar = z0-1; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,nin,z0,exprs] = scicos_getvalue("Set switch parameters",[["number of inputs"],["connected input"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (z0>nin||z0<=0) { + message("initial connected input is not a valid input port number"); + } else { + [model,graphics,ok] = check_io(model,graphics,-ones(nin,1),-1,[],[]); + if (ok) { + graphics.exprs = exprs; + model.ipar = z0-1; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Branching/SWITCH_f.pickle b/js/Branching/SWITCH_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Branching/SWITCH_f.pickle +++ b/js/Branching/SWITCH_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/CCS.js b/js/Electrical/CCS.js index e141318c..37468aff 100644 --- a/js/Electrical/CCS.js +++ b/js/Electrical/CCS.js @@ -11,24 +11,24 @@ function CCS() { MO = []; P = [[2,50,1,0],[70,98,2,0],[70,2,-2,0]]; PortName = [["Iin"],["p"],["n"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,19 +44,20 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2.1,3],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2.1,3],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } CCS.prototype.details = function CCS() { + return this.x; } CCS.prototype.get = function CCS() { } CCS.prototype.set = function CCS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/CCS.pickle b/js/Electrical/CCS.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/CCS.pickle +++ b/js/Electrical/CCS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/CVS.js b/js/Electrical/CVS.js index fe672d4d..14967c72 100644 --- a/js/Electrical/CVS.js +++ b/js/Electrical/CVS.js @@ -11,24 +11,24 @@ function CVS() { MO = []; P = [[2,50,1,0],[70,98,2,0],[70,2,-2,0]]; PortName = [["vin"],["p"],["n"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,19 +44,20 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2.1,3],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2.1,3],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } CVS.prototype.details = function CVS() { + return this.x; } CVS.prototype.get = function CVS() { } CVS.prototype.set = function CVS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/CVS.pickle b/js/Electrical/CVS.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/CVS.pickle +++ b/js/Electrical/CVS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/Capacitor.js b/js/Electrical/Capacitor.js index 531ad691..ea76cb96 100644 --- a/js/Electrical/Capacitor.js +++ b/js/Electrical/Capacitor.js @@ -18,30 +18,31 @@ function Capacitor() { model.out = ones(size(mo.outputs,"*"),1); exprs = string([[C],[v]]); gr_i = []; - x = standard_define([2,1.1],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,1.1],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } Capacitor.prototype.details = function Capacitor() { + return this.x; } Capacitor.prototype.get = function Capacitor() { } Capacitor.prototype.set = function Capacitor() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,C,v,exprs] = scicos_getvalue("Set Capacitor block parameter",[["C (F)"],["Initial Voltage"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - model.rpar = C; - model.equations.parameters[2-1] = list(C,v); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,C,v,exprs] = scicos_getvalue("Set Capacitor block parameter",[["C (F)"],["Initial Voltage"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + model.rpar = C; + model.equations.parameters[2-1] = list(C,v); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/Capacitor.pickle b/js/Electrical/Capacitor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Capacitor.pickle +++ b/js/Electrical/Capacitor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/ConstantVoltage.js b/js/Electrical/ConstantVoltage.js index 2f831d32..b01c4f44 100644 --- a/js/Electrical/ConstantVoltage.js +++ b/js/Electrical/ConstantVoltage.js @@ -17,30 +17,31 @@ function ConstantVoltage() { model.equations = mo; exprs = string(V); gr_i = []; - x = standard_define([1.5,1.1],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([1.5,1.1],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } ConstantVoltage.prototype.details = function ConstantVoltage() { + return this.x; } ConstantVoltage.prototype.get = function ConstantVoltage() { } ConstantVoltage.prototype.set = function ConstantVoltage() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,V,exprs] = scicos_getvalue("Set ConstantVoltage block parameter","V (volt)",list("vec",1),exprs); - if (!ok) { -break; -} - model.rpar = V; - model.equations.parameters[2-1] = list(V); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,V,exprs] = scicos_getvalue("Set ConstantVoltage block parameter","V (volt)",list("vec",1),exprs); + if (!ok) { + break; + } + model.rpar = V; + model.equations.parameters[2-1] = list(V); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/ConstantVoltage.pickle b/js/Electrical/ConstantVoltage.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/ConstantVoltage.pickle +++ b/js/Electrical/ConstantVoltage.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/CurrentSensor.js b/js/Electrical/CurrentSensor.js index bb9d9952..1cf2a40c 100644 --- a/js/Electrical/CurrentSensor.js +++ b/js/Electrical/CurrentSensor.js @@ -14,15 +14,16 @@ function CurrentSensor() { model.equations = mo; exprs = []; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = [["I"],["E"]]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = [["I"],["E"]]; } CurrentSensor.prototype.details = function CurrentSensor() { + return this.x; } CurrentSensor.prototype.get = function CurrentSensor() { } CurrentSensor.prototype.set = function CurrentSensor() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/CurrentSensor.pickle b/js/Electrical/CurrentSensor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/CurrentSensor.pickle +++ b/js/Electrical/CurrentSensor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/Diode.js b/js/Electrical/Diode.js index 644cb091..846dbafc 100644 --- a/js/Electrical/Diode.js +++ b/js/Electrical/Diode.js @@ -20,30 +20,31 @@ function Diode() { model.equations = mo; exprs = string([[Ids],[Vt],[Maxexp],[R]]); gr_i = []; - x = standard_define([2,1],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,1],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } Diode.prototype.details = function Diode() { + return this.x; } Diode.prototype.get = function Diode() { } Diode.prototype.set = function Diode() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,Ids,Vt,Maxexp,R,exprs] = scicos_getvalue("Set Diode block parameter",[["Saturation cuurent (A)"],["Voltage equivalent to temperature (Volt)"],["Max exponent for linear continuation"],["R (ohm)"]],list("vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - model.rpar = [[Ids],[Vt],[Maxexp],[R]]; - model.equations.parameters = list(["Ids","Vt","Maxexp","R"],list(Ids,Vt,Maxexp,R)); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,Ids,Vt,Maxexp,R,exprs] = scicos_getvalue("Set Diode block parameter",[["Saturation cuurent (A)"],["Voltage equivalent to temperature (Volt)"],["Max exponent for linear continuation"],["R (ohm)"]],list("vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + model.rpar = [[Ids],[Vt],[Maxexp],[R]]; + model.equations.parameters = list(["Ids","Vt","Maxexp","R"],list(Ids,Vt,Maxexp,R)); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/Diode.pickle b/js/Electrical/Diode.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Diode.pickle +++ b/js/Electrical/Diode.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/Ground.js b/js/Electrical/Ground.js index 077617fd..789de6c8 100644 --- a/js/Electrical/Ground.js +++ b/js/Electrical/Ground.js @@ -13,15 +13,16 @@ function Ground() { model.equations = mo; exprs = ""; gr_i = []; - x = standard_define([1,1],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([1,1],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } Ground.prototype.details = function Ground() { + return this.x; } Ground.prototype.get = function Ground() { } Ground.prototype.set = function Ground() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/Ground.pickle b/js/Electrical/Ground.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Ground.pickle +++ b/js/Electrical/Ground.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/Gyrator.js b/js/Electrical/Gyrator.js index 75389bd7..5c6371fb 100644 --- a/js/Electrical/Gyrator.js +++ b/js/Electrical/Gyrator.js @@ -11,24 +11,24 @@ function Gyrator() { MO = []; P = [[2.5,90,2,0],[2.5,10,2,0],[97.5,90,-2,0],[97.5,10,-2,0]]; PortName = [["p1"],["n1"],["p2"],["n2"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,29 +44,30 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } Gyrator.prototype.details = function Gyrator() { + return this.x; } Gyrator.prototype.get = function Gyrator() { } Gyrator.prototype.set = function Gyrator() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; - exprs = x.graphics.exprs; + this.x = arg1; + exprs = this.x.graphics.exprs; while (true) { - [ok,G1,G2,exprs] = scicos_getvalue([["Set Gyrator block parameters:"],[""],["G1: Gyration conductance"],["G2: Gyration conductance"]],[["G1"],["G2"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - x.model.equations.parameters[2-1] = list(G1,G2); - x.graphics.exprs = exprs; -break; -} + [ok,G1,G2,exprs] = scicos_getvalue([["Set Gyrator block parameters:"],[""],["G1: Gyration conductance"],["G2: Gyration conductance"]],[["G1"],["G2"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + this.x.model.equations.parameters[2-1] = list(G1,G2); + this.x.graphics.exprs = exprs; + break; + } } } diff --git a/js/Electrical/Gyrator.pickle b/js/Electrical/Gyrator.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Gyrator.pickle +++ b/js/Electrical/Gyrator.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/IdealTransformer.js b/js/Electrical/IdealTransformer.js index 8e73dc7b..b24da82d 100644 --- a/js/Electrical/IdealTransformer.js +++ b/js/Electrical/IdealTransformer.js @@ -11,24 +11,24 @@ function IdealTransformer() { MO = []; P = [[2.5,90,2,0],[2.5,10,2,0],[97.5,90,-2,0],[97.5,10,-2,0]]; PortName = [["p1"],["n1"],["p2"],["n2"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,29 +44,30 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } IdealTransformer.prototype.details = function IdealTransformer() { + return this.x; } IdealTransformer.prototype.get = function IdealTransformer() { } IdealTransformer.prototype.set = function IdealTransformer() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; - exprs = x.graphics.exprs; + this.x = arg1; + exprs = this.x.graphics.exprs; while (true) { - [ok,N,exprs] = scicos_getvalue([["Set Transformer block parameters:"],[""],["N:"+" Turn ratio (N1/N2)"]],["N"],list("vec",1),exprs); - if (!ok) { -break; -} - x.model.equations.parameters[2-1] = list(N); - x.graphics.exprs = exprs; -break; -} + [ok,N,exprs] = scicos_getvalue([["Set Transformer block parameters:"],[""],["N:"+" Turn ratio (N1/N2)"]],["N"],list("vec",1),exprs); + if (!ok) { + break; + } + this.x.model.equations.parameters[2-1] = list(N); + this.x.graphics.exprs = exprs; + break; + } } } diff --git a/js/Electrical/IdealTransformer.pickle b/js/Electrical/IdealTransformer.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/IdealTransformer.pickle +++ b/js/Electrical/IdealTransformer.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/Inductor.js b/js/Electrical/Inductor.js index 679331e9..915a8d35 100644 --- a/js/Electrical/Inductor.js +++ b/js/Electrical/Inductor.js @@ -17,30 +17,31 @@ function Inductor() { model.equations = mo; exprs = string(L); gr_i = []; - x = standard_define([2,0.9],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,0.9],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } Inductor.prototype.details = function Inductor() { + return this.x; } Inductor.prototype.get = function Inductor() { } Inductor.prototype.set = function Inductor() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,L,exprs] = scicos_getvalue("Set Inductor block parameter","L (H)",list("vec",1),exprs); - if (!ok) { -break; -} - model.rpar = L; - model.equations.parameters[2-1] = list(L); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,L,exprs] = scicos_getvalue("Set Inductor block parameter","L (H)",list("vec",1),exprs); + if (!ok) { + break; + } + model.rpar = L; + model.equations.parameters[2-1] = list(L); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/Inductor.pickle b/js/Electrical/Inductor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Inductor.pickle +++ b/js/Electrical/Inductor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/MOTOR.js b/js/Electrical/MOTOR.js index f0622cc9..f6612689 100644 --- a/js/Electrical/MOTOR.js +++ b/js/Electrical/MOTOR.js @@ -9,15 +9,16 @@ function MOTOR() { model.dep_ut = [true,false]; gr_i = []; exprs = ""; - x = standard_define([2,2],model,exprs,gr_i); - x.graphics.out_implicit = [["I"],["I"]]; - x.graphics.in_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,gr_i); + this.x.graphics.out_implicit = [["I"],["I"]]; + this.x.graphics.in_implicit = ["I"]; } MOTOR.prototype.details = function MOTOR() { + return this.x; } MOTOR.prototype.get = function MOTOR() { } MOTOR.prototype.set = function MOTOR() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/MOTOR.pickle b/js/Electrical/MOTOR.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/MOTOR.pickle +++ b/js/Electrical/MOTOR.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/NMOS.js b/js/Electrical/NMOS.js index 88c85350..932f4ac4 100644 --- a/js/Electrical/NMOS.js +++ b/js/Electrical/NMOS.js @@ -24,29 +24,30 @@ function NMOS() { model.out = ones(size(mo.outputs,"*"),1); exprs = [[string(W)],[string(L)],[string(Beta)],[string(Vt)],[string(K2)],[string(K5)],[string(dW)],[string(dL)],[string(RDS)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = [["I"],["I"],["I"]]; + this.x = standard_define([2,2],model,exprs,gr_i); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = [["I"],["I"],["I"]]; } NMOS.prototype.details = function NMOS() { + return this.x; } NMOS.prototype.get = function NMOS() { } NMOS.prototype.set = function NMOS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs] = scicos_getvalue("Set NMOS Transistor block parameters",[["Width [m]"],["Length [m]"],["Transconductance parameter [A/(V*V)]"],["Zero bias threshold voltage [V]"],["Bulk threshold parameter"],["Reduction of pinch-off region"],["Narrowing of channel [m]"],["Shortening of channel [m]"],["Drain-Source-Resistance [Ohm]"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - model.equations.parameters[2-1] = list(W,L,Beta,Vt,K2,K5,dW,dL,RDS); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs] = scicos_getvalue("Set NMOS Transistor block parameters",[["Width [m]"],["Length [m]"],["Transconductance parameter [A/(V*V)]"],["Zero bias threshold voltage [V]"],["Bulk threshold parameter"],["Reduction of pinch-off region"],["Narrowing of channel [m]"],["Shortening of channel [m]"],["Drain-Source-Resistance [Ohm]"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + model.equations.parameters[2-1] = list(W,L,Beta,Vt,K2,K5,dW,dL,RDS); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/NMOS.pickle b/js/Electrical/NMOS.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/NMOS.pickle +++ b/js/Electrical/NMOS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/NPN.js b/js/Electrical/NPN.js index c8627dd3..93484238 100644 --- a/js/Electrical/NPN.js +++ b/js/Electrical/NPN.js @@ -11,24 +11,24 @@ function NPN() { MO = []; P = [[100,90,-2,0],[0,50,2,0],[100,10,-2,0]]; PortName = [["C"],["B"],["E"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,29 +44,30 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } NPN.prototype.details = function NPN() { + return this.x; } NPN.prototype.get = function NPN() { } NPN.prototype.set = function NPN() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; - exprs = x.graphics.exprs; + this.x = arg1; + exprs = this.x.graphics.exprs; while (true) { - [ok,Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax,exprs] = scicos_getvalue([["Set NPN block parameters:"],[""]],[["Bf : Forward beta"],["Br : Reverse beta"],["Is : Transport saturation current"],["Vak : Early voltage (inverse), 1/Volt"],["Tauf: Ideal forward transit time"],["Taur: Ideal reverse transit time"],["Ccs : Collector-substrat(ground) cap."],["Cje : Base-emitter zero bias depletion cap."],["Cjc : Base-coll. zero bias depletion cap."],["Phie: Base-emitter diffusion voltage"],["Me : Base-emitter gradation exponent"],["Phic: Base-collector diffusion voltage"],["Mc : Base-collector gradation exponent"],["Gbc : Base-collector conductance"],["Gbe : Base-emitter conductance"],["Vt : Voltage equivalent of temperature"],["EMinmax: if x > EMinMax, the exp(x) is linearized"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - x.model.equations.parameters[2-1] = list(Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax); - x.graphics.exprs = exprs; -break; -} + [ok,Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax,exprs] = scicos_getvalue([["Set NPN block parameters:"],[""]],[["Bf : Forward beta"],["Br : Reverse beta"],["Is : Transport saturation current"],["Vak : Early voltage (inverse), 1/Volt"],["Tauf: Ideal forward transit time"],["Taur: Ideal reverse transit time"],["Ccs : Collector-substrat(ground) cap."],["Cje : Base-emitter zero bias depletion cap."],["Cjc : Base-coll. zero bias depletion cap."],["Phie: Base-emitter diffusion voltage"],["Me : Base-emitter gradation exponent"],["Phic: Base-collector diffusion voltage"],["Mc : Base-collector gradation exponent"],["Gbc : Base-collector conductance"],["Gbe : Base-emitter conductance"],["Vt : Voltage equivalent of temperature"],["EMinmax: if x > EMinMax, the exp(x) is linearized"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + this.x.model.equations.parameters[2-1] = list(Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax); + this.x.graphics.exprs = exprs; + break; + } } } diff --git a/js/Electrical/NPN.pickle b/js/Electrical/NPN.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/NPN.pickle +++ b/js/Electrical/NPN.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/OpAmp.js b/js/Electrical/OpAmp.js index 51cc1f58..ceaa3228 100644 --- a/js/Electrical/OpAmp.js +++ b/js/Electrical/OpAmp.js @@ -18,29 +18,30 @@ function OpAmp() { model.rpar = Z; exprs = string(Z); gr_i = []; - x = standard_define([3,5],model,exprs,gr_i); - x.graphics.in_implicit = [["I"],["I"]]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([3,5],model,exprs,gr_i); + this.x.graphics.in_implicit = [["I"],["I"]]; + this.x.graphics.out_implicit = ["I"]; } OpAmp.prototype.details = function OpAmp() { + return this.x; } OpAmp.prototype.get = function OpAmp() { } OpAmp.prototype.set = function OpAmp() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (false) { - [ok,OLGain,SatH,SatL,exprs] = scicos_getvalue("Set the Operational Amplifier parameters",[["Open Loop Gain"],["Positive saturation voltage"],["Negative saturation voltage"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - model.equations.parameters[2-1] = list(OLGain,SatH,SatL); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,OLGain,SatH,SatL,exprs] = scicos_getvalue("Set the Operational Amplifier parameters",[["Open Loop Gain"],["Positive saturation voltage"],["Negative saturation voltage"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + model.equations.parameters[2-1] = list(OLGain,SatH,SatL); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/OpAmp.pickle b/js/Electrical/OpAmp.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/OpAmp.pickle +++ b/js/Electrical/OpAmp.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/PMOS.js b/js/Electrical/PMOS.js index 0f01116c..4a314521 100644 --- a/js/Electrical/PMOS.js +++ b/js/Electrical/PMOS.js @@ -24,29 +24,30 @@ function PMOS() { model.out = ones(size(mo.outputs,"*"),1); exprs = [[string(W)],[string(L)],[string(Beta)],[string(Vt)],[string(K2)],[string(K5)],[string(dW)],[string(dL)],[string(RDS)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = [["I"],["I"],["I"]]; + this.x = standard_define([2,2],model,exprs,gr_i); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = [["I"],["I"],["I"]]; } PMOS.prototype.details = function PMOS() { + return this.x; } PMOS.prototype.get = function PMOS() { } PMOS.prototype.set = function PMOS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs] = scicos_getvalue("Set PMOS Transistor parameters",[["Width [m]"],["Length [m]"],["Transconductance parameter [A/(V*V)]"],["Zero bias threshold voltage [V]"],["Bulk threshold parameter"],["Reduction of pinch-off region"],["Narrowing of channel [m]"],["Shortening of channel [m]"],["Drain-Source-Resistance [Ohm]"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - model.equations.parameters[2-1] = list(W,L,Beta,Vt,K2,K5,dW,dL,RDS); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs] = scicos_getvalue("Set PMOS Transistor parameters",[["Width [m]"],["Length [m]"],["Transconductance parameter [A/(V*V)]"],["Zero bias threshold voltage [V]"],["Bulk threshold parameter"],["Reduction of pinch-off region"],["Narrowing of channel [m]"],["Shortening of channel [m]"],["Drain-Source-Resistance [Ohm]"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + model.equations.parameters[2-1] = list(W,L,Beta,Vt,K2,K5,dW,dL,RDS); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/PMOS.pickle b/js/Electrical/PMOS.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/PMOS.pickle +++ b/js/Electrical/PMOS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/PNP.js b/js/Electrical/PNP.js index e86b176c..bd3fcad3 100644 --- a/js/Electrical/PNP.js +++ b/js/Electrical/PNP.js @@ -11,24 +11,24 @@ function PNP() { MO = []; P = [[100,90,-2,0],[0,50,2,0],[100,10,-2,0]]; PortName = [["C"],["B"],["E"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,29 +44,30 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } PNP.prototype.details = function PNP() { + return this.x; } PNP.prototype.get = function PNP() { } PNP.prototype.set = function PNP() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; - exprs = x.graphics.exprs; + this.x = arg1; + exprs = this.x.graphics.exprs; while (true) { - [ok,Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax,exprs] = scicos_getvalue([["Set PNP block parameters:"],[""]],[["Bf : Forward beta"],["Br : Reverse beta"],["Is : Transport saturation current"],["Vak : Early voltage (inverse), 1/Volt"],["Tauf: Ideal forward transit time"],["Taur: Ideal reverse transit time"],["Ccs : Collector-substrat(ground) cap."],["Cje : Base-emitter zero bias depletion cap."],["Cjc : Base-coll. zero bias depletion cap."],["Phie: Base-emitter diffusion voltage"],["Me : Base-emitter gradation exponent"],["Phic: Base-collector diffusion voltage"],["Mc : Base-collector gradation exponent"],["Gbc : Base-collector conductance"],["Gbe : Base-emitter conductance"],["Vt : Voltage equivalent of temperature"],["EMinMax: if x > EMinMax, the exp(x) function is linearized"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - x.model.equations.parameters[2-1] = list(Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax); - x.graphics.exprs = exprs; -break; -} + [ok,Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax,exprs] = scicos_getvalue([["Set PNP block parameters:"],[""]],[["Bf : Forward beta"],["Br : Reverse beta"],["Is : Transport saturation current"],["Vak : Early voltage (inverse), 1/Volt"],["Tauf: Ideal forward transit time"],["Taur: Ideal reverse transit time"],["Ccs : Collector-substrat(ground) cap."],["Cje : Base-emitter zero bias depletion cap."],["Cjc : Base-coll. zero bias depletion cap."],["Phie: Base-emitter diffusion voltage"],["Me : Base-emitter gradation exponent"],["Phic: Base-collector diffusion voltage"],["Mc : Base-collector gradation exponent"],["Gbc : Base-collector conductance"],["Gbe : Base-emitter conductance"],["Vt : Voltage equivalent of temperature"],["EMinMax: if x > EMinMax, the exp(x) function is linearized"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + this.x.model.equations.parameters[2-1] = list(Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax); + this.x.graphics.exprs = exprs; + break; + } } } diff --git a/js/Electrical/PNP.pickle b/js/Electrical/PNP.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/PNP.pickle +++ b/js/Electrical/PNP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/PotentialSensor.js b/js/Electrical/PotentialSensor.js index 98fc2d10..036090ad 100644 --- a/js/Electrical/PotentialSensor.js +++ b/js/Electrical/PotentialSensor.js @@ -14,15 +14,16 @@ function PotentialSensor() { mo.outputs = ["v"]; model.equations = mo; gr_i = []; - x = standard_define([2,2],model,"",list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["E"]; + this.x = standard_define([2,2],model,"",list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["E"]; } PotentialSensor.prototype.details = function PotentialSensor() { + return this.x; } PotentialSensor.prototype.get = function PotentialSensor() { } PotentialSensor.prototype.set = function PotentialSensor() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/PotentialSensor.pickle b/js/Electrical/PotentialSensor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/PotentialSensor.pickle +++ b/js/Electrical/PotentialSensor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/Resistor.js b/js/Electrical/Resistor.js index fd6d084b..c7d1de80 100644 --- a/js/Electrical/Resistor.js +++ b/js/Electrical/Resistor.js @@ -17,30 +17,31 @@ function Resistor() { model.out = ones(size(mo.outputs,"*"),1); exprs = string(R); gr_i = []; - x = standard_define([2,1],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,1],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } Resistor.prototype.details = function Resistor() { + return this.x; } Resistor.prototype.get = function Resistor() { } Resistor.prototype.set = function Resistor() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,R,exprs] = scicos_getvalue("Set Resistor block parameter","R (ohm)",list("vec",1),exprs); - if (!ok) { -break; -} - model.rpar = R; - model.equations.parameters[2-1] = list(R); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,R,exprs] = scicos_getvalue("Set Resistor block parameter","R (ohm)",list("vec",1),exprs); + if (!ok) { + break; + } + model.rpar = R; + model.equations.parameters[2-1] = list(R); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/Resistor.pickle b/js/Electrical/Resistor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Resistor.pickle +++ b/js/Electrical/Resistor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/SineVoltage.js b/js/Electrical/SineVoltage.js index 4f74d5d2..3cab0ebd 100644 --- a/js/Electrical/SineVoltage.js +++ b/js/Electrical/SineVoltage.js @@ -21,30 +21,31 @@ function SineVoltage() { model.equations = mo; exprs = [[string(V)],[string(ph)],[string(frq)],[string(offset)],[string(start)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,gr_i); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } SineVoltage.prototype.details = function SineVoltage() { + return this.x; } SineVoltage.prototype.get = function SineVoltage() { } SineVoltage.prototype.set = function SineVoltage() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,V,ph,frq,offset,start,exprs] = scicos_getvalue("Set voltage source parameter",[["Amplitude (Volt)"],["phase (rad)"],["Frequency (Hz)"],["Voltageoffset (V)"],["Timeoffset (s)"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - model.rpar = [[V],[ph],[frq],[offset],[start]]; - model.equations.parameters[2-1] = list(V,ph,frq,offset,start); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,V,ph,frq,offset,start,exprs] = scicos_getvalue("Set voltage source parameter",[["Amplitude (Volt)"],["phase (rad)"],["Frequency (Hz)"],["Voltageoffset (V)"],["Timeoffset (s)"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + model.rpar = [[V],[ph],[frq],[offset],[start]]; + model.equations.parameters[2-1] = list(V,ph,frq,offset,start); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/SineVoltage.pickle b/js/Electrical/SineVoltage.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/SineVoltage.pickle +++ b/js/Electrical/SineVoltage.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/Switch.js b/js/Electrical/Switch.js index 701dc49b..0fce8536 100644 --- a/js/Electrical/Switch.js +++ b/js/Electrical/Switch.js @@ -20,29 +20,30 @@ function Switch() { model.rpar = Z; exprs = string(Z); gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = [["I"],["E"]]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = [["I"],["E"]]; + this.x.graphics.out_implicit = ["I"]; } Switch.prototype.details = function Switch() { + return this.x; } Switch.prototype.get = function Switch() { } Switch.prototype.set = function Switch() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,Ron,Roff,exprs] = scicos_getvalue("Set non-ideal electrical switch parameters",[["Resistance in On state (Ohm)"],["Resistance in Off state (Ohm)"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - model.equations.parameters[2-1] = list(Ron,Roff); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,Ron,Roff,exprs] = scicos_getvalue("Set non-ideal electrical switch parameters",[["Resistance in On state (Ohm)"],["Resistance in Off state (Ohm)"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + model.equations.parameters[2-1] = list(Ron,Roff); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/Switch.pickle b/js/Electrical/Switch.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Switch.pickle +++ b/js/Electrical/Switch.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/VVsourceAC.js b/js/Electrical/VVsourceAC.js index 2985b8cb..4b707ec4 100644 --- a/js/Electrical/VVsourceAC.js +++ b/js/Electrical/VVsourceAC.js @@ -18,30 +18,31 @@ function VVsourceAC() { model.equations = mo; exprs = [string(FR)]; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I","E"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I","E"]; + this.x.graphics.out_implicit = ["I"]; } VVsourceAC.prototype.details = function VVsourceAC() { + return this.x; } VVsourceAC.prototype.get = function VVsourceAC() { } VVsourceAC.prototype.set = function VVsourceAC() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,FR,exprs] = scicos_getvalue("Set voltage source parameter",["Frequency (Hz)"],list("vec",-1),exprs); - if (!ok) { -break; -} - model.rpar = [FR]; - model.equations.parameters[2-1] = list(FR); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,FR,exprs] = scicos_getvalue("Set voltage source parameter",["Frequency (Hz)"],list("vec",-1),exprs); + if (!ok) { + break; + } + model.rpar = [FR]; + model.equations.parameters[2-1] = list(FR); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/VVsourceAC.pickle b/js/Electrical/VVsourceAC.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/VVsourceAC.pickle +++ b/js/Electrical/VVsourceAC.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/VariableResistor.js b/js/Electrical/VariableResistor.js index cb325cd6..0eb5c9ce 100644 --- a/js/Electrical/VariableResistor.js +++ b/js/Electrical/VariableResistor.js @@ -14,15 +14,16 @@ function VariableResistor() { model.out = ones(size(mo.outputs,"*"),1); exprs = []; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I","E"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I","E"]; + this.x.graphics.out_implicit = ["I"]; } VariableResistor.prototype.details = function VariableResistor() { + return this.x; } VariableResistor.prototype.get = function VariableResistor() { } VariableResistor.prototype.set = function VariableResistor() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/VariableResistor.pickle b/js/Electrical/VariableResistor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/VariableResistor.pickle +++ b/js/Electrical/VariableResistor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/VoltageSensor.js b/js/Electrical/VoltageSensor.js index 090bae94..ea912b49 100644 --- a/js/Electrical/VoltageSensor.js +++ b/js/Electrical/VoltageSensor.js @@ -14,15 +14,16 @@ function VoltageSensor() { model.equations = mo; exprs = []; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = [["I"],["E"]]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = [["I"],["E"]]; } VoltageSensor.prototype.details = function VoltageSensor() { + return this.x; } VoltageSensor.prototype.get = function VoltageSensor() { } VoltageSensor.prototype.set = function VoltageSensor() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/VoltageSensor.pickle b/js/Electrical/VoltageSensor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/VoltageSensor.pickle +++ b/js/Electrical/VoltageSensor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Electrical/VsourceAC.js b/js/Electrical/VsourceAC.js index 24b691b8..5b1dd0fe 100644 --- a/js/Electrical/VsourceAC.js +++ b/js/Electrical/VsourceAC.js @@ -18,30 +18,31 @@ function VsourceAC() { model.equations = mo; exprs = [[string(VA)],[string(FR)]]; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } VsourceAC.prototype.details = function VsourceAC() { + return this.x; } VsourceAC.prototype.get = function VsourceAC() { } VsourceAC.prototype.set = function VsourceAC() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,VA,FR,exprs] = scicos_getvalue("Set voltage source parameter",[["Amplitude (Volt)"],["Frequency (Hz)"]],list("vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - model.rpar = [[VA],[FR]]; - model.equations.parameters[2-1] = list(VA,FR); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,VA,FR,exprs] = scicos_getvalue("Set voltage source parameter",[["Amplitude (Volt)"],["Frequency (Hz)"]],list("vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + model.rpar = [[VA],[FR]]; + model.equations.parameters[2-1] = list(VA,FR); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/VsourceAC.pickle b/js/Electrical/VsourceAC.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/VsourceAC.pickle +++ b/js/Electrical/VsourceAC.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/ANDBLK.js b/js/Events/ANDBLK.js index 1c8b8aae..ef00fcfa 100644 --- a/js/Events/ANDBLK.js +++ b/js/Events/ANDBLK.js @@ -52,25 +52,26 @@ function ANDBLK() { diagram.objs[10-1] = split; diagram.objs[11-1] = scicos_link(xx=[[234],[234]],yy=[[275.78],[198.71]],ct=[5,-1],from=[10,1],to=[1,2]); diagram.objs[12-1] = scicos_link(xx=[[234],[361],[361]],yy=[[275.78],[275.78],[202.71]],ct=[5,-1],from=[10,2],to=[7,1]); - x = scicos_block(); - x.gui = "ANDBLK"; - x.graphics.sz = [2,2]; - x.graphics.gr_i = []; - x.graphics.pein = [[0],[0]]; - x.graphics.peout = 0; - x.model.sim = "csuper"; - x.model.evtin = [[1],[1]]; - x.model.evtout = 1; - x.model.blocktype = "h"; - x.model.firing = false; - x.model.dep_ut = [false,false]; - x.model.rpar = diagram; + this.x = scicos_block(); + this.x.gui = "ANDBLK"; + this.x.graphics.sz = [2,2]; + this.x.graphics.gr_i = []; + this.x.graphics.pein = [[0],[0]]; + this.x.graphics.peout = 0; + this.x.model.sim = "csuper"; + this.x.model.evtin = [[1],[1]]; + this.x.model.evtout = 1; + this.x.model.blocktype = "h"; + this.x.model.firing = false; + this.x.model.dep_ut = [false,false]; + this.x.model.rpar = diagram; } ANDBLK.prototype.details = function ANDBLK() { + return this.x; } ANDBLK.prototype.get = function ANDBLK() { } ANDBLK.prototype.set = function ANDBLK() { - x = arg1; + this.x = arg1; } } diff --git a/js/Events/ANDBLK.pickle b/js/Events/ANDBLK.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/ANDBLK.pickle +++ b/js/Events/ANDBLK.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/ANDLOG_f.js b/js/Events/ANDLOG_f.js index eec2ed6b..17acfade 100644 --- a/js/Events/ANDLOG_f.js +++ b/js/Events/ANDLOG_f.js @@ -9,13 +9,14 @@ function ANDLOG_f() { model.firing = []; model.dep_ut = [false,false]; gr_i = []; - x = standard_define([3,3],model,[],gr_i); + this.x = standard_define([3,3],model,[],gr_i); } ANDLOG_f.prototype.details = function ANDLOG_f() { + return this.x; } ANDLOG_f.prototype.get = function ANDLOG_f() { } ANDLOG_f.prototype.set = function ANDLOG_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Events/ANDLOG_f.pickle b/js/Events/ANDLOG_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/ANDLOG_f.pickle +++ b/js/Events/ANDLOG_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/CLKSOMV_f.js b/js/Events/CLKSOMV_f.js index b7cb2c36..b9489ab8 100644 --- a/js/Events/CLKSOMV_f.js +++ b/js/Events/CLKSOMV_f.js @@ -9,13 +9,14 @@ function CLKSOMV_f() { model.firing = -1; model.dep_ut = [false,false]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } CLKSOMV_f.prototype.details = function CLKSOMV_f() { + return this.x; } CLKSOMV_f.prototype.get = function CLKSOMV_f() { } CLKSOMV_f.prototype.set = function CLKSOMV_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Events/CLKSOMV_f.pickle b/js/Events/CLKSOMV_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/CLKSOMV_f.pickle +++ b/js/Events/CLKSOMV_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/CLKSOM_f.js b/js/Events/CLKSOM_f.js index f1fad184..45f5aa6d 100644 --- a/js/Events/CLKSOM_f.js +++ b/js/Events/CLKSOM_f.js @@ -9,13 +9,14 @@ function CLKSOM_f() { model.firing = -1; model.dep_ut = [false,false]; gr_i = []; - x = standard_define([1,1]/1.2,model,[],gr_i); + this.x = standard_define([1,1]/1.2,model,[],gr_i); } CLKSOM_f.prototype.details = function CLKSOM_f() { + return this.x; } CLKSOM_f.prototype.get = function CLKSOM_f() { } CLKSOM_f.prototype.set = function CLKSOM_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Events/CLKSOM_f.pickle b/js/Events/CLKSOM_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/CLKSOM_f.pickle +++ b/js/Events/CLKSOM_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/CLKSPLIT_f.js b/js/Events/CLKSPLIT_f.js index c24b13fb..c3792fc2 100644 --- a/js/Events/CLKSPLIT_f.js +++ b/js/Events/CLKSPLIT_f.js @@ -8,13 +8,14 @@ function CLKSPLIT_f() { model.blocktype = "d"; model.firing = [false,false,false]; model.dep_ut = [false,false]; - x = standard_define([1,1]/3,model,[],[]); + this.x = standard_define([1,1]/3,model,[],[]); } CLKSPLIT_f.prototype.details = function CLKSPLIT_f() { + return this.x; } CLKSPLIT_f.prototype.get = function CLKSPLIT_f() { } CLKSPLIT_f.prototype.set = function CLKSPLIT_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Events/CLKSPLIT_f.pickle b/js/Events/CLKSPLIT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/CLKSPLIT_f.pickle +++ b/js/Events/CLKSPLIT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/END_c.js b/js/Events/END_c.js index be502525..c385c9aa 100644 --- a/js/Events/END_c.js +++ b/js/Events/END_c.js @@ -11,29 +11,30 @@ function END_c() { model.dep_ut = [false,false]; exprs = string(tf); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } END_c.prototype.details = function END_c() { + return this.x; } END_c.prototype.get = function END_c() { } END_c.prototype.set = function END_c() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,tf,exprs] = scicos_getvalue("Set final simulation time",["Final simulation time"],list("vec",1),exprs); - if (!ok) { -break; -} - if (ok) { - graphics.exprs = exprs; - model.firing = tf; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,tf,exprs] = scicos_getvalue("Set final simulation time",["Final simulation time"],list("vec",1),exprs); + if (!ok) { + break; + } + if (ok) { + graphics.exprs = exprs; + model.firing = tf; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Events/END_c.pickle b/js/Events/END_c.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/END_c.pickle +++ b/js/Events/END_c.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/EVTDLY_c.js b/js/Events/EVTDLY_c.js index d38dd3c7..2946d381 100644 --- a/js/Events/EVTDLY_c.js +++ b/js/Events/EVTDLY_c.js @@ -13,34 +13,35 @@ function EVTDLY_c() { model.dep_ut = [false,false]; exprs = [[string(dt)],[sci2exp(ff)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } EVTDLY_c.prototype.details = function EVTDLY_c() { + return this.x; } EVTDLY_c.prototype.get = function EVTDLY_c() { } EVTDLY_c.prototype.set = function EVTDLY_c() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,dt,ff,exprs] = scicos_getvalue([["Set Event Delay block parameters"],["Delay is the delay between an input event "],[" and the generated output event"],["Block may initially generate an output event before "],[" any input event. \"Date of initial output event\""],[" gives the date of this event. Set a negative value"],[" to disable any output event."]],[["Delay"],["Date of initial output event"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (dt<=0) { -message("Delay must be positive"); - ok = false; -} - if (ok) { - graphics.exprs = exprs; - model.rpar = [[dt],[ff]]; - model.firing = ff; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,dt,ff,exprs] = scicos_getvalue([["Set Event Delay block parameters"],["Delay is the delay between an input event "],[" and the generated output event"],["Block may initially generate an output event before "],[" any input event. \"Date of initial output event\""],[" gives the date of this event. Set a negative value"],[" to disable any output event."]],[["Delay"],["Date of initial output event"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (dt<=0) { + message("Delay must be positive"); + ok = false; + } + if (ok) { + graphics.exprs = exprs; + model.rpar = [[dt],[ff]]; + model.firing = ff; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Events/EVTDLY_c.pickle b/js/Events/EVTDLY_c.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/EVTDLY_c.pickle +++ b/js/Events/EVTDLY_c.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/EVTDLY_f.js b/js/Events/EVTDLY_f.js index 4636bc98..48180c10 100644 --- a/js/Events/EVTDLY_f.js +++ b/js/Events/EVTDLY_f.js @@ -13,34 +13,35 @@ function EVTDLY_f() { model.dep_ut = [false,false]; exprs = [[string(dt)],[sci2exp(ff)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } EVTDLY_f.prototype.details = function EVTDLY_f() { + return this.x; } EVTDLY_f.prototype.get = function EVTDLY_f() { } EVTDLY_f.prototype.set = function EVTDLY_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,dt,ff,exprs] = scicos_getvalue([["Set Event Delay block parameters"],["Delay is the delay between an input event "],[" and the generated output event"],["Block may initially generate an output event before "],[" any input event. \"Date of initial output event\""],[" gives the date of this event. Set a negative value"],[" if no initial event required"]],[["Delay"],["Date of initial output event"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (dt<=0) { -message("Delay must be positive"); - ok = false; -} - if (ok) { - graphics.exprs = exprs; - model.rpar = dt; - model.firing = ff; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,dt,ff,exprs] = scicos_getvalue([["Set Event Delay block parameters"],["Delay is the delay between an input event "],[" and the generated output event"],["Block may initially generate an output event before "],[" any input event. \"Date of initial output event\""],[" gives the date of this event. Set a negative value"],[" if no initial event required"]],[["Delay"],["Date of initial output event"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (dt<=0) { + message("Delay must be positive"); + ok = false; + } + if (ok) { + graphics.exprs = exprs; + model.rpar = dt; + model.firing = ff; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Events/EVTDLY_f.pickle b/js/Events/EVTDLY_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/EVTDLY_f.pickle +++ b/js/Events/EVTDLY_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/EVTGEN_f.js b/js/Events/EVTGEN_f.js index 56b4be21..f2966e46 100644 --- a/js/Events/EVTGEN_f.js +++ b/js/Events/EVTGEN_f.js @@ -10,29 +10,30 @@ function EVTGEN_f() { model.dep_ut = [false,false]; exprs = string(tt); gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } EVTGEN_f.prototype.details = function EVTGEN_f() { + return this.x; } EVTGEN_f.prototype.get = function EVTGEN_f() { } EVTGEN_f.prototype.set = function EVTGEN_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,tt,exprs] = scicos_getvalue("Set Event time",["Event Time"],list("vec",1),exprs); - if (!ok) { -break; -} - graphics.exprs = exprs; - if (model.firing!=tt) { - model.firing = tt; -} - x.graphics = graphics; - x.model = model; -break; -} + [ok,tt,exprs] = scicos_getvalue("Set Event time",["Event Time"],list("vec",1),exprs); + if (!ok) { + break; + } + graphics.exprs = exprs; + if (model.firing!=tt) { + model.firing = tt; + } + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Events/EVTGEN_f.pickle b/js/Events/EVTGEN_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/EVTGEN_f.pickle +++ b/js/Events/EVTGEN_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/EVTVARDLY.js b/js/Events/EVTVARDLY.js index 866efa95..ac96bcd5 100644 --- a/js/Events/EVTVARDLY.js +++ b/js/Events/EVTVARDLY.js @@ -12,27 +12,28 @@ function EVTVARDLY() { model.dep_ut = [true,false]; exprs = string(model.firing); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } EVTVARDLY.prototype.details = function EVTVARDLY() { + return this.x; } EVTVARDLY.prototype.get = function EVTVARDLY() { } EVTVARDLY.prototype.set = function EVTVARDLY() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,fir,exprs] = scicos_getvalue("Set parameter of variable event delay","Initial event firing time (<0 if absent)",list("vec",1),exprs); - if (!ok) { -break; -} - graphics.exprs = exprs; - model.firing = fir; - x.graphics = graphics; - x.model = model; -break; -} + [ok,fir,exprs] = scicos_getvalue("Set parameter of variable event delay","Initial event firing time (<0 if absent)",list("vec",1),exprs); + if (!ok) { + break; + } + graphics.exprs = exprs; + model.firing = fir; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Events/EVTVARDLY.pickle b/js/Events/EVTVARDLY.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/EVTVARDLY.pickle +++ b/js/Events/EVTVARDLY.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/HALT_f.js b/js/Events/HALT_f.js index 1f8c6bf8..897b61c0 100644 --- a/js/Events/HALT_f.js +++ b/js/Events/HALT_f.js @@ -11,29 +11,30 @@ function HALT_f() { model.dep_ut = [false,false]; exprs = string(n); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } HALT_f.prototype.details = function HALT_f() { + return this.x; } HALT_f.prototype.get = function HALT_f() { } HALT_f.prototype.set = function HALT_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,n,exprs] = scicos_getvalue("Set Halt block parameters",["State on halt"],list("vec",1),exprs); - if (!ok) { -break; -} - if (ok) { - graphics.exprs = exprs; - model.ipar = n; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,n,exprs] = scicos_getvalue("Set Halt block parameters",["State on halt"],list("vec",1),exprs); + if (!ok) { + break; + } + if (ok) { + graphics.exprs = exprs; + model.ipar = n; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Events/HALT_f.pickle b/js/Events/HALT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/HALT_f.pickle +++ b/js/Events/HALT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/IFTHEL_f.js b/js/Events/IFTHEL_f.js index 181ba139..a3ea4b20 100644 --- a/js/Events/IFTHEL_f.js +++ b/js/Events/IFTHEL_f.js @@ -15,46 +15,47 @@ function IFTHEL_f() { model.nzcross = 1; gr_i = []; exprs = [[string(model.in1)],[string(model.nmode)]]; - x = standard_define([3,3],model,exprs,gr_i); + this.x = standard_define([3,3],model,exprs,gr_i); } IFTHEL_f.prototype.details = function IFTHEL_f() { + return this.x; } IFTHEL_f.prototype.get = function IFTHEL_f() { } IFTHEL_f.prototype.set = function IFTHEL_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (exprs==[]) { - exprs = string(1); -} + exprs = string(1); + } if (size(exprs,"*")==1) { - exprs[2-1] = string(1); -} + exprs[2-1] = string(1); + } while (true) { - [ok,inh,nmod,exprs] = scicos_getvalue("Set parameters",[["Inherit (1: no, 0: yes)"],["zero-crossing (0: no, 1: yes)"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - model.dep_ut = [true,false]; - if (nmod!=0) { - nmod = 1; -} - if (inh!=1) { - inh = []; -} - [model,graphics,ok] = check_io(model,graphics,1,[],inh,[[1],[1]]); - if (ok) { - graphics.exprs = exprs; - model.evtin = inh; - model.sim[2-1] = -1; - model.nmode = nmod; - model.nzcross = nmod; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,inh,nmod,exprs] = scicos_getvalue("Set parameters",[["Inherit (1: no, 0: yes)"],["zero-crossing (0: no, 1: yes)"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + model.dep_ut = [true,false]; + if (nmod!=0) { + nmod = 1; + } + if (inh!=1) { + inh = []; + } + [model,graphics,ok] = check_io(model,graphics,1,[],inh,[[1],[1]]); + if (ok) { + graphics.exprs = exprs; + model.evtin = inh; + model.sim[2-1] = -1; + model.nmode = nmod; + model.nzcross = nmod; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Events/IFTHEL_f.pickle b/js/Events/IFTHEL_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/IFTHEL_f.pickle +++ b/js/Events/IFTHEL_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/MCLOCK_f.js b/js/Events/MCLOCK_f.js index 8dce3105..e0beef45 100644 --- a/js/Events/MCLOCK_f.js +++ b/js/Events/MCLOCK_f.js @@ -58,37 +58,38 @@ function MCLOCK_f() { diagram.objs[11-1] = split2; diagram.objs[12-1] = scicos_link(xx=[[482.5],[489.6],[489.6],[354],[354]],yy=[[169.3],[169.3],[338.3],[338.3],[244.7]],ct=[10,-1],from=[11,1],to=[1,1]); diagram.objs[13-1] = scicos_link(xx=[[482.4],[482.4],[509]],yy=[[169.3],[152],[152]],ct=[10,-1],from=[11,2],to=[7,1]); - x = scicos_block(); - x.gui = "MCLOCK_f"; - x.graphics.sz = [3,2]; - x.graphics.gr_i = gr_i; - x.model.sim = "csuper"; - x.model.evtout = [[1],[1]]; - x.model.blocktype = "h"; - x.model.rpar = diagram; - x.graphics.peout = [[0],[0]]; + this.x = scicos_block(); + this.x.gui = "MCLOCK_f"; + this.x.graphics.sz = [3,2]; + this.x.graphics.gr_i = gr_i; + this.x.model.sim = "csuper"; + this.x.model.evtout = [[1],[1]]; + this.x.model.blocktype = "h"; + this.x.model.rpar = diagram; + this.x.graphics.peout = [[0],[0]]; } MCLOCK_f.prototype.details = function MCLOCK_f() { + return this.x; } MCLOCK_f.prototype.get = function MCLOCK_f() { } MCLOCK_f.prototype.set = function MCLOCK_f() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="MFCLCK_f") { - path = i; -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="MFCLCK_f") { + path = i; + break; + } + } newpar = list(); spath = list("model","rpar","objs",path); xx = arg1[spath-1]; -execstr("xxn="+xx.gui+"(\'set\',xx)"); + execstr("xxn="+xx.gui+"(\'set\',xx)"); if (or(this.xxn!=xx)) { - arg1[spath-1] = this.xxn; - newpar[size(newpar)+1-1] = path; -} - x = arg1; + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; + } + this.x = arg1; y = 0; typ = newpar; } diff --git a/js/Events/MCLOCK_f.pickle b/js/Events/MCLOCK_f.pickle index 349c1dad..a010fd54 100644 --- a/js/Events/MCLOCK_f.pickle +++ b/js/Events/MCLOCK_f.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'xxn' +S'x' p2 -atp3 -Rp4 +aS'xxn' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Events/MFCLCK_f.js b/js/Events/MFCLCK_f.js index 9e5fa63f..1dbc294f 100644 --- a/js/Events/MFCLCK_f.js +++ b/js/Events/MFCLCK_f.js @@ -15,27 +15,28 @@ function MFCLCK_f() { model.dep_ut = [false,false]; exprs = [[string(dt)],[string(nn)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } MFCLCK_f.prototype.details = function MFCLCK_f() { + return this.x; } MFCLCK_f.prototype.get = function MFCLCK_f() { } MFCLCK_f.prototype.set = function MFCLCK_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; [ok,dt,nn,exprs] = scicos_getvalue("Set Multifrequency clock parameters",[["basic period (1/f)"],["multiply by (n)"]],list("vec",1,"vec",1),exprs); if (ok) { - model.ipar = nn; - model.rpar = dt; - hh = model.firing; - hh[2-1] = 0; - model.firing = hh; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -} + model.ipar = nn; + model.rpar = dt; + hh = model.firing; + hh[2-1] = 0; + model.firing = hh; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + } } } diff --git a/js/Events/MFCLCK_f.pickle b/js/Events/MFCLCK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/MFCLCK_f.pickle +++ b/js/Events/MFCLCK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/M_freq.js b/js/Events/M_freq.js index 68f13431..ac3d3246 100644 --- a/js/Events/M_freq.js +++ b/js/Events/M_freq.js @@ -12,52 +12,53 @@ function M_freq() { model.dep_ut = [false,false]; exprs = [[sci2exp([[1],[2]])],[sci2exp([[0],[0]])]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } M_freq.prototype.details = function M_freq() { + return this.x; } M_freq.prototype.get = function M_freq() { } M_freq.prototype.set = function M_freq() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,frequ,offset,exprs] = scicos_getvalue("Set block parameters",[["Sample time"],["Offset"]],list("vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - offset = offset.slice(); - frequ = frequ.slice(); - if ((size(frequ,"*"))!=(size(offset,"*"))) { -message("offset and frequency must have the same size"); - ok = false; - } else if (or(frequ<0)) { -message("Frequency must be a positif number"); - ok = false; - } else if (or(abs(offset)>frequ)) { -message("The |Offset| must be less than the Frequency"); - ok = false; -} - if (ok) { - [m,den,off,count,m1,fir,frequ,offset,ok] = mfrequ_clk(frequ,offset); -} - if (ok) { - model.opar = list(m,double(den),off,count); - mn = (2^size(m1,"*"))-1; - [model,graphics,ok] = set_io(model,graphics,list(),list(),1,ones(mn,1)); - if (mn>3) { - graphics.sz = [40+(mn-3)*10,40]; - } else { - graphics.sz = [50,40]; -} - model.firing = fir; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,frequ,offset,exprs] = scicos_getvalue("Set block parameters",[["Sample time"],["Offset"]],list("vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + offset = offset.slice(); + frequ = frequ.slice(); + if ((size(frequ,"*"))!=(size(offset,"*"))) { + message("offset and frequency must have the same size"); + ok = false; + } else if (or(frequ<0)) { + message("Frequency must be a positif number"); + ok = false; + } else if (or(abs(offset)>frequ)) { + message("The |Offset| must be less than the Frequency"); + ok = false; + } + if (ok) { + [m,den,off,count,m1,fir,frequ,offset,ok] = mfrequ_clk(frequ,offset); + } + if (ok) { + model.opar = list(m,double(den),off,count); + mn = (2^size(m1,"*"))-1; + [model,graphics,ok] = set_io(model,graphics,list(),list(),1,ones(mn,1)); + if (mn>3) { + graphics.sz = [40+(mn-3)*10,40]; + } else { + graphics.sz = [50,40]; + } + model.firing = fir; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Events/M_freq.pickle b/js/Events/M_freq.pickle index 7d80f6e5..0bdf24af 100644 --- a/js/Events/M_freq.pickle +++ b/js/Events/M_freq.pickle @@ -2,10 +2,12 @@ c__builtin__ set p0 ((lp1 -S'of' +S'x' p2 aS'fr' p3 -atp4 -Rp5 +aS'of' +p4 +atp5 +Rp6 . \ No newline at end of file diff --git a/js/Events/VirtualCLK0.js b/js/Events/VirtualCLK0.js index 4cc02b10..f4cf1f54 100644 --- a/js/Events/VirtualCLK0.js +++ b/js/Events/VirtualCLK0.js @@ -10,13 +10,14 @@ function VirtualCLK0() { model.firing = -1; model.dep_ut = [false,false]; exprs = []; - x = standard_define([2,2],model,exprs," "); + this.x = standard_define([2,2],model,exprs," "); } VirtualCLK0.prototype.details = function VirtualCLK0() { + return this.x; } VirtualCLK0.prototype.get = function VirtualCLK0() { } VirtualCLK0.prototype.set = function VirtualCLK0() { - x = arg1; + this.x = arg1; } } diff --git a/js/Events/VirtualCLK0.pickle b/js/Events/VirtualCLK0.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/VirtualCLK0.pickle +++ b/js/Events/VirtualCLK0.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Events/freq_div.js b/js/Events/freq_div.js index 8569364c..d3a993b4 100644 --- a/js/Events/freq_div.js +++ b/js/Events/freq_div.js @@ -96,28 +96,29 @@ function freq_div() { lnk.from = [5,2,0]; lnk.to = [1,1,1]; scs_m_1.objs[10-1] = lnk; -blk={}; -lnk={}; + blk={}; + lnk={}; model = scicos_model(); model.sim = "csuper"; model.evtin = 1; model.evtout = 1; model.rpar = scs_m_1; gr_i = []; - x = standard_define([3,2],model,[],gr_i); + this.x = standard_define([3,2],model,[],gr_i); } freq_div.prototype.details = function freq_div() { + return this.x; } freq_div.prototype.get = function freq_div() { } freq_div.prototype.set = function freq_div() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="Modulo_Count") { - path = i; -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="Modulo_Count") { + path = i; + break; + } + } newpar = list(); y = 0; spath = list(); @@ -131,68 +132,68 @@ break; exprs = graphics.exprs; model = xx.model; while (true) { - [ok,%ph,%df,exprs] = scicos_getvalue("Set frequency division block parameters",[["Phase (0 to division factor -1)"],["Division factor"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (ok) { - if (%df<1) { - %df = 1; -} - %ph = abs(%ph); - if (%ph>%df-1) { - %ph = %df-1; -} - graphics.exprs = exprs; - model.ipar = %df; - model.dstate = %ph; - xxn.graphics = graphics; - xxn.model = model; -break; -} -} + [ok,%ph,%df,exprs] = scicos_getvalue("Set frequency division block parameters",[["Phase (0 to division factor -1)"],["Division factor"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (ok) { + if (%df<1) { + %df = 1; + } + %ph = abs(%ph); + if (%ph>%df-1) { + %ph = %df-1; + } + graphics.exprs = exprs; + model.ipar = %df; + model.dstate = %ph; + xxn.graphics = graphics; + xxn.model = model; + break; + } + } if (diffobjs(xxn,xx)) { - model = xx.model; - model_n = xxn.model; - if (!is_modelica_block(xx)) { - modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label); - if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) { - needcompile = 1; -} - if (or(model.firing!=model_n.firing)) { - needcompile = 2; -} - if (model.sim=="input"||model.sim=="output") { - if (model.ipar!=model_n.ipar) { - needcompile = 4; -} -} - if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { - needcompile = 4; -} - if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { - needcompile = 4; -} - if (prod(size(model_n.sim))>1) { - if (model_n.sim[2-1]>1000) { - if (model.sim[1-1]!=model_n.sim[1-1]) { - needcompile = 4; -} -} -} - } else { - modified = or(model_n!=model); - eq = model.equations; - eqn = model_n.equations; - if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { - needcompile = 4; -} -} - arg1[spath-1] = xxn; - newpar[size(newpar)+1-1] = 1; - y = max(y,needcompile); -} - x = arg1; + model = xx.model; + model_n = xxn.model; + if (!is_modelica_block(xx)) { + modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label); + if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) { + needcompile = 1; + } + if (or(model.firing!=model_n.firing)) { + needcompile = 2; + } + if (model.sim=="input"||model.sim=="output") { + if (model.ipar!=model_n.ipar) { + needcompile = 4; + } + } + if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { + needcompile = 4; + } + if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; + } + if (prod(size(model_n.sim))>1) { + if (model_n.sim[2-1]>1000) { + if (model.sim[1-1]!=model_n.sim[1-1]) { + needcompile = 4; + } + } + } + } else { + modified = or(model_n!=model); + eq = model.equations; + eqn = model_n.equations; + if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { + needcompile = 4; + } + } + arg1[spath-1] = xxn; + newpar[size(newpar)+1-1] = 1; + y = max(y,needcompile); + } + this.x = arg1; typ = newpar; } } diff --git a/js/Events/freq_div.pickle b/js/Events/freq_div.pickle index 154645d8..0d1dde24 100644 --- a/js/Events/freq_div.pickle +++ b/js/Events/freq_div.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Hydraulics/Bache.js b/js/Hydraulics/Bache.js index e8e30f10..9a0d0a11 100644 --- a/js/Hydraulics/Bache.js +++ b/js/Hydraulics/Bache.js @@ -29,30 +29,31 @@ function Bache() { model.out = ones(size(mo.outputs,"*"),1); exprs = [[string(Patm)],[string(A)],[string(ze1)],[string(ze2)],[string(zs1)],[string(zs2)],[string(z0)],[string(T0)],[string(p_rho)]]; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = [["I"],["I"]]; - x.graphics.out_implicit = [["I"],["I"],["E"]]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = [["I"],["I"]]; + this.x.graphics.out_implicit = [["I"],["I"],["E"]]; } Bache.prototype.details = function Bache() { + return this.x; } Bache.prototype.get = function Bache() { } Bache.prototype.set = function Bache() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,Patm,A,ze1,ze2,zs1,zs2,z0,T0,p_rho,exprs] = scicos_getvalue("Parametres de la bache",[["Pression dans le ciel de la bache : Patm (Pa)"],["Section de la bache : A (m2)"],["Altitude du piquage d entrée 1: ze1 (m)"],["Altitude du piquage d entrée 2: ze2 (m)"],["Altitude du piquage de sortie 1: zs1 (m)"],["Altitude du piquage de sortie 2: zs2 (m)"],["Altitude initiale du fluide : z0 (m)"],["Température initiale du fluide : T0 (K)"],["Si >0, masse volumique imposée du fluide : p_rho (kg/m3)"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - model.rpar = [[Patm],[A],[ze1],[ze2],[zs1],[zs2],[z0],[T0],[p_rho]]; - model.equations.parameters[2-1] = list(Patm,A,ze1,ze2,zs1,zs2,z0,T0,p_rho); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,Patm,A,ze1,ze2,zs1,zs2,z0,T0,p_rho,exprs] = scicos_getvalue("Parametres de la bache",[["Pression dans le ciel de la bache : Patm (Pa)"],["Section de la bache : A (m2)"],["Altitude du piquage d entrée 1: ze1 (m)"],["Altitude du piquage d entrée 2: ze2 (m)"],["Altitude du piquage de sortie 1: zs1 (m)"],["Altitude du piquage de sortie 2: zs2 (m)"],["Altitude initiale du fluide : z0 (m)"],["Température initiale du fluide : T0 (K)"],["Si >0, masse volumique imposée du fluide : p_rho (kg/m3)"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + model.rpar = [[Patm],[A],[ze1],[ze2],[zs1],[zs2],[z0],[T0],[p_rho]]; + model.equations.parameters[2-1] = list(Patm,A,ze1,ze2,zs1,zs2,z0,T0,p_rho); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Hydraulics/Bache.pickle b/js/Hydraulics/Bache.pickle index 154645d8..0d1dde24 100644 --- a/js/Hydraulics/Bache.pickle +++ b/js/Hydraulics/Bache.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Hydraulics/Flowmeter.js b/js/Hydraulics/Flowmeter.js index 6856b2fb..d236c8a7 100644 --- a/js/Hydraulics/Flowmeter.js +++ b/js/Hydraulics/Flowmeter.js @@ -11,24 +11,24 @@ function Flowmeter() { MO = []; P = [[50,105,-1,90],[0,10,2,0],[101,10,-2,0]]; PortName = [["Mesure"],["C1"],["C2"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,29 +44,30 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } Flowmeter.prototype.details = function Flowmeter() { + return this.x; } Flowmeter.prototype.get = function Flowmeter() { } Flowmeter.prototype.set = function Flowmeter() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; - exprs = x.graphics.exprs; + this.x = arg1; + exprs = this.x.graphics.exprs; while (false) { - [ok,Qini,exprs] = scicos_getvalue([["Set Flowmeter block parameters:"],[""],["Qini: "]],"Qini",list("vec",1),exprs); - if (!ok) { -break; -} - x.model.equations.parameters[2-1] = list(Qini); - x.graphics.exprs = exprs; -break; -} + [ok,Qini,exprs] = scicos_getvalue([["Set Flowmeter block parameters:"],[""],["Qini: "]],"Qini",list("vec",1),exprs); + if (!ok) { + break; + } + this.x.model.equations.parameters[2-1] = list(Qini); + this.x.graphics.exprs = exprs; + break; + } } } diff --git a/js/Hydraulics/Flowmeter.pickle b/js/Hydraulics/Flowmeter.pickle index 154645d8..0d1dde24 100644 --- a/js/Hydraulics/Flowmeter.pickle +++ b/js/Hydraulics/Flowmeter.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Hydraulics/PerteDP.js b/js/Hydraulics/PerteDP.js index b60df57f..f424272b 100644 --- a/js/Hydraulics/PerteDP.js +++ b/js/Hydraulics/PerteDP.js @@ -24,30 +24,31 @@ function PerteDP() { model.out = ones(size(mo.outputs,"*"),1); exprs = [[string(L)],[string(D)],[string(lambda)],[string(z1)],[string(z2)],[string(p_rho)]]; gr_i = []; - x = standard_define([2,1],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,1],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } PerteDP.prototype.details = function PerteDP() { + return this.x; } PerteDP.prototype.get = function PerteDP() { } PerteDP.prototype.set = function PerteDP() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,L,D,lambda,z1,z2,p_rho,exprs] = scicos_getvalue("Parametres du tuyau",[["Longueur du tube : L (m)"],["Diamètre interne du tube : D (m)"],["Coefficient de perte de charge-frottement(S.U) : lambda"],["Altitude entrée tuyauterie : z1 (m)"],["Altitude sortie tuyauterie : z2 (m)"],["Si >0, masse volumique imposée fu fluide : p_rho (kg/m3)"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - model.rpar = [[L],[D],[lambda],[z1],[z2],[p_rho]]; - model.equations.parameters[2-1] = list(L,D,lambda,z1,z2,p_rho); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,L,D,lambda,z1,z2,p_rho,exprs] = scicos_getvalue("Parametres du tuyau",[["Longueur du tube : L (m)"],["Diamètre interne du tube : D (m)"],["Coefficient de perte de charge-frottement(S.U) : lambda"],["Altitude entrée tuyauterie : z1 (m)"],["Altitude sortie tuyauterie : z2 (m)"],["Si >0, masse volumique imposée fu fluide : p_rho (kg/m3)"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + model.rpar = [[L],[D],[lambda],[z1],[z2],[p_rho]]; + model.equations.parameters[2-1] = list(L,D,lambda,z1,z2,p_rho); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Hydraulics/PerteDP.pickle b/js/Hydraulics/PerteDP.pickle index 154645d8..0d1dde24 100644 --- a/js/Hydraulics/PerteDP.pickle +++ b/js/Hydraulics/PerteDP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Hydraulics/PuitsP.js b/js/Hydraulics/PuitsP.js index 44b24efa..a6efc486 100644 --- a/js/Hydraulics/PuitsP.js +++ b/js/Hydraulics/PuitsP.js @@ -18,29 +18,30 @@ function PuitsP() { model.in1 = ones(size(mo.inputs,"*"),1); exprs = [[string(P0)],[string(T0)],[string(H0)],[string(option_temperature)]]; gr_i = []; - x = standard_define([2.5,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; + this.x = standard_define([2.5,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; } PuitsP.prototype.details = function PuitsP() { + return this.x; } PuitsP.prototype.get = function PuitsP() { } PuitsP.prototype.set = function PuitsP() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,P0,T0,H0,option_temperature,exprs] = scicos_getvalue("Paramètres du puits",[["Pression de la source : P0 (Pa)"],["Temperature de la source : T0 (K)"],["Enthalpie spécifique de la source : H0 (J/kg)"],["1:température fixée - 2:enthalpie fixée : option_temperature"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - model.rpar = [[P0],[T0],[H0],[option_temperature]]; - model.equations.parameters[2-1] = list(P0,T0,H0,option_temperature); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,P0,T0,H0,option_temperature,exprs] = scicos_getvalue("Paramètres du puits",[["Pression de la source : P0 (Pa)"],["Temperature de la source : T0 (K)"],["Enthalpie spécifique de la source : H0 (J/kg)"],["1:température fixée - 2:enthalpie fixée : option_temperature"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + model.rpar = [[P0],[T0],[H0],[option_temperature]]; + model.equations.parameters[2-1] = list(P0,T0,H0,option_temperature); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Hydraulics/PuitsP.pickle b/js/Hydraulics/PuitsP.pickle index 154645d8..0d1dde24 100644 --- a/js/Hydraulics/PuitsP.pickle +++ b/js/Hydraulics/PuitsP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Hydraulics/SourceP.js b/js/Hydraulics/SourceP.js index c0f4a876..504f1e52 100644 --- a/js/Hydraulics/SourceP.js +++ b/js/Hydraulics/SourceP.js @@ -20,29 +20,30 @@ function SourceP() { model.out = ones(size(mo.outputs,"*"),1); exprs = [[string(P0)],[string(T0)],[string(H0)],[string(option_temperature)]]; gr_i = []; - x = standard_define([2.5,2],model,exprs,list(gr_i,0)); - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2.5,2],model,exprs,list(gr_i,0)); + this.x.graphics.out_implicit = ["I"]; } SourceP.prototype.details = function SourceP() { + return this.x; } SourceP.prototype.get = function SourceP() { } SourceP.prototype.set = function SourceP() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,P0,T0,H0,option_temperature,exprs] = scicos_getvalue("Paramètres du puits",[["Pression de la source : P0 (Pa)"],["Temperature de la source : T0 (K)"],["Enthalpie spécifique de la source : H0 (J/kg)"],["1:température fixée - 2:enthalpie fixée : option_temperature"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - model.rpar = [[P0],[T0],[H0],[option_temperature]]; - model.equations.parameters[2-1] = list(P0,T0,H0,option_temperature); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,P0,T0,H0,option_temperature,exprs] = scicos_getvalue("Paramètres du puits",[["Pression de la source : P0 (Pa)"],["Temperature de la source : T0 (K)"],["Enthalpie spécifique de la source : H0 (J/kg)"],["1:température fixée - 2:enthalpie fixée : option_temperature"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + model.rpar = [[P0],[T0],[H0],[option_temperature]]; + model.equations.parameters[2-1] = list(P0,T0,H0,option_temperature); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Hydraulics/SourceP.pickle b/js/Hydraulics/SourceP.pickle index 154645d8..0d1dde24 100644 --- a/js/Hydraulics/SourceP.pickle +++ b/js/Hydraulics/SourceP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Hydraulics/VanneReglante.js b/js/Hydraulics/VanneReglante.js index 52ef8478..e3f32a7f 100644 --- a/js/Hydraulics/VanneReglante.js +++ b/js/Hydraulics/VanneReglante.js @@ -20,30 +20,31 @@ function VanneReglante() { model.out = ones(size(mo.outputs,"*"),1); exprs = [[string(Cvmax)],[string(p_rho)]]; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = [["I"],["E"]]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = [["I"],["E"]]; + this.x.graphics.out_implicit = ["I"]; } VanneReglante.prototype.details = function VanneReglante() { + return this.x; } VanneReglante.prototype.get = function VanneReglante() { } VanneReglante.prototype.set = function VanneReglante() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,Cvmax,p_rho,exprs] = scicos_getvalue("Paramètres de la vanne reglante",[["Cvmax"],["p_rho"]],list("vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - model.rpar = [[Cvmax],[p_rho]]; - model.equations.parameters[2-1] = list(Cvmax,p_rho); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,Cvmax,p_rho,exprs] = scicos_getvalue("Paramètres de la vanne reglante",[["Cvmax"],["p_rho"]],list("vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + model.rpar = [[Cvmax],[p_rho]]; + model.equations.parameters[2-1] = list(Cvmax,p_rho); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Hydraulics/VanneReglante.pickle b/js/Hydraulics/VanneReglante.pickle index 154645d8..0d1dde24 100644 --- a/js/Hydraulics/VanneReglante.pickle +++ b/js/Hydraulics/VanneReglante.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/IntegerOp/BITCLEAR.js b/js/IntegerOp/BITCLEAR.js index a7f8cbd6..69a6c8e9 100644 --- a/js/IntegerOp/BITCLEAR.js +++ b/js/IntegerOp/BITCLEAR.js @@ -14,73 +14,74 @@ function BITCLEAR() { model.dep_ut = [true,false]; exprs = [[sci2exp(3)],[sci2exp(0)]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } BITCLEAR.prototype.details = function BITCLEAR() { + return this.x; } BITCLEAR.prototype.get = function BITCLEAR() { } BITCLEAR.prototype.set = function BITCLEAR() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,Datatype,bit,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"BITCLEAR")],[" "],[gettext("Clear a bit")],[" "]],[[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)")],[gettext("Index of Bit (0 is least significant)")]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - in1 = [model.in1,model.in2]; - if (floor(bit)!=bit) { -block_parameter_error(msprintf(gettext("Wrong type for \'%s\' parameter: %5.1f."),gettext("Index of Bit"),bit),gettext("Must be integer.")); - ok = false; - } else if ((Datatype==3)||(Datatype==6)) { - if (bit>31||bit<0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 31]")); - ok = false; - } else { - bit = uint32(bit); - n = (2^32-1)-2^bit; - n = uint32(n); - model.sim = list("bit_clear_32",4); -} - } else if ((Datatype==4)||(Datatype==7)) { - if (bit>15||bit<0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 15]")); - ok = false; - } else { - bit = uint16(bit); - n = (2^16-1)-2^bit; - n = uint16(n); - model.sim = list("bit_clear_16",4); -} - } else if ((Datatype==5)||(Datatype==8)) { - if (bit>7||bit<0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 7]")); - ok = false; - } else { - bit = uint8(bit); - n = (2^8-1)-2^bit; - n = uint8(n); - model.sim = list("bit_clear_8",4); -} - } else { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),Datatype),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); - ok = false; -} - if (ok) { - it = Datatype; - ot = Datatype; - out = [1,1]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - graphics.exprs = exprs; - model.opar = list(n); - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,Datatype,bit,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"BITCLEAR")],[" "],[gettext("Clear a bit")],[" "]],[[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)")],[gettext("Index of Bit (0 is least significant)")]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + in1 = [model.in1,model.in2]; + if (floor(bit)!=bit) { + block_parameter_error(msprintf(gettext("Wrong type for \'%s\' parameter: %5.1f."),gettext("Index of Bit"),bit),gettext("Must be integer.")); + ok = false; + } else if ((Datatype==3)||(Datatype==6)) { + if (bit>31||bit<0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 31]")); + ok = false; + } else { + bit = uint32(bit); + n = (2^32-1)-2^bit; + n = uint32(n); + model.sim = list("bit_clear_32",4); + } + } else if ((Datatype==4)||(Datatype==7)) { + if (bit>15||bit<0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 15]")); + ok = false; + } else { + bit = uint16(bit); + n = (2^16-1)-2^bit; + n = uint16(n); + model.sim = list("bit_clear_16",4); + } + } else if ((Datatype==5)||(Datatype==8)) { + if (bit>7||bit<0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 7]")); + ok = false; + } else { + bit = uint8(bit); + n = (2^8-1)-2^bit; + n = uint8(n); + model.sim = list("bit_clear_8",4); + } + } else { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),Datatype),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); + ok = false; + } + if (ok) { + it = Datatype; + ot = Datatype; + out = [1,1]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + graphics.exprs = exprs; + model.opar = list(n); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/BITCLEAR.pickle b/js/IntegerOp/BITCLEAR.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/BITCLEAR.pickle +++ b/js/IntegerOp/BITCLEAR.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/IntegerOp/BITSET.js b/js/IntegerOp/BITSET.js index eedd3092..b214103d 100644 --- a/js/IntegerOp/BITSET.js +++ b/js/IntegerOp/BITSET.js @@ -14,71 +14,72 @@ function BITSET() { model.dep_ut = [true,false]; exprs = [[sci2exp(3)],[sci2exp(0)]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } BITSET.prototype.details = function BITSET() { + return this.x; } BITSET.prototype.get = function BITSET() { } BITSET.prototype.set = function BITSET() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,Datatype,bit,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"BITSET")],[" "],[gettext("Set a bit")],[" "]],[[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)")],[gettext("Index of Bit (0 is least significant)")]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - in1 = [model.in1,model.in2]; - if (floor(bit)!=bit) { -block_parameter_error(msprintf(gettext("Wrong type for \'%s\' parameter: %5.1f."),gettext("Index of Bit"),bit),gettext("Must be integer.")); - ok = false; -} - if ((Datatype==3)||(Datatype==6)) { - if (bit>31||bit<0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 31]")); - ok = false; -} - bit = uint32(bit); - n = 2^bit; - n = uint32(n); - model.sim = list("bit_set_32",4); - } else if ((Datatype==4)||(Datatype==7)) { - if (bit>15||bit<0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 15]")); - ok = false; -} - bit = uint16(bit); - n = 2^bit; - n = uint16(n); - model.sim = list("bit_set_16",4); - } else if ((Datatype==5)||(Datatype==8)) { - if (bit>7||bit<0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 7]")); - ok = false; -} - bit = uint8(bit); - n = 2^bit; - n = uint8(n); - model.sim = list("bit_set_8",4); - } else { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),Datatype),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); - ok = false; -} - if (ok) { - it = Datatype; - ot = Datatype; - out = [1,1]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - graphics.exprs = exprs; - model.opar = list(n); - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,Datatype,bit,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"BITSET")],[" "],[gettext("Set a bit")],[" "]],[[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)")],[gettext("Index of Bit (0 is least significant)")]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + in1 = [model.in1,model.in2]; + if (floor(bit)!=bit) { + block_parameter_error(msprintf(gettext("Wrong type for \'%s\' parameter: %5.1f."),gettext("Index of Bit"),bit),gettext("Must be integer.")); + ok = false; + } + if ((Datatype==3)||(Datatype==6)) { + if (bit>31||bit<0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 31]")); + ok = false; + } + bit = uint32(bit); + n = 2^bit; + n = uint32(n); + model.sim = list("bit_set_32",4); + } else if ((Datatype==4)||(Datatype==7)) { + if (bit>15||bit<0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 15]")); + ok = false; + } + bit = uint16(bit); + n = 2^bit; + n = uint16(n); + model.sim = list("bit_set_16",4); + } else if ((Datatype==5)||(Datatype==8)) { + if (bit>7||bit<0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Index of Bit"),bit),msprintf(gettext("Must be in the interval %s."),"[0, 7]")); + ok = false; + } + bit = uint8(bit); + n = 2^bit; + n = uint8(n); + model.sim = list("bit_set_8",4); + } else { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),Datatype),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); + ok = false; + } + if (ok) { + it = Datatype; + ot = Datatype; + out = [1,1]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + graphics.exprs = exprs; + model.opar = list(n); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/BITSET.pickle b/js/IntegerOp/BITSET.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/BITSET.pickle +++ b/js/IntegerOp/BITSET.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/IntegerOp/CONVERT.js b/js/IntegerOp/CONVERT.js index b0106c7e..7686794e 100644 --- a/js/IntegerOp/CONVERT.js +++ b/js/IntegerOp/CONVERT.js @@ -16,355 +16,356 @@ function CONVERT() { model.dep_ut = [true,false]; exprs = [[sci2exp(1)],[sci2exp(3)],[sci2exp(0)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } CONVERT.prototype.details = function CONVERT() { + return this.x; } CONVERT.prototype.get = function CONVERT() { } CONVERT.prototype.set = function CONVERT() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,it,ot,np,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CONVERT")],[" "],[gettext("Type conversion")],[" "]],[[gettext("Input Type (1:double, 3:int32, 4:int16, 5:int8, ...)")],[gettext("Output Type (1:double, 3:int32, 4:int16, 5:int8, ...)")],[gettext("Do on Overflow (0:Nothing, 1:Saturate, 2:Error)")]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (it==2) { - it = 1; -} - if (ot==2) { - ot = 1; -} - if ((np!=0&&np!=1&&np!=2)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Do on Overflow"),np),msprintf(gettext("Must be in the interval %s."),"[0, 2]")); - ok = false; - } else if ((it>8||it<1)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Input Type"),it),msprintf(gettext("Must be in the interval %s."),"[1, 8]")); - ok = false; - } else if ((ot>8||ot<1)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Output Type"),ot),msprintf(gettext("Must be in the interval %s."),"[1, 8]")); - ok = false; -} - model.sim = list("convert",4); - if ((it==ot)) { - model.ipar = 1; - } else { - if ((np==0)) { - if ((it==1)) { - if ((ot==3)) { - model.ipar = 2; - } else if ((ot==4)) { - model.ipar = 3; - } else if ((ot==5)) { - model.ipar = 4; - } else if ((ot==6)) { - model.ipar = 5; - } else if ((ot==7)) { - model.ipar = 6; - } else if ((ot==8)) { - model.ipar = 7; -} - } else if ((it==3)) { - if ((ot==1)) { - model.ipar = 8; - } else if ((ot==4)) { - model.ipar = 9; - } else if ((ot==5)) { - model.ipar = 10; - } else if ((ot==6)) { - model.ipar = 1; - } else if ((ot==7)) { - model.ipar = 11; - } else if ((ot==8)) { - model.ipar = 12; -} - } else if ((it==4)) { - if ((ot==1)) { - model.ipar = 13; - } else if ((ot==3)) { - model.ipar = 14; - } else if ((ot==5)) { - model.ipar = 15; - } else if ((ot==6)) { - model.ipar = 16; - } else if ((ot==7)) { - model.ipar = 1; - } else if ((ot==8)) { - model.ipar = 17; -} - } else if ((it==5)) { - if ((ot==1)) { - model.ipar = 18; - } else if ((ot==3)) { - model.ipar = 19; - } else if ((ot==4)) { - model.ipar = 20; - } else if ((ot==6)) { - model.ipar = 21; - } else if ((ot==7)) { - model.ipar = 22; - } else if ((ot==8)) { - model.ipar = 1; -} - } else if ((it==6)) { - if ((ot==1)) { - model.ipar = 23; - } else if ((ot==3)) { - model.ipar = 1; - } else if ((ot==4)) { - model.ipar = 24; - } else if ((ot==5)) { - model.ipar = 25; - } else if ((ot==7)) { - model.ipar = 26; - } else if ((ot==8)) { - model.ipar = 27; -} - } else if ((it==7)) { - if ((ot==1)) { - model.ipar = 28; - } else if ((ot==3)) { - model.ipar = 29; - } else if ((ot==4)) { - model.ipar = 1; - } else if ((ot==5)) { - model.ipar = 30; - } else if ((ot==6)) { - model.ipar = 31; - } else if ((ot==8)) { - model.ipar = 32; -} - } else if ((it==8)) { - if ((ot==1)) { - model.ipar = 33; - } else if ((ot==3)) { - model.ipar = 34; - } else if ((ot==4)) { - model.ipar = 35; - } else if ((ot==5)) { - model.ipar = 1; - } else if ((ot==6)) { - model.ipar = 36; - } else if ((ot==7)) { - model.ipar = 37; -} -} - } else if ((np==1)) { - if ((it==1)) { - if ((ot==3)) { - model.ipar = 38; - } else if ((ot==4)) { - model.ipar = 39; - } else if ((ot==5)) { - model.ipar = 40; - } else if ((ot==6)) { - model.ipar = 41; - } else if ((ot==7)) { - model.ipar = 42; - } else if ((ot==8)) { - model.ipar = 43; -} - } else if ((it==3)) { - if ((ot==1)) { - model.ipar = 8; - } else if ((ot==4)) { - model.ipar = 44; - } else if ((ot==5)) { - model.ipar = 45; - } else if ((ot==6)) { - model.ipar = 46; - } else if ((ot==7)) { - model.ipar = 47; - } else if ((ot==8)) { - model.ipar = 48; -} - } else if ((it==4)) { - if ((ot==1)) { - model.ipar = 13; - } else if ((ot==3)) { - model.ipar = 14; - } else if ((ot==5)) { - model.ipar = 49; - } else if ((ot==6)) { - model.ipar = 50; - } else if ((ot==7)) { - model.ipar = 51; - } else if ((ot==8)) { - model.ipar = 52; -} - } else if ((it==5)) { - if ((ot==1)) { - model.ipar = 18; - } else if ((ot==3)) { - model.ipar = 19; - } else if ((ot==4)) { - model.ipar = 20; - } else if ((ot==6)) { - model.ipar = 53; - } else if ((ot==7)) { - model.ipar = 54; - } else if ((ot==8)) { - model.ipar = 55; -} - } else if ((it==6)) { - if ((ot==1)) { - model.ipar = 23; - } else if ((ot==3)) { - model.ipar = 56; - } else if ((ot==4)) { - model.ipar = 57; - } else if ((ot==5)) { - model.ipar = 58; - } else if ((ot==7)) { - model.ipar = 59; - } else if ((ot==8)) { - model.ipar = 60; -} - } else if ((it==7)) { - if ((ot==1)) { - model.ipar = 28; - } else if ((ot==3)) { - model.ipar = 29; - } else if ((ot==4)) { - model.ipar = 61; - } else if ((ot==5)) { - model.ipar = 62; - } else if ((ot==6)) { - model.ipar = 31; - } else if ((ot==8)) { - model.ipar = 63; -} - } else if ((it==8)) { - if ((ot==1)) { - model.ipar = 33; - } else if ((ot==3)) { - model.ipar = 34; - } else if ((ot==4)) { - model.ipar = 35; - } else if ((ot==5)) { - model.ipar = 64; - } else if ((ot==6)) { - model.ipar = 36; - } else if ((ot==7)) { - model.ipar = 37; -} -} - } else if ((np==2)) { - if ((it==1)) { - if ((ot==3)) { - model.ipar = 65; - } else if ((ot==4)) { - model.ipar = 66; - } else if ((ot==5)) { - model.ipar = 67; - } else if ((ot==6)) { - model.ipar = 68; - } else if ((ot==7)) { - model.ipar = 69; - } else if ((ot==8)) { - model.ipar = 70; -} - } else if ((it==3)) { - if ((ot==1)) { - model.ipar = 8; - } else if ((ot==4)) { - model.ipar = 71; - } else if ((ot==5)) { - model.ipar = 72; - } else if ((ot==6)) { - model.ipar = 73; - } else if ((ot==7)) { - model.ipar = 74; - } else if ((ot==8)) { - model.ipar = 75; -} - } else if ((it==4)) { - if ((ot==1)) { - model.ipar = 13; - } else if ((ot==3)) { - model.ipar = 14; - } else if ((ot==5)) { - model.ipar = 76; - } else if ((ot==6)) { - model.ipar = 77; - } else if ((ot==7)) { - model.ipar = 78; - } else if ((ot==8)) { - model.ipar = 79; -} - } else if ((it==5)) { - if ((ot==1)) { - model.ipar = 18; - } else if ((ot==3)) { - model.ipar = 19; - } else if ((ot==4)) { - model.ipar = 20; - } else if ((ot==6)) { - model.ipar = 80; - } else if ((ot==7)) { - model.ipar = 81; - } else if ((ot==8)) { - model.ipar = 82; -} - } else if ((it==6)) { - if ((ot==1)) { - model.ipar = 23; - } else if ((ot==3)) { - model.ipar = 83; - } else if ((ot==4)) { - model.ipar = 84; - } else if ((ot==5)) { - model.ipar = 85; - } else if ((ot==7)) { - model.ipar = 86; - } else if ((ot==8)) { - model.ipar = 87; -} - } else if ((it==7)) { - if ((ot==1)) { - model.ipar = 28; - } else if ((ot==3)) { - model.ipar = 29; - } else if ((ot==4)) { - model.ipar = 88; - } else if ((ot==5)) { - model.ipar = 89; - } else if ((ot==6)) { - model.ipar = 31; - } else if ((ot==8)) { - model.ipar = 90; -} - } else if ((it==8)) { - if ((ot==1)) { - model.ipar = 33; - } else if ((ot==3)) { - model.ipar = 34; - } else if ((ot==4)) { - model.ipar = 35; - } else if ((ot==5)) { - model.ipar = 91; - } else if ((ot==6)) { - model.ipar = 36; - } else if ((ot==7)) { - model.ipar = 37; -} -} -} -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,it,ot,np,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CONVERT")],[" "],[gettext("Type conversion")],[" "]],[[gettext("Input Type (1:double, 3:int32, 4:int16, 5:int8, ...)")],[gettext("Output Type (1:double, 3:int32, 4:int16, 5:int8, ...)")],[gettext("Do on Overflow (0:Nothing, 1:Saturate, 2:Error)")]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (it==2) { + it = 1; + } + if (ot==2) { + ot = 1; + } + if ((np!=0&&np!=1&&np!=2)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Do on Overflow"),np),msprintf(gettext("Must be in the interval %s."),"[0, 2]")); + ok = false; + } else if ((it>8||it<1)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Input Type"),it),msprintf(gettext("Must be in the interval %s."),"[1, 8]")); + ok = false; + } else if ((ot>8||ot<1)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Output Type"),ot),msprintf(gettext("Must be in the interval %s."),"[1, 8]")); + ok = false; + } + model.sim = list("convert",4); + if ((it==ot)) { + model.ipar = 1; + } else { + if ((np==0)) { + if ((it==1)) { + if ((ot==3)) { + model.ipar = 2; + } else if ((ot==4)) { + model.ipar = 3; + } else if ((ot==5)) { + model.ipar = 4; + } else if ((ot==6)) { + model.ipar = 5; + } else if ((ot==7)) { + model.ipar = 6; + } else if ((ot==8)) { + model.ipar = 7; + } + } else if ((it==3)) { + if ((ot==1)) { + model.ipar = 8; + } else if ((ot==4)) { + model.ipar = 9; + } else if ((ot==5)) { + model.ipar = 10; + } else if ((ot==6)) { + model.ipar = 1; + } else if ((ot==7)) { + model.ipar = 11; + } else if ((ot==8)) { + model.ipar = 12; + } + } else if ((it==4)) { + if ((ot==1)) { + model.ipar = 13; + } else if ((ot==3)) { + model.ipar = 14; + } else if ((ot==5)) { + model.ipar = 15; + } else if ((ot==6)) { + model.ipar = 16; + } else if ((ot==7)) { + model.ipar = 1; + } else if ((ot==8)) { + model.ipar = 17; + } + } else if ((it==5)) { + if ((ot==1)) { + model.ipar = 18; + } else if ((ot==3)) { + model.ipar = 19; + } else if ((ot==4)) { + model.ipar = 20; + } else if ((ot==6)) { + model.ipar = 21; + } else if ((ot==7)) { + model.ipar = 22; + } else if ((ot==8)) { + model.ipar = 1; + } + } else if ((it==6)) { + if ((ot==1)) { + model.ipar = 23; + } else if ((ot==3)) { + model.ipar = 1; + } else if ((ot==4)) { + model.ipar = 24; + } else if ((ot==5)) { + model.ipar = 25; + } else if ((ot==7)) { + model.ipar = 26; + } else if ((ot==8)) { + model.ipar = 27; + } + } else if ((it==7)) { + if ((ot==1)) { + model.ipar = 28; + } else if ((ot==3)) { + model.ipar = 29; + } else if ((ot==4)) { + model.ipar = 1; + } else if ((ot==5)) { + model.ipar = 30; + } else if ((ot==6)) { + model.ipar = 31; + } else if ((ot==8)) { + model.ipar = 32; + } + } else if ((it==8)) { + if ((ot==1)) { + model.ipar = 33; + } else if ((ot==3)) { + model.ipar = 34; + } else if ((ot==4)) { + model.ipar = 35; + } else if ((ot==5)) { + model.ipar = 1; + } else if ((ot==6)) { + model.ipar = 36; + } else if ((ot==7)) { + model.ipar = 37; + } + } + } else if ((np==1)) { + if ((it==1)) { + if ((ot==3)) { + model.ipar = 38; + } else if ((ot==4)) { + model.ipar = 39; + } else if ((ot==5)) { + model.ipar = 40; + } else if ((ot==6)) { + model.ipar = 41; + } else if ((ot==7)) { + model.ipar = 42; + } else if ((ot==8)) { + model.ipar = 43; + } + } else if ((it==3)) { + if ((ot==1)) { + model.ipar = 8; + } else if ((ot==4)) { + model.ipar = 44; + } else if ((ot==5)) { + model.ipar = 45; + } else if ((ot==6)) { + model.ipar = 46; + } else if ((ot==7)) { + model.ipar = 47; + } else if ((ot==8)) { + model.ipar = 48; + } + } else if ((it==4)) { + if ((ot==1)) { + model.ipar = 13; + } else if ((ot==3)) { + model.ipar = 14; + } else if ((ot==5)) { + model.ipar = 49; + } else if ((ot==6)) { + model.ipar = 50; + } else if ((ot==7)) { + model.ipar = 51; + } else if ((ot==8)) { + model.ipar = 52; + } + } else if ((it==5)) { + if ((ot==1)) { + model.ipar = 18; + } else if ((ot==3)) { + model.ipar = 19; + } else if ((ot==4)) { + model.ipar = 20; + } else if ((ot==6)) { + model.ipar = 53; + } else if ((ot==7)) { + model.ipar = 54; + } else if ((ot==8)) { + model.ipar = 55; + } + } else if ((it==6)) { + if ((ot==1)) { + model.ipar = 23; + } else if ((ot==3)) { + model.ipar = 56; + } else if ((ot==4)) { + model.ipar = 57; + } else if ((ot==5)) { + model.ipar = 58; + } else if ((ot==7)) { + model.ipar = 59; + } else if ((ot==8)) { + model.ipar = 60; + } + } else if ((it==7)) { + if ((ot==1)) { + model.ipar = 28; + } else if ((ot==3)) { + model.ipar = 29; + } else if ((ot==4)) { + model.ipar = 61; + } else if ((ot==5)) { + model.ipar = 62; + } else if ((ot==6)) { + model.ipar = 31; + } else if ((ot==8)) { + model.ipar = 63; + } + } else if ((it==8)) { + if ((ot==1)) { + model.ipar = 33; + } else if ((ot==3)) { + model.ipar = 34; + } else if ((ot==4)) { + model.ipar = 35; + } else if ((ot==5)) { + model.ipar = 64; + } else if ((ot==6)) { + model.ipar = 36; + } else if ((ot==7)) { + model.ipar = 37; + } + } + } else if ((np==2)) { + if ((it==1)) { + if ((ot==3)) { + model.ipar = 65; + } else if ((ot==4)) { + model.ipar = 66; + } else if ((ot==5)) { + model.ipar = 67; + } else if ((ot==6)) { + model.ipar = 68; + } else if ((ot==7)) { + model.ipar = 69; + } else if ((ot==8)) { + model.ipar = 70; + } + } else if ((it==3)) { + if ((ot==1)) { + model.ipar = 8; + } else if ((ot==4)) { + model.ipar = 71; + } else if ((ot==5)) { + model.ipar = 72; + } else if ((ot==6)) { + model.ipar = 73; + } else if ((ot==7)) { + model.ipar = 74; + } else if ((ot==8)) { + model.ipar = 75; + } + } else if ((it==4)) { + if ((ot==1)) { + model.ipar = 13; + } else if ((ot==3)) { + model.ipar = 14; + } else if ((ot==5)) { + model.ipar = 76; + } else if ((ot==6)) { + model.ipar = 77; + } else if ((ot==7)) { + model.ipar = 78; + } else if ((ot==8)) { + model.ipar = 79; + } + } else if ((it==5)) { + if ((ot==1)) { + model.ipar = 18; + } else if ((ot==3)) { + model.ipar = 19; + } else if ((ot==4)) { + model.ipar = 20; + } else if ((ot==6)) { + model.ipar = 80; + } else if ((ot==7)) { + model.ipar = 81; + } else if ((ot==8)) { + model.ipar = 82; + } + } else if ((it==6)) { + if ((ot==1)) { + model.ipar = 23; + } else if ((ot==3)) { + model.ipar = 83; + } else if ((ot==4)) { + model.ipar = 84; + } else if ((ot==5)) { + model.ipar = 85; + } else if ((ot==7)) { + model.ipar = 86; + } else if ((ot==8)) { + model.ipar = 87; + } + } else if ((it==7)) { + if ((ot==1)) { + model.ipar = 28; + } else if ((ot==3)) { + model.ipar = 29; + } else if ((ot==4)) { + model.ipar = 88; + } else if ((ot==5)) { + model.ipar = 89; + } else if ((ot==6)) { + model.ipar = 31; + } else if ((ot==8)) { + model.ipar = 90; + } + } else if ((it==8)) { + if ((ot==1)) { + model.ipar = 33; + } else if ((ot==3)) { + model.ipar = 34; + } else if ((ot==4)) { + model.ipar = 35; + } else if ((ot==5)) { + model.ipar = 91; + } else if ((ot==6)) { + model.ipar = 36; + } else if ((ot==7)) { + model.ipar = 37; + } + } + } + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/CONVERT.pickle b/js/IntegerOp/CONVERT.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/CONVERT.pickle +++ b/js/IntegerOp/CONVERT.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/IntegerOp/DFLIPFLOP.js b/js/IntegerOp/DFLIPFLOP.js index 1831526e..5a703f00 100644 --- a/js/IntegerOp/DFLIPFLOP.js +++ b/js/IntegerOp/DFLIPFLOP.js @@ -89,13 +89,14 @@ function DFLIPFLOP() { model.dep_ut = [true,false]; model.rpar = scs_m; gr_i = []; - x = standard_define([2,3],model,[],gr_i); + this.x = standard_define([2,3],model,[],gr_i); } DFLIPFLOP.prototype.details = function DFLIPFLOP() { + return this.x; } DFLIPFLOP.prototype.get = function DFLIPFLOP() { } DFLIPFLOP.prototype.set = function DFLIPFLOP() { - x = arg1; + this.x = arg1; } } diff --git a/js/IntegerOp/DFLIPFLOP.pickle b/js/IntegerOp/DFLIPFLOP.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/DFLIPFLOP.pickle +++ b/js/IntegerOp/DFLIPFLOP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/IntegerOp/DLATCH.js b/js/IntegerOp/DLATCH.js index a5d6633f..174cfa92 100644 --- a/js/IntegerOp/DLATCH.js +++ b/js/IntegerOp/DLATCH.js @@ -34,13 +34,14 @@ function DLATCH() { model.dep_ut = [true,false]; model.rpar = scs_m; gr_i = []; - x = standard_define([2,3],model,[],gr_i); + this.x = standard_define([2,3],model,[],gr_i); } DLATCH.prototype.details = function DLATCH() { + return this.x; } DLATCH.prototype.get = function DLATCH() { } DLATCH.prototype.set = function DLATCH() { - x = arg1; + this.x = arg1; } } diff --git a/js/IntegerOp/DLATCH.pickle b/js/IntegerOp/DLATCH.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/DLATCH.pickle +++ b/js/IntegerOp/DLATCH.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/IntegerOp/EXTRACTBITS.js b/js/IntegerOp/EXTRACTBITS.js index a2f1a280..c8cc060a 100644 --- a/js/IntegerOp/EXTRACTBITS.js +++ b/js/IntegerOp/EXTRACTBITS.js @@ -15,215 +15,216 @@ function EXTRACTBITS() { model.dep_ut = [true,false]; exprs = [[sci2exp(3)],[sci2exp(1)],[sci2exp(0)],[sci2exp(0)]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } EXTRACTBITS.prototype.details = function EXTRACTBITS() { + return this.x; } EXTRACTBITS.prototype.get = function EXTRACTBITS() { } EXTRACTBITS.prototype.set = function EXTRACTBITS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,Datatype,rule,bit,scal,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"EXTRACTBITS")],[" "],[gettext("Bits Extraction")],[" "],[gettext(" - Bits to Extract:")],[gettext("    1 Upper Half")],[gettext("    2 Lower Half")],[gettext("    3 Range from MSB")],[gettext("    4 Range to LSB")],[gettext("    5 Range of Bits")],[gettext(" - Number of Bits or Index of bit : Index 0 is LSB")],[gettext("    If \'Bits to Extract\' is set to \'Range of bits\': [Start, End]")],[" "]],[[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)")],[gettext("Bits to extract")],[gettext("Number of Bits or Index of Bit")],[gettext("Treat Bit Field as an Integer (0:No, 1:Yes)")]],list("vec",1,"vec",1,"vec",-1,"vec",1),exprs); - if (!ok) { -break; -} - bitstr = strcat(string(bit.slice())," "); - if ((rule<1)||(rule>5)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Bits to Extract"),rule),msprintf(gettext("Must be in the interval %s."),"[1, 5]")); - ok = false; - } else if (scal<0||scal>1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Treat Bit Field as an Integer"),scal),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); - ok = false; - } else { - in1 = [model.in1,model.in2]; - bit = int(bit); - rule = int(rule); - if ((rule==3)||(rule==4)) { - if ((size(bit,"*")!=1)) { -block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),gettext("Must be a single value.")); - ok = false; - } else { - numb = bit; -} - } else if ((rule==5)) { - if ((size(bit,"*")!=2)) { -block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),gettext("Must have this form: [Start, End].")); - ok = false; - } else if (bit[1-1]>bit[2-1]) { -block_parameter_error(msprintf(gettext("Wrong values for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("\'Start\' must be less than \'End\'."))); - ok = false; - } else { - numb = bit[2-1]-bit[1-1]; -} - } else { - bit = 0; - numb = []; -} -} - if (ok) { - if ((Datatype==3||Datatype==6)) { - if (or(bit.slice()>31)||or(bit.slice()<0)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("Indexes must be in the interval %s."),"[0, 31]")); - ok = false; -} - switch (rule) { - case 1: - switch (scal) { - case 0: - model.sim = list("extract_bit_32_UH0",4); - case 1: - switch (Datatype) { - case 3: - model.sim = list("extract_bit_32_UH1",4); - case 6: - model.sim = list("extract_bit_u32_UH1",4); -} -} - case 2: - model.sim = list("extract_bit_32_LH",4); - case 3: - switch (scal) { - case 0: - model.sim = list("extract_bit_32_MSB0",4); - case 1: - switch (Datatype) { - case 3: - model.sim = list("extract_bit_32_MSB1",4); - case 6: - model.sim = list("extract_bit_u32_MSB1",4); -} -} - case 4: - model.sim = list("extract_bit_32_LSB",4); - case 5: - switch (scal) { - case 0: - model.sim = list("extract_bit_32_RB0",4); - case 1: - switch (Datatype) { - case 3: - model.sim = list("extract_bit_32_RB1",4); - case 6: - model.sim = list("extract_bit_u32_RB1",4); -} -} -} - } else if ((Datatype==4||Datatype==7)) { - if (or(bit.slice()>15)||or(bit.slice()<0)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("Indexes must be in the interval %s."),"[0, 15]")); - ok = false; -} - switch (rule) { - case 1: - switch (scal) { - case 0: - model.sim = list("extract_bit_16_UH0",4); - case 1: - switch (Datatype) { - case 4: - model.sim = list("extract_bit_16_UH1",4); - case 7: - model.sim = list("extract_bit_u16_UH1",4); -} -} - case 2: - model.sim = list("extract_bit_16_LH",4); - case 3: - switch (scal) { - case 0: - model.sim = list("extract_bit_16_MSB0",4); - case 1: - switch (Datatype) { - case 4: - model.sim = list("extract_bit_16_MSB1",4); - case 7: - model.sim = list("extract_bit_u16_MSB1",4); -} -} - case 4: - model.sim = list("extract_bit_16_LSB",4); - case 5: - switch (scal) { - case 0: - model.sim = list("extract_bit_16_RB0",4); - case 1: - switch (Datatype) { - case 4: - model.sim = list("extract_bit_16_RB1",4); - case 7: - model.sim = list("extract_bit_u16_RB1",4); -} -} -} - } else if ((Datatype==5||Datatype==8)) { - if (or(bit.slice()>7)||or(bit.slice()<0)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("Indexes must be in the interval %s."),"[0, 7]")); - ok = false; -} - switch (rule) { - case 1: - switch (scal) { - case 0: - model.sim = list("extract_bit_8_UH0",4); - case 1: - switch (Datatype) { - case 5: - model.sim = list("extract_bit_8_UH1",4); - case 8: - model.sim = list("extract_bit_u8_UH1",4); -} -} - case 2: - model.sim = list("extract_bit_8_LH",4); - case 3: - switch (scal) { - case 0: - model.sim = list("extract_bit_8_MSB0",4); - case 1: - switch (Datatype) { - case 5: - model.sim = list("extract_bit_8_MSB1",4); - case 8: - model.sim = list("extract_bit_u8_MSB1",4); -} -} - case 4: - model.sim = list("extract_bit_8_LSB",4); - case 5: - switch (scal) { - case 0: - model.sim = list("extract_bit_8_RB0",4); - case 1: - switch (Datatype) { - case 5: - model.sim = list("extract_bit_8_RB1",4); - case 8: - model.sim = list("extract_bit_u8_RB1",4); -} -} -} - } else { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),Datatype),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); - ok = false; -} -} - if (ok) { - it = Datatype; - ot = Datatype; - out = [1,1]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - graphics.exprs = exprs; - model.ipar = [[int(bit.slice())],[int(numb.slice())]]; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,Datatype,rule,bit,scal,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"EXTRACTBITS")],[" "],[gettext("Bits Extraction")],[" "],[gettext(" - Bits to Extract:")],[gettext("    1 Upper Half")],[gettext("    2 Lower Half")],[gettext("    3 Range from MSB")],[gettext("    4 Range to LSB")],[gettext("    5 Range of Bits")],[gettext(" - Number of Bits or Index of bit : Index 0 is LSB")],[gettext("    If \'Bits to Extract\' is set to \'Range of bits\': [Start, End]")],[" "]],[[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)")],[gettext("Bits to extract")],[gettext("Number of Bits or Index of Bit")],[gettext("Treat Bit Field as an Integer (0:No, 1:Yes)")]],list("vec",1,"vec",1,"vec",-1,"vec",1),exprs); + if (!ok) { + break; + } + bitstr = strcat(string(bit.slice())," "); + if ((rule<1)||(rule>5)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Bits to Extract"),rule),msprintf(gettext("Must be in the interval %s."),"[1, 5]")); + ok = false; + } else if (scal<0||scal>1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Treat Bit Field as an Integer"),scal),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); + ok = false; + } else { + in1 = [model.in1,model.in2]; + bit = int(bit); + rule = int(rule); + if ((rule==3)||(rule==4)) { + if ((size(bit,"*")!=1)) { + block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),gettext("Must be a single value.")); + ok = false; + } else { + numb = bit; + } + } else if ((rule==5)) { + if ((size(bit,"*")!=2)) { + block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),gettext("Must have this form: [Start, End].")); + ok = false; + } else if (bit[1-1]>bit[2-1]) { + block_parameter_error(msprintf(gettext("Wrong values for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("\'Start\' must be less than \'End\'."))); + ok = false; + } else { + numb = bit[2-1]-bit[1-1]; + } + } else { + bit = 0; + numb = []; + } + } + if (ok) { + if ((Datatype==3||Datatype==6)) { + if (or(bit.slice()>31)||or(bit.slice()<0)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("Indexes must be in the interval %s."),"[0, 31]")); + ok = false; + } + switch (rule) { + case 1: + switch (scal) { + case 0: + model.sim = list("extract_bit_32_UH0",4); + case 1: + switch (Datatype) { + case 3: + model.sim = list("extract_bit_32_UH1",4); + case 6: + model.sim = list("extract_bit_u32_UH1",4); + } + } + case 2: + model.sim = list("extract_bit_32_LH",4); + case 3: + switch (scal) { + case 0: + model.sim = list("extract_bit_32_MSB0",4); + case 1: + switch (Datatype) { + case 3: + model.sim = list("extract_bit_32_MSB1",4); + case 6: + model.sim = list("extract_bit_u32_MSB1",4); + } + } + case 4: + model.sim = list("extract_bit_32_LSB",4); + case 5: + switch (scal) { + case 0: + model.sim = list("extract_bit_32_RB0",4); + case 1: + switch (Datatype) { + case 3: + model.sim = list("extract_bit_32_RB1",4); + case 6: + model.sim = list("extract_bit_u32_RB1",4); + } + } + } + } else if ((Datatype==4||Datatype==7)) { + if (or(bit.slice()>15)||or(bit.slice()<0)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("Indexes must be in the interval %s."),"[0, 15]")); + ok = false; + } + switch (rule) { + case 1: + switch (scal) { + case 0: + model.sim = list("extract_bit_16_UH0",4); + case 1: + switch (Datatype) { + case 4: + model.sim = list("extract_bit_16_UH1",4); + case 7: + model.sim = list("extract_bit_u16_UH1",4); + } + } + case 2: + model.sim = list("extract_bit_16_LH",4); + case 3: + switch (scal) { + case 0: + model.sim = list("extract_bit_16_MSB0",4); + case 1: + switch (Datatype) { + case 4: + model.sim = list("extract_bit_16_MSB1",4); + case 7: + model.sim = list("extract_bit_u16_MSB1",4); + } + } + case 4: + model.sim = list("extract_bit_16_LSB",4); + case 5: + switch (scal) { + case 0: + model.sim = list("extract_bit_16_RB0",4); + case 1: + switch (Datatype) { + case 4: + model.sim = list("extract_bit_16_RB1",4); + case 7: + model.sim = list("extract_bit_u16_RB1",4); + } + } + } + } else if ((Datatype==5||Datatype==8)) { + if (or(bit.slice()>7)||or(bit.slice()<0)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Number of Bits or Index of Bit"),bitstr),msprintf(gettext("Indexes must be in the interval %s."),"[0, 7]")); + ok = false; + } + switch (rule) { + case 1: + switch (scal) { + case 0: + model.sim = list("extract_bit_8_UH0",4); + case 1: + switch (Datatype) { + case 5: + model.sim = list("extract_bit_8_UH1",4); + case 8: + model.sim = list("extract_bit_u8_UH1",4); + } + } + case 2: + model.sim = list("extract_bit_8_LH",4); + case 3: + switch (scal) { + case 0: + model.sim = list("extract_bit_8_MSB0",4); + case 1: + switch (Datatype) { + case 5: + model.sim = list("extract_bit_8_MSB1",4); + case 8: + model.sim = list("extract_bit_u8_MSB1",4); + } + } + case 4: + model.sim = list("extract_bit_8_LSB",4); + case 5: + switch (scal) { + case 0: + model.sim = list("extract_bit_8_RB0",4); + case 1: + switch (Datatype) { + case 5: + model.sim = list("extract_bit_8_RB1",4); + case 8: + model.sim = list("extract_bit_u8_RB1",4); + } + } + } + } else { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),Datatype),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); + ok = false; + } + } + if (ok) { + it = Datatype; + ot = Datatype; + out = [1,1]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + graphics.exprs = exprs; + model.ipar = [[int(bit.slice())],[int(numb.slice())]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/EXTRACTBITS.pickle b/js/IntegerOp/EXTRACTBITS.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/EXTRACTBITS.pickle +++ b/js/IntegerOp/EXTRACTBITS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/IntegerOp/INTMUL.js b/js/IntegerOp/INTMUL.js index 212da42a..95065dac 100644 --- a/js/IntegerOp/INTMUL.js +++ b/js/IntegerOp/INTMUL.js @@ -16,91 +16,92 @@ function INTMUL() { model.dep_ut = [true,false]; exprs = [[sci2exp(3)],[sci2exp(0)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } INTMUL.prototype.details = function INTMUL() { + return this.x; } INTMUL.prototype.get = function INTMUL() { } INTMUL.prototype.set = function INTMUL() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,Datatype,np,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"INTMUL")],[" "],[gettext("Integer matrix multiplication")],[" "]],[[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)")],[gettext("Do on Overflow (0:Nothing, 1:Saturate, 2:Error)")]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - it = Datatype*ones(1,2); - ot = Datatype; - if ((np!=0&&np!=1&&np!=2)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Do on Overflow"),np),msprintf(gettext("Must be in the interval %s."),"[0, 2]")); - ok = false; - } else if (Datatype==3) { - if (np==0) { - model.sim = list("matmul_i32n",4); - } else if (np==1) { - model.sim = list("matmul_i32s",4); - } else { - model.sim = list("matmul_i32e",4); -} - } else if (Datatype==4) { - if (np==0) { - model.sim = list("matmul_i16n",4); - } else if (np==1) { - model.sim = list("matmul_i16s",4); - } else { - model.sim = list("matmul_i16e",4); -} - } else if (Datatype==5) { - if (np==0) { - model.sim = list("matmul_i8n",4); - } else if (np==1) { - model.sim = list("matmul_i8s",4); - } else { - model.sim = list("matmul_i8e",4); -} - } else if (Datatype==6) { - if (np==0) { - model.sim = list("matmul_ui32n",4); - } else if (np==1) { - model.sim = list("matmul_ui32s",4); - } else { - model.sim = list("matmul_ui32e",4); -} - } else if (Datatype==7) { - if (np==0) { - model.sim = list("matmul_ui16n",4); - } else if (np==1) { - model.sim = list("matmul_ui16s",4); - } else { - model.sim = list("matmul_ui16e",4); -} - } else if (Datatype==8) { - if (np==0) { - model.sim = list("matmul_ui8n",4); - } else if (np==1) { - model.sim = list("matmul_ui8s",4); - } else { - model.sim = list("matmul_ui8e",4); -} - } else { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),ot),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); - ok = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - model.ipar = np; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,Datatype,np,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"INTMUL")],[" "],[gettext("Integer matrix multiplication")],[" "]],[[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)")],[gettext("Do on Overflow (0:Nothing, 1:Saturate, 2:Error)")]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + it = Datatype*ones(1,2); + ot = Datatype; + if ((np!=0&&np!=1&&np!=2)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Do on Overflow"),np),msprintf(gettext("Must be in the interval %s."),"[0, 2]")); + ok = false; + } else if (Datatype==3) { + if (np==0) { + model.sim = list("matmul_i32n",4); + } else if (np==1) { + model.sim = list("matmul_i32s",4); + } else { + model.sim = list("matmul_i32e",4); + } + } else if (Datatype==4) { + if (np==0) { + model.sim = list("matmul_i16n",4); + } else if (np==1) { + model.sim = list("matmul_i16s",4); + } else { + model.sim = list("matmul_i16e",4); + } + } else if (Datatype==5) { + if (np==0) { + model.sim = list("matmul_i8n",4); + } else if (np==1) { + model.sim = list("matmul_i8s",4); + } else { + model.sim = list("matmul_i8e",4); + } + } else if (Datatype==6) { + if (np==0) { + model.sim = list("matmul_ui32n",4); + } else if (np==1) { + model.sim = list("matmul_ui32s",4); + } else { + model.sim = list("matmul_ui32e",4); + } + } else if (Datatype==7) { + if (np==0) { + model.sim = list("matmul_ui16n",4); + } else if (np==1) { + model.sim = list("matmul_ui16s",4); + } else { + model.sim = list("matmul_ui16e",4); + } + } else if (Datatype==8) { + if (np==0) { + model.sim = list("matmul_ui8n",4); + } else if (np==1) { + model.sim = list("matmul_ui8s",4); + } else { + model.sim = list("matmul_ui8e",4); + } + } else { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),ot),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); + ok = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + model.ipar = np; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/INTMUL.pickle b/js/IntegerOp/INTMUL.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/INTMUL.pickle +++ b/js/IntegerOp/INTMUL.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/IntegerOp/JKFLIPFLOP.js b/js/IntegerOp/JKFLIPFLOP.js index c85d2328..3ee2ab1f 100644 --- a/js/IntegerOp/JKFLIPFLOP.js +++ b/js/IntegerOp/JKFLIPFLOP.js @@ -45,49 +45,50 @@ function JKFLIPFLOP() { model.dep_ut = [true,false]; model.rpar = scs_m; gr_i = []; - x = standard_define([2,3],model,[],gr_i); + this.x = standard_define([2,3],model,[],gr_i); } JKFLIPFLOP.prototype.details = function JKFLIPFLOP() { + return this.x; } JKFLIPFLOP.prototype.get = function JKFLIPFLOP() { } JKFLIPFLOP.prototype.set = function JKFLIPFLOP() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { - path = i; -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { + path = i; + break; + } + } newpar = list(); xx = arg1.model.rpar.objs[path-1]; exprs = xx.graphics.exprs[1-1]; model = xx.model; init_old = model.odstate[1-1]; while (true) { - [ok,init,exprs0] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"JKFLIPFLOP")],[" "],[gettext("JK flip-flop")],[" "],[gettext("The \'Initial Value\' must be 0 or 1 of type int8")],[gettext(" - Negative values are considered as int8(0)")],[gettext(" - Positive values are considered as int8(1)")],[" "]],gettext("Initial Value"),list("vec",1),exprs); - if (!ok) { -break; -} - if (init<=0) { - init = int8(0); - } else if (init>0) { - init = int8(1); -} - if (ok) { - xx.graphics.exprs[1-1] = exprs0; - model.odstate[1-1] = init; - xx.model = model; - arg1.model.rpar.objs[path-1] = xx; -break; -} -} + [ok,init,exprs0] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"JKFLIPFLOP")],[" "],[gettext("JK flip-flop")],[" "],[gettext("The \'Initial Value\' must be 0 or 1 of type int8")],[gettext(" - Negative values are considered as int8(0)")],[gettext(" - Positive values are considered as int8(1)")],[" "]],gettext("Initial Value"),list("vec",1),exprs); + if (!ok) { + break; + } + if (init<=0) { + init = int8(0); + } else if (init>0) { + init = int8(1); + } + if (ok) { + xx.graphics.exprs[1-1] = exprs0; + model.odstate[1-1] = init; + xx.model = model; + arg1.model.rpar.objs[path-1] = xx; + break; + } + } needcompile = 0; if (init_old!=init) { - newpar[size(newpar)+1-1] = 1; - needcompile = 2; -} - x = arg1; + newpar[size(newpar)+1-1] = 1; + needcompile = 2; + } + this.x = arg1; y = needcompile; typ = newpar; } diff --git a/js/IntegerOp/JKFLIPFLOP.pickle b/js/IntegerOp/JKFLIPFLOP.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/JKFLIPFLOP.pickle +++ b/js/IntegerOp/JKFLIPFLOP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/IntegerOp/LOGIC.js b/js/IntegerOp/LOGIC.js index ae5dff86..d4ebdf7c 100644 --- a/js/IntegerOp/LOGIC.js +++ b/js/IntegerOp/LOGIC.js @@ -17,50 +17,51 @@ function LOGIC() { model.dep_ut = [true,false]; exprs = [[sci2exp(mat)],[sci2exp(0)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } LOGIC.prototype.details = function LOGIC() { + return this.x; } LOGIC.prototype.get = function LOGIC() { } LOGIC.prototype.set = function LOGIC() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,mat,herit,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"LOGIC")],[" "],[gettext("Combinatorial logic")],[" "],[gettext("  Rows of the matrix are the output values")],[gettext("  Number of rows must be a power of two.")],[gettext("  Number of columns gives the number of outputs.")],[" "]],[[gettext("Truth Table (matrix of outputs)")],[gettext("Accepts Inherited Events (0:No, 1:Yes)")]],list("mat",[-1,-2],"vec",1),exprs); - if (!ok) { -break; -} - nout = size(mat,2); - nin = (log(size(mat,1))/log(2)); - u1 = floor(nin); - if ((u1!=nin)) { -block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter: %d."),gettext("Truth Table"),size(mat,1)),gettext("Number of rows must be a power of two.")); - ok = false; - } else if ((find(mat.slice()!=0&&mat.slice()!=1)!=[])) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Truth Table")),msprintf(gettext("Elements must be in the interval %s."),"[0, 1]")); - ok = false; - } else if (herit<0||herit>1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Accepts Inherited Events"),herit),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); - ok = false; -} - if (ok) { - in1 = [ones(nin,1),ones(nin,1)]; - out = [ones(nout,1),ones(nout,1)]; - it = 5*ones(1,nin); - ot = 5*ones(1,nout); - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(1-herit,1),[]); -} - if (ok) { - graphics.exprs = exprs; - mat = int8(mat); - model.opar = list(mat); - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,mat,herit,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"LOGIC")],[" "],[gettext("Combinatorial logic")],[" "],[gettext("  Rows of the matrix are the output values")],[gettext("  Number of rows must be a power of two.")],[gettext("  Number of columns gives the number of outputs.")],[" "]],[[gettext("Truth Table (matrix of outputs)")],[gettext("Accepts Inherited Events (0:No, 1:Yes)")]],list("mat",[-1,-2],"vec",1),exprs); + if (!ok) { + break; + } + nout = size(mat,2); + nin = (log(size(mat,1))/log(2)); + u1 = floor(nin); + if ((u1!=nin)) { + block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter: %d."),gettext("Truth Table"),size(mat,1)),gettext("Number of rows must be a power of two.")); + ok = false; + } else if ((find(mat.slice()!=0&&mat.slice()!=1)!=[])) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Truth Table")),msprintf(gettext("Elements must be in the interval %s."),"[0, 1]")); + ok = false; + } else if (herit<0||herit>1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Accepts Inherited Events"),herit),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); + ok = false; + } + if (ok) { + in1 = [ones(nin,1),ones(nin,1)]; + out = [ones(nout,1),ones(nout,1)]; + it = 5*ones(1,nin); + ot = 5*ones(1,nout); + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(1-herit,1),[]); + } + if (ok) { + graphics.exprs = exprs; + mat = int8(mat); + model.opar = list(mat); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/LOGIC.pickle b/js/IntegerOp/LOGIC.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/LOGIC.pickle +++ b/js/IntegerOp/LOGIC.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/IntegerOp/SHIFT.js b/js/IntegerOp/SHIFT.js index 0f51c315..55af03ed 100644 --- a/js/IntegerOp/SHIFT.js +++ b/js/IntegerOp/SHIFT.js @@ -17,105 +17,106 @@ function SHIFT() { model.dep_ut = [true,false]; exprs = [[sci2exp(3)],[sci2exp(0)],[sci2exp(0)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } SHIFT.prototype.details = function SHIFT() { + return this.x; } SHIFT.prototype.get = function SHIFT() { } SHIFT.prototype.set = function SHIFT() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,Datatype,nb,np,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"SHIFT")],[" "],[gettext("Shift/Rotates bits")]],[[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)")],[gettext("Number of Bits to Shift Left (Negative number to shift right)")],[gettext("Shift Type (0:Arithmetic, 1:Circular)")]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if ((np!=0&&np!=1)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Shift Type"),np),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); - ok = false; -} - it = Datatype; - ot = Datatype; - if ((Datatype==3||Datatype==6)) { - if (nb>0) { - switch (np) { - case 0: - model.sim = list("shift_32_LA",4); - case 1: - model.sim = list("shift_32_LC",4); -} - } else if (nb<0) { - switch (np) { - case 0: - switch (Datatype) { - case 3: - model.sim = list("shift_32_RA",4); - case 6: - model.sim = list("shift_u32_RA",4); -} - case 1: - model.sim = list("shift_32_RC",4); -} -} - } else if ((Datatype==4||Datatype==7)) { - if (nb>0) { - switch (np) { - case 0: - model.sim = list("shift_16_LA",4); - case 1: - model.sim = list("shift_16_LC",4); -} - } else if (nb<0) { - switch (np) { - case 0: - switch (Datatype) { - case 4: - model.sim = list("shift_16_RA",4); - case 7: - model.sim = list("shift_u16_RA",4); -} - case 1: - model.sim = list("shift_16_RC",4); -} -} - } else if ((Datatype==5||Datatype==8)) { - if (nb>0) { - switch (np) { - case 0: - model.sim = list("shift_8_LA",4); - case 1: - model.sim = list("shift_8_LC",4); -} - } else if (nb<0) { - switch (np) { - case 0: - switch (Datatype) { - case 5: - model.sim = list("shift_8_RA",4); - case 8: - model.sim = list("shift_u8_RA",4); -} - case 1: - model.sim = list("shift_8_RC",4); -} -} - } else { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),Datatype),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); - ok = false; -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list([-1,-2],it),list([-1,-2],ot),[],[]); -} - if (ok) { - model.ipar = nb; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,Datatype,nb,np,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"SHIFT")],[" "],[gettext("Shift/Rotates bits")]],[[msprintf(gettext("Data Type %s"),"(3:int32, 4:int16, 5:int8, ...)")],[gettext("Number of Bits to Shift Left (Negative number to shift right)")],[gettext("Shift Type (0:Arithmetic, 1:Circular)")]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if ((np!=0&&np!=1)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Shift Type"),np),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); + ok = false; + } + it = Datatype; + ot = Datatype; + if ((Datatype==3||Datatype==6)) { + if (nb>0) { + switch (np) { + case 0: + model.sim = list("shift_32_LA",4); + case 1: + model.sim = list("shift_32_LC",4); + } + } else if (nb<0) { + switch (np) { + case 0: + switch (Datatype) { + case 3: + model.sim = list("shift_32_RA",4); + case 6: + model.sim = list("shift_u32_RA",4); + } + case 1: + model.sim = list("shift_32_RC",4); + } + } + } else if ((Datatype==4||Datatype==7)) { + if (nb>0) { + switch (np) { + case 0: + model.sim = list("shift_16_LA",4); + case 1: + model.sim = list("shift_16_LC",4); + } + } else if (nb<0) { + switch (np) { + case 0: + switch (Datatype) { + case 4: + model.sim = list("shift_16_RA",4); + case 7: + model.sim = list("shift_u16_RA",4); + } + case 1: + model.sim = list("shift_16_RC",4); + } + } + } else if ((Datatype==5||Datatype==8)) { + if (nb>0) { + switch (np) { + case 0: + model.sim = list("shift_8_LA",4); + case 1: + model.sim = list("shift_8_LC",4); + } + } else if (nb<0) { + switch (np) { + case 0: + switch (Datatype) { + case 5: + model.sim = list("shift_8_RA",4); + case 8: + model.sim = list("shift_u8_RA",4); + } + case 1: + model.sim = list("shift_8_RC",4); + } + } + } else { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Data Type"),Datatype),msprintf(gettext("Must be in the interval %s."),"[3, 8]")); + ok = false; + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([-1,-2],it),list([-1,-2],ot),[],[]); + } + if (ok) { + model.ipar = nb; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/IntegerOp/SHIFT.pickle b/js/IntegerOp/SHIFT.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/SHIFT.pickle +++ b/js/IntegerOp/SHIFT.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/IntegerOp/SRFLIPFLOP.js b/js/IntegerOp/SRFLIPFLOP.js index 4403dd70..d5db4b00 100644 --- a/js/IntegerOp/SRFLIPFLOP.js +++ b/js/IntegerOp/SRFLIPFLOP.js @@ -29,49 +29,50 @@ function SRFLIPFLOP() { model.dep_ut = [true,false]; model.rpar = scs_m; gr_i = []; - x = standard_define([2,3],model,[],gr_i); + this.x = standard_define([2,3],model,[],gr_i); } SRFLIPFLOP.prototype.details = function SRFLIPFLOP() { + return this.x; } SRFLIPFLOP.prototype.get = function SRFLIPFLOP() { } SRFLIPFLOP.prototype.set = function SRFLIPFLOP() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { - path = i; -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { + path = i; + break; + } + } newpar = list(); xx = arg1.model.rpar.objs[path-1]; exprs = xx.graphics.exprs[1-1]; model = xx.model; init_old = model.odstate[1-1]; while (true) { - [ok,init,exprs0] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"SRFLIPFLOP")],[" "],[gettext("SR flip-flop")],[" "],[gettext("The \'Initial Value\' must be 0 or 1 of type int8")],[gettext(" - Negative values are considered as int8(0)")],[gettext(" - Positive values are considered as int8(1)")],[" "]],gettext("Initial Value"),list("vec",1),exprs); - if (!ok) { -break; -} - if (init<=0) { - init = int8(0); - } else if (init>0) { - init = int8(1); -} - if (ok) { - xx.graphics.exprs[1-1] = exprs0; - model.odstate[1-1] = init; - xx.model = model; - arg1.model.rpar.objs[path-1] = xx; -break; -} -} + [ok,init,exprs0] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"SRFLIPFLOP")],[" "],[gettext("SR flip-flop")],[" "],[gettext("The \'Initial Value\' must be 0 or 1 of type int8")],[gettext(" - Negative values are considered as int8(0)")],[gettext(" - Positive values are considered as int8(1)")],[" "]],gettext("Initial Value"),list("vec",1),exprs); + if (!ok) { + break; + } + if (init<=0) { + init = int8(0); + } else if (init>0) { + init = int8(1); + } + if (ok) { + xx.graphics.exprs[1-1] = exprs0; + model.odstate[1-1] = init; + xx.model = model; + arg1.model.rpar.objs[path-1] = xx; + break; + } + } needcompile = 0; if (init_old!=init) { - newpar[size(newpar)+1-1] = path; - needcompile = 2; -} - x = arg1; + newpar[size(newpar)+1-1] = path; + needcompile = 2; + } + this.x = arg1; y = needcompile; typ = newpar; } diff --git a/js/IntegerOp/SRFLIPFLOP.pickle b/js/IntegerOp/SRFLIPFLOP.pickle index 154645d8..0d1dde24 100644 --- a/js/IntegerOp/SRFLIPFLOP.pickle +++ b/js/IntegerOp/SRFLIPFLOP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/BIGSOM_f.js b/js/Linear/BIGSOM_f.js index 23b27e04..4376e478 100644 --- a/js/Linear/BIGSOM_f.js +++ b/js/Linear/BIGSOM_f.js @@ -11,31 +11,32 @@ function BIGSOM_f() { model.dep_ut = [true,false]; exprs = sci2exp(sgn); gr_i = []; - x = standard_define([2,3],model,exprs,gr_i); + this.x = standard_define([2,3],model,exprs,gr_i); } BIGSOM_f.prototype.details = function BIGSOM_f() { + return this.x; } BIGSOM_f.prototype.get = function BIGSOM_f() { } BIGSOM_f.prototype.set = function BIGSOM_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,sgn,exprs] = scicos_getvalue("Set sum block parameters","Inputs ports signs/gain",list("vec",-1),exprs); - if (!ok) { -break; -} - in1 = -ones(size(sgn,"*"),1); - [model,graphics,ok] = check_io(model,graphics,in1,-1,[],[]); - if (ok) { - model.rpar = sgn.slice(); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,sgn,exprs] = scicos_getvalue("Set sum block parameters","Inputs ports signs/gain",list("vec",-1),exprs); + if (!ok) { + break; + } + in1 = -ones(size(sgn,"*"),1); + [model,graphics,ok] = check_io(model,graphics,in1,-1,[],[]); + if (ok) { + model.rpar = sgn.slice(); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Linear/BIGSOM_f.pickle b/js/Linear/BIGSOM_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/BIGSOM_f.pickle +++ b/js/Linear/BIGSOM_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/CLINDUMMY_f.js b/js/Linear/CLINDUMMY_f.js index 32a65e6b..448f7ffd 100644 --- a/js/Linear/CLINDUMMY_f.js +++ b/js/Linear/CLINDUMMY_f.js @@ -9,13 +9,14 @@ function CLINDUMMY_f() { model.firing = []; model.dep_ut = [false,true]; gr_i = []; - x = standard_define([3,2],model,[],gr_i); + this.x = standard_define([3,2],model,[],gr_i); } CLINDUMMY_f.prototype.details = function CLINDUMMY_f() { + return this.x; } CLINDUMMY_f.prototype.get = function CLINDUMMY_f() { } CLINDUMMY_f.prototype.set = function CLINDUMMY_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Linear/CLINDUMMY_f.pickle b/js/Linear/CLINDUMMY_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/CLINDUMMY_f.pickle +++ b/js/Linear/CLINDUMMY_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/CLR.js b/js/Linear/CLR.js index d6768d96..0b3439e8 100644 --- a/js/Linear/CLR.js +++ b/js/Linear/CLR.js @@ -16,14 +16,15 @@ function CLR() { model.blocktype = "c"; model.dep_ut = [false,true]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } CLR.prototype.details = function CLR() { + return this.x; } CLR.prototype.get = function CLR() { } CLR.prototype.set = function CLR() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -35,39 +36,39 @@ function CLR() { PREVAR_scicos_context = PREVAR_scicos_context; PREVAR_scicos_context.s = %s; while (true) { - [ok,num,den,exprs] = scicos_getvalue("Set continuous SISO transfer parameters",[["Numerator (s)"],["Denominator (s)"]],list("pol",1,"pol",1),exprs); - if (!ok) { -break; -} - if (degree(num)>degree(den)) { -message("Transfer function must be proper or strictly proper."); - ok = false; -} - if (ok) { - H = cont_frm(num,den); - [A,B,C,D] = H.slice(2-1,5); - graphics.exprs = exprs; - [ns1,ns1] = size(A); - rpar = [[matrix(A,ns1*ns1,1)],[matrix(B,ns1,1)],[matrix(C,ns1,1)],[D]]; - if (norm(D,1)!=0) { - mmm = [true,true]; - } else { - mmm = [false,true]; -} - if (or(model.dep_ut!=mmm)) { - model.dep_ut = mmm; -} - if (ns1<=ns) { - x0 = x0.slice(1-1,ns1); - } else { - x0[ns1-1][1-1] = 0; -} - model.state = x0; - model.rpar = rpar; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,num,den,exprs] = scicos_getvalue("Set continuous SISO transfer parameters",[["Numerator (s)"],["Denominator (s)"]],list("pol",1,"pol",1),exprs); + if (!ok) { + break; + } + if (degree(num)>degree(den)) { + message("Transfer function must be proper or strictly proper."); + ok = false; + } + if (ok) { + H = cont_frm(num,den); + [A,B,C,D] = H.slice(2-1,5); + graphics.exprs = exprs; + [ns1,ns1] = size(A); + rpar = [[matrix(A,ns1*ns1,1)],[matrix(B,ns1,1)],[matrix(C,ns1,1)],[D]]; + if (norm(D,1)!=0) { + mmm = [true,true]; + } else { + mmm = [false,true]; + } + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; + } + if (ns1<=ns) { + x0 = x0.slice(1-1,ns1); + } else { + x0[ns1-1][1-1] = 0; + } + model.state = x0; + model.rpar = rpar; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Linear/CLR.pickle b/js/Linear/CLR.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/CLR.pickle +++ b/js/Linear/CLR.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/CLR_f.js b/js/Linear/CLR_f.js index 459f975b..72bd2aaa 100644 --- a/js/Linear/CLR_f.js +++ b/js/Linear/CLR_f.js @@ -16,14 +16,15 @@ function CLR_f() { model.blocktype = "c"; model.dep_ut = [false,true]; gr_i = []; - x = standard_define([2.5,2.5],model,exprs,gr_i); + this.x = standard_define([2.5,2.5],model,exprs,gr_i); } CLR_f.prototype.details = function CLR_f() { + return this.x; } CLR_f.prototype.get = function CLR_f() { } CLR_f.prototype.set = function CLR_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -35,39 +36,39 @@ function CLR_f() { PREVAR_scicos_context = PREVAR_scicos_context; PREVAR_scicos_context.s = %s; while (true) { - [ok,num,den,exprs] = scicos_getvalue("Set continuous SISO transfer parameters",[["Numerator (s)"],["Denominator (s)"]],list("pol",1,"pol",1),exprs); - if (!ok) { -break; -} - if (degree(num)>degree(den)) { -message("Transfer must be proper or strictly proper"); - ok = false; -} - if (ok) { - H = cont_frm(num,den); - [A,B,C,D] = H.slice(2-1,5); - graphics.exprs = exprs; - [ns1,ns1] = size(A); - rpar = [[matrix(A,ns1*ns1,1)],[matrix(B,ns1,1)],[matrix(C,ns1,1)],[D]]; - if (norm(D,1)!=0) { - mmm = [true,true]; - } else { - mmm = [false,true]; -} - if (or(model.dep_ut!=mmm)) { - model.dep_ut = mmm; -} - if (ns1<=ns) { - x0 = x0.slice(1-1,ns1); - } else { - x0[ns1-1][1-1] = 0; -} - model.state = x0; - model.rpar = rpar; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,num,den,exprs] = scicos_getvalue("Set continuous SISO transfer parameters",[["Numerator (s)"],["Denominator (s)"]],list("pol",1,"pol",1),exprs); + if (!ok) { + break; + } + if (degree(num)>degree(den)) { + message("Transfer must be proper or strictly proper"); + ok = false; + } + if (ok) { + H = cont_frm(num,den); + [A,B,C,D] = H.slice(2-1,5); + graphics.exprs = exprs; + [ns1,ns1] = size(A); + rpar = [[matrix(A,ns1*ns1,1)],[matrix(B,ns1,1)],[matrix(C,ns1,1)],[D]]; + if (norm(D,1)!=0) { + mmm = [true,true]; + } else { + mmm = [false,true]; + } + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; + } + if (ns1<=ns) { + x0 = x0.slice(1-1,ns1); + } else { + x0[ns1-1][1-1] = 0; + } + model.state = x0; + model.rpar = rpar; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Linear/CLR_f.pickle b/js/Linear/CLR_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/CLR_f.pickle +++ b/js/Linear/CLR_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/CLSS.js b/js/Linear/CLSS.js index 05f1fe80..94d9bd4a 100644 --- a/js/Linear/CLSS.js +++ b/js/Linear/CLSS.js @@ -18,70 +18,71 @@ function CLSS() { model.dep_ut = [false,true]; exprs = [[strcat(sci2exp(A))],[strcat(sci2exp(B))],[strcat(sci2exp(C))],[strcat(sci2exp(D))],[strcat(sci2exp(x0))]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } CLSS.prototype.details = function CLSS() { + return this.x; } CLSS.prototype.get = function CLSS() { } CLSS.prototype.set = function CLSS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; if (size(exprs,"*")==7) { - exprs = exprs[[1:4,7]-1]; -} + exprs = exprs[[1:4,7]-1]; + } model = arg1.model; while (true) { - [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); - if (!ok) { -break; -} - out = size(C,1); - if (out==0) { - out = []; -} - in1 = size(B,2); - if (in1==0) { - in1 = []; -} - [ms,ns] = size(A); - okD = true; - if (size(D,"*")!=size(C,1)*size(B,2)) { - if (size(D,"*")==1) { - D = D*ones(C*B); - } else if (size(D,"*")==0) { - D = zeros(C*B); - } else { - okD = false; -} -} - if (ms!=ns||!okD) { -message(_("Matrix A is not square or D has wrong dimension")); - } else { - [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]); - if (ok) { - graphics.exprs = exprs; - rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; - if (D!=[]) { - if (norm(D,1)!=0) { - mmm = [true,true]; - } else { - mmm = [false,true]; -} - if (or(model.dep_ut!=mmm)) { - model.dep_ut = mmm; -} - } else { - model.dep_ut = [false,true]; -} - model.state = x0.slice(); - model.rpar = rpar; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); + if (!ok) { + break; + } + out = size(C,1); + if (out==0) { + out = []; + } + in1 = size(B,2); + if (in1==0) { + in1 = []; + } + [ms,ns] = size(A); + okD = true; + if (size(D,"*")!=size(C,1)*size(B,2)) { + if (size(D,"*")==1) { + D = D*ones(C*B); + } else if (size(D,"*")==0) { + D = zeros(C*B); + } else { + okD = false; + } + } + if (ms!=ns||!okD) { + message(_("Matrix A is not square or D has wrong dimension")); + } else { + [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]); + if (ok) { + graphics.exprs = exprs; + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + if (D!=[]) { + if (norm(D,1)!=0) { + mmm = [true,true]; + } else { + mmm = [false,true]; + } + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; + } + } else { + model.dep_ut = [false,true]; + } + model.state = x0.slice(); + model.rpar = rpar; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Linear/CLSS.pickle b/js/Linear/CLSS.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/CLSS.pickle +++ b/js/Linear/CLSS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/CLSS_f.js b/js/Linear/CLSS_f.js index 1a78799d..d4c2976a 100644 --- a/js/Linear/CLSS_f.js +++ b/js/Linear/CLSS_f.js @@ -18,60 +18,61 @@ function CLSS_f() { model.dep_ut = [false,true]; exprs = [[strcat(sci2exp(A))],[strcat(sci2exp(B))],[strcat(sci2exp(C))],[strcat(sci2exp(D))],[strcat(sci2exp(x0))]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } CLSS_f.prototype.details = function CLSS_f() { + return this.x; } CLSS_f.prototype.get = function CLSS_f() { } CLSS_f.prototype.set = function CLSS_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; if (size(exprs,"*")==7) { - exprs = exprs[[1:4,7]-1]; -} + exprs = exprs[[1:4,7]-1]; + } model = arg1.model; while (true) { - [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); - if (!ok) { -break; -} - out = size(C,1); - if (out==0) { - out = []; -} - in1 = size(B,2); - if (in1==0) { - in1 = []; -} - [ms,ns] = size(A); - if (ms!=ns) { -message("A matrix must be square"); - } else { - [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]); - if (ok) { - graphics.exprs = exprs; - rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; - if (D!=[]) { - if (norm(D,1)!=0) { - mmm = [true,true]; - } else { - mmm = [false,true]; -} - if (or(model.dep_ut!=mmm)) { - model.dep_ut = mmm; -} - } else { - model.dep_ut = [false,true]; -} - model.state = x0.slice(); - model.rpar = rpar; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); + if (!ok) { + break; + } + out = size(C,1); + if (out==0) { + out = []; + } + in1 = size(B,2); + if (in1==0) { + in1 = []; + } + [ms,ns] = size(A); + if (ms!=ns) { + message("A matrix must be square"); + } else { + [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]); + if (ok) { + graphics.exprs = exprs; + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + if (D!=[]) { + if (norm(D,1)!=0) { + mmm = [true,true]; + } else { + mmm = [false,true]; + } + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; + } + } else { + model.dep_ut = [false,true]; + } + model.state = x0.slice(); + model.rpar = rpar; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Linear/CLSS_f.pickle b/js/Linear/CLSS_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/CLSS_f.pickle +++ b/js/Linear/CLSS_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/DELAYV_f.js b/js/Linear/DELAYV_f.js index 08c96e3e..44603e1d 100644 --- a/js/Linear/DELAYV_f.js +++ b/js/Linear/DELAYV_f.js @@ -18,14 +18,15 @@ function DELAYV_f() { model.dep_ut = [true,false]; exprs = [[string(nin)],[strcat(string(z0.slice(1-1,$-1)),";")],[string(T)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } DELAYV_f.prototype.details = function DELAYV_f() { + return this.x; } DELAYV_f.prototype.get = function DELAYV_f() { } DELAYV_f.prototype.set = function DELAYV_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -34,29 +35,29 @@ function DELAYV_f() { zz0 = z0.slice(1-1,$-1); told = z0[$-1]; while (true) { - [ok,nin,zz0,T,exprs] = scicos_getvalue("Set delay parameters",[["Number of inputs"],["Register initial condition"],["Max delay"]],list("vec",1,"vec",-1,"vec",1),exprs); - if (!ok) { -break; -} - if (size(zz0,"*")<2) { -message("Register length must be at least 2"); - ok = false; -} - if (T<=0) { -message("Delay must be positive"); - ok = false; -} - if (ok) { - [model,graphics,ok] = check_io(model,graphics,[[nin],[1]],nin,1,[[1],[1]]); -} - if (ok) { - graphics.exprs = exprs; - model.dstate = [[zz0.slice()],[told]]; - model.rpar = T/(size(zz0,"*")); - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nin,zz0,T,exprs] = scicos_getvalue("Set delay parameters",[["Number of inputs"],["Register initial condition"],["Max delay"]],list("vec",1,"vec",-1,"vec",1),exprs); + if (!ok) { + break; + } + if (size(zz0,"*")<2) { + message("Register length must be at least 2"); + ok = false; + } + if (T<=0) { + message("Delay must be positive"); + ok = false; + } + if (ok) { + [model,graphics,ok] = check_io(model,graphics,[[nin],[1]],nin,1,[[1],[1]]); + } + if (ok) { + graphics.exprs = exprs; + model.dstate = [[zz0.slice()],[told]]; + model.rpar = T/(size(zz0,"*")); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Linear/DELAYV_f.pickle b/js/Linear/DELAYV_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/DELAYV_f.pickle +++ b/js/Linear/DELAYV_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/DELAY_f.js b/js/Linear/DELAY_f.js index cde21698..0a2a2f83 100644 --- a/js/Linear/DELAY_f.js +++ b/js/Linear/DELAY_f.js @@ -47,80 +47,81 @@ function DELAY_f() { diagram.objs[8-1] = split; diagram.objs[9-1] = scicos_link(xx=[[263],[263]],yy=[[271.2],[250.7]],ct=[5,-1],from=[8,1],to=[3,1]); diagram.objs[10-1] = scicos_link(xx=[[263],[308.6],[308.6],[263],[263]],yy=[[271.2],[271.2],[367],[367],[341.7]],ct=[5,-1],from=[8,2],to=[4,1]); - x = scicos_block(); - x.gui = "DELAY_f"; - x.graphics.sz = [2,2]; - x.graphics.gr_i = []; - x.graphics.pin = 0; - x.graphics.pout = 0; - x.model.sim = "csuper"; - x.model.in1 = 1; - x.model.out = 1; - x.model.blocktype = "h"; - x.model.dep_ut = [false,false]; - x.model.rpar = diagram; - x.graphics.in_implicit = ["E"]; - x.graphics.in_style = ""; - x.graphics.out_implicit = ["E"]; - x.graphics.out_style = ""; + this.x = scicos_block(); + this.x.gui = "DELAY_f"; + this.x.graphics.sz = [2,2]; + this.x.graphics.gr_i = []; + this.x.graphics.pin = 0; + this.x.graphics.pout = 0; + this.x.model.sim = "csuper"; + this.x.model.in1 = 1; + this.x.model.out = 1; + this.x.model.blocktype = "h"; + this.x.model.dep_ut = [false,false]; + this.x.model.rpar = diagram; + this.x.graphics.in_implicit = ["E"]; + this.x.graphics.in_style = ""; + this.x.graphics.out_implicit = ["E"]; + this.x.graphics.out_style = ""; } DELAY_f.prototype.details = function DELAY_f() { + return this.x; } DELAY_f.prototype.get = function DELAY_f() { } DELAY_f.prototype.set = function DELAY_f() { ppath = list(0,0); -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="REGISTER_f") { - ppath[1-1] = i; -} - if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") { - ppath[2-1] = i; -} - if (and(ppath!=list(0,0))) { -break; -} -} - x = arg1; + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="REGISTER_f") { + ppath[1-1] = i; + } + if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") { + ppath[2-1] = i; + } + if (and(ppath!=list(0,0))) { + break; + } + } + this.x = arg1; newpar = list(); - register = x.model.rpar.objs[ppath[1-1]-1]; - evtdly = x.model.rpar.objs[ppath[2-1]-1]; + register = this.x.model.rpar.objs[ppath[1-1]-1]; + evtdly = this.x.model.rpar.objs[ppath[2-1]-1]; register_exprs = register.graphics.exprs; evtdly_exprs = evtdly.graphics.exprs; exprs = [[evtdly_exprs[1-1]],[register_exprs]]; while (true) { - [ok,dt,z0,exprs] = scicos_getvalue([["This block implements as a discretized delay"],["it is consist of a shift register and a clock"],["value of the delay is given by;","the discretization time step multiplied by the"],["number-1 of state of the register"]],[["Discretization time step"],["Register initial state"]],list("vec",1,"vec",-1),exprs); - if (!ok) { -break; -} - mess = []; - if (prod(size(z0))<1) { - mess = [[mess],["Register length must be at least 1"],[" "]]; - ok = false; -} - if (dt<=0) { - mess = [[mess],["Discretization time step must be positive"],[" "]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - evtdly.graphics.exprs[1-1] = exprs[1-1]; - if (evtdly.model.rpar!=dt) { - evtdly.model.rpar = dt; - newpar[$+1-1] = ppath[2-1]; -} - x.model.rpar.objs[ppath[2-1]-1] = evtdly; - register.graphics.exprs = exprs[2-1]; - if (or(register.model.dstate!=z0.slice())) { - register.model.dstate = z0.slice(); - newpar[$+1-1] = ppath[1-1]; -} - x.model.rpar.objs[ppath[1-1]-1] = register; -break; -} -} + [ok,dt,z0,exprs] = scicos_getvalue([["This block implements as a discretized delay"],["it is consist of a shift register and a clock"],["value of the delay is given by;","the discretization time step multiplied by the"],["number-1 of state of the register"]],[["Discretization time step"],["Register initial state"]],list("vec",1,"vec",-1),exprs); + if (!ok) { + break; + } + mess = []; + if (prod(size(z0))<1) { + mess = [[mess],["Register length must be at least 1"],[" "]]; + ok = false; + } + if (dt<=0) { + mess = [[mess],["Discretization time step must be positive"],[" "]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + evtdly.graphics.exprs[1-1] = exprs[1-1]; + if (evtdly.model.rpar!=dt) { + evtdly.model.rpar = dt; + newpar[$+1-1] = ppath[2-1]; + } + this.x.model.rpar.objs[ppath[2-1]-1] = evtdly; + register.graphics.exprs = exprs[2-1]; + if (or(register.model.dstate!=z0.slice())) { + register.model.dstate = z0.slice(); + newpar[$+1-1] = ppath[1-1]; + } + this.x.model.rpar.objs[ppath[1-1]-1] = register; + break; + } + } needcompile = 0; y = needcompile; typ = newpar; diff --git a/js/Linear/DELAY_f.pickle b/js/Linear/DELAY_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/DELAY_f.pickle +++ b/js/Linear/DELAY_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/DERIV.js b/js/Linear/DERIV.js index a3b0b8dc..d8b77628 100644 --- a/js/Linear/DERIV.js +++ b/js/Linear/DERIV.js @@ -9,13 +9,14 @@ function DERIV() { model.dep_ut = [true,false]; exprs = []; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } DERIV.prototype.details = function DERIV() { + return this.x; } DERIV.prototype.get = function DERIV() { } DERIV.prototype.set = function DERIV() { - x = arg1; + this.x = arg1; } } diff --git a/js/Linear/DERIV.pickle b/js/Linear/DERIV.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/DERIV.pickle +++ b/js/Linear/DERIV.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/DIFF_c.js b/js/Linear/DIFF_c.js index 5d953122..191e9282 100644 --- a/js/Linear/DIFF_c.js +++ b/js/Linear/DIFF_c.js @@ -11,45 +11,46 @@ function DIFF_c() { model.dep_ut = [false,true]; exprs = [[strcat(sci2exp(x0[1-1]))],[strcat(sci2exp(x0[2-1]))]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } DIFF_c.prototype.details = function DIFF_c() { + return this.x; } DIFF_c.prototype.get = function DIFF_c() { } DIFF_c.prototype.set = function DIFF_c() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - ask_again = false; - [ok,x0,xd0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["Initial state"],["Initial Derivative"]],list("vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - x0 = x0.slice(); - N = size(x0,"*"); - xd0 = xd0.slice(); - Nxd = size(xd0,"*"); - if ((N!=Nxd)) { -message("Incompatible sizes: states and their derivatives should have the same size "); - ask_again = true; -} - if ((N<=0&&!ask_again)) { -x_message("number of states must be > 0 "); - ask_again = true; -} - if (!ask_again) { - graphics.exprs = exprs; - model.state = [[x0],[xd0]]; - model.out = [N]; - model.in1 = N; - x.graphics = graphics; - x.model = model; -break; -} -} - x.model.firing = []; + ask_again = false; + [ok,x0,xd0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["Initial state"],["Initial Derivative"]],list("vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + x0 = x0.slice(); + N = size(x0,"*"); + xd0 = xd0.slice(); + Nxd = size(xd0,"*"); + if ((N!=Nxd)) { + message("Incompatible sizes: states and their derivatives should have the same size "); + ask_again = true; + } + if ((N<=0&&!ask_again)) { + x_message("number of states must be > 0 "); + ask_again = true; + } + if (!ask_again) { + graphics.exprs = exprs; + model.state = [[x0],[xd0]]; + model.out = [N]; + model.in1 = N; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + this.x.model.firing = []; } } diff --git a/js/Linear/DIFF_c.pickle b/js/Linear/DIFF_c.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/DIFF_c.pickle +++ b/js/Linear/DIFF_c.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/DLR.js b/js/Linear/DLR.js index c39494a5..39d11022 100644 --- a/js/Linear/DLR.js +++ b/js/Linear/DLR.js @@ -17,14 +17,15 @@ function DLR() { model.blocktype = "d"; model.dep_ut = [false,false]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } DLR.prototype.details = function DLR() { + return this.x; } DLR.prototype.get = function DLR() { } DLR.prototype.set = function DLR() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -33,40 +34,40 @@ function DLR() { PREVAR_scicos_context = PREVAR_scicos_context; PREVAR_scicos_context.z = %z; while (true) { - [ok,num,den,exprs] = scicos_getvalue("Set discrete SISO transfer parameters",[["Numerator (z)"],["Denominator (z)"]],list("pol",1,"pol",1),exprs); - if (!ok) { -break; -} - if (degree(num)>degree(den)) { -message("Transfer function must be proper"); - ok = false; -} - if (ok) { - H = cont_frm(num,den); - [A,B,C,D] = H.slice(2-1,5); - graphics.exprs = exprs; - [ns1,ns1] = size(A); - if (ns1<=ns) { - x0 = x0.slice(1-1,ns1); - } else { - x0[ns1-1][1-1] = 0; -} - rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; - model.dstate = x0; - model.rpar = rpar; - if (norm(D,1)!=0) { - mmm = [true,false]; - } else { - mmm = [false,false]; -} - if (or(model.dep_ut!=mmm)) { - model.dep_ut = mmm; -} - x.graphics = graphics; - x.model = model; -break; -} -} - x.model.firing = []; + [ok,num,den,exprs] = scicos_getvalue("Set discrete SISO transfer parameters",[["Numerator (z)"],["Denominator (z)"]],list("pol",1,"pol",1),exprs); + if (!ok) { + break; + } + if (degree(num)>degree(den)) { + message("Transfer function must be proper"); + ok = false; + } + if (ok) { + H = cont_frm(num,den); + [A,B,C,D] = H.slice(2-1,5); + graphics.exprs = exprs; + [ns1,ns1] = size(A); + if (ns1<=ns) { + x0 = x0.slice(1-1,ns1); + } else { + x0[ns1-1][1-1] = 0; + } + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + model.dstate = x0; + model.rpar = rpar; + if (norm(D,1)!=0) { + mmm = [true,false]; + } else { + mmm = [false,false]; + } + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; + } + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + this.x.model.firing = []; } } diff --git a/js/Linear/DLR.pickle b/js/Linear/DLR.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/DLR.pickle +++ b/js/Linear/DLR.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/DLR_f.js b/js/Linear/DLR_f.js index fe84fec7..0bc0dc73 100644 --- a/js/Linear/DLR_f.js +++ b/js/Linear/DLR_f.js @@ -17,14 +17,15 @@ function DLR_f() { model.blocktype = "d"; model.dep_ut = [false,false]; gr_i = []; - x = standard_define([2.5,2.5],model,exprs,gr_i); + this.x = standard_define([2.5,2.5],model,exprs,gr_i); } DLR_f.prototype.details = function DLR_f() { + return this.x; } DLR_f.prototype.get = function DLR_f() { } DLR_f.prototype.set = function DLR_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -33,40 +34,40 @@ function DLR_f() { PREVAR_scicos_context = PREVAR_scicos_context; PREVAR_scicos_context.z = %z; while (true) { - [ok,num,den,exprs] = scicos_getvalue("Set discrete SISO transfer parameters",[["Numerator (z)"],["Denominator (z)"]],list("pol",1,"pol",1),exprs); - if (!ok) { -break; -} - if (degree(num)>degree(den)) { -message("Transfer must be proper"); - ok = false; -} - if (ok) { - H = cont_frm(num,den); - [A,B,C,D] = H.slice(2-1,5); - graphics.exprs = exprs; - [ns1,ns1] = size(A); - if (ns1<=ns) { - x0 = x0.slice(1-1,ns1); - } else { - x0[ns1-1][1-1] = 0; -} - rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; - model.dstate = x0; - model.rpar = rpar; - if (norm(D,1)!=0) { - mmm = [true,false]; - } else { - mmm = [false,false]; -} - if (or(model.dep_ut!=mmm)) { - model.dep_ut = mmm; -} - x.graphics = graphics; - x.model = model; -break; -} -} - x.model.firing = []; + [ok,num,den,exprs] = scicos_getvalue("Set discrete SISO transfer parameters",[["Numerator (z)"],["Denominator (z)"]],list("pol",1,"pol",1),exprs); + if (!ok) { + break; + } + if (degree(num)>degree(den)) { + message("Transfer must be proper"); + ok = false; + } + if (ok) { + H = cont_frm(num,den); + [A,B,C,D] = H.slice(2-1,5); + graphics.exprs = exprs; + [ns1,ns1] = size(A); + if (ns1<=ns) { + x0 = x0.slice(1-1,ns1); + } else { + x0[ns1-1][1-1] = 0; + } + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + model.dstate = x0; + model.rpar = rpar; + if (norm(D,1)!=0) { + mmm = [true,false]; + } else { + mmm = [false,false]; + } + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; + } + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + this.x.model.firing = []; } } diff --git a/js/Linear/DLR_f.pickle b/js/Linear/DLR_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/DLR_f.pickle +++ b/js/Linear/DLR_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/DLSS.js b/js/Linear/DLSS.js index 869a9b3e..56fa6f74 100644 --- a/js/Linear/DLSS.js +++ b/js/Linear/DLSS.js @@ -17,70 +17,71 @@ function DLSS() { model.dep_ut = [false,false]; exprs = [[strcat(sci2exp(A))],[strcat(sci2exp(B))],[strcat(sci2exp(C))],[strcat(sci2exp(D))],[strcat(sci2exp(x0))]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } DLSS.prototype.details = function DLSS() { + return this.x; } DLSS.prototype.get = function DLSS() { } DLSS.prototype.set = function DLSS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; if (size(exprs,"*")==7) { - exprs = exprs[[1:4,7]-1]; -} + exprs = exprs[[1:4,7]-1]; + } model = arg1.model; while (true) { - [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set discrete linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); - if (!ok) { -break; -} - out = size(C,1); - if (out==0) { - out = []; -} - in1 = size(B,2); - if (in1==0) { - in1 = []; -} - [ms,ns] = size(A); - okD = true; - if (size(D,"*")!=size(C,1)*size(B,2)) { - if (size(D,"*")==1) { - D = D*ones(C*B); - } else if (size(D,"*")==0) { - D = zeros(C*B); - } else { - okD = false; -} -} - if (ms!=ns||!okD) { -message(_("Matrix A is not square or D has wrong dimension")); - } else { - [model,graphics,ok] = check_io(model,graphics,in1,out,1,[]); - if (ok) { - graphics.exprs = exprs; - rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; - if (D!=[]) { - if (norm(D,1)!=0) { - mmm = [true,false]; - } else { - mmm = [false,false]; -} - if (or(model.dep_ut!=mmm)) { - model.dep_ut = mmm; -} - } else { - model.dep_ut = [false,false]; -} - model.dstate = x0.slice(); - model.rpar = rpar; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set discrete linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); + if (!ok) { + break; + } + out = size(C,1); + if (out==0) { + out = []; + } + in1 = size(B,2); + if (in1==0) { + in1 = []; + } + [ms,ns] = size(A); + okD = true; + if (size(D,"*")!=size(C,1)*size(B,2)) { + if (size(D,"*")==1) { + D = D*ones(C*B); + } else if (size(D,"*")==0) { + D = zeros(C*B); + } else { + okD = false; + } + } + if (ms!=ns||!okD) { + message(_("Matrix A is not square or D has wrong dimension")); + } else { + [model,graphics,ok] = check_io(model,graphics,in1,out,1,[]); + if (ok) { + graphics.exprs = exprs; + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + if (D!=[]) { + if (norm(D,1)!=0) { + mmm = [true,false]; + } else { + mmm = [false,false]; + } + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; + } + } else { + model.dep_ut = [false,false]; + } + model.dstate = x0.slice(); + model.rpar = rpar; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Linear/DLSS.pickle b/js/Linear/DLSS.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/DLSS.pickle +++ b/js/Linear/DLSS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/DLSS_f.js b/js/Linear/DLSS_f.js index 1a2fb656..c444ce87 100644 --- a/js/Linear/DLSS_f.js +++ b/js/Linear/DLSS_f.js @@ -17,60 +17,61 @@ function DLSS_f() { model.dep_ut = [false,false]; exprs = [[strcat(sci2exp(A))],[strcat(sci2exp(B))],[strcat(sci2exp(C))],[strcat(sci2exp(D))],[strcat(sci2exp(x0))]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } DLSS_f.prototype.details = function DLSS_f() { + return this.x; } DLSS_f.prototype.get = function DLSS_f() { } DLSS_f.prototype.set = function DLSS_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; if (size(exprs,"*")==7) { - exprs = exprs[[1:4,7]-1]; -} + exprs = exprs[[1:4,7]-1]; + } model = arg1.model; while (true) { - [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set discrete linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); - if (!ok) { -break; -} - out = size(C,1); - if (out==0) { - out = []; -} - in1 = size(B,2); - if (in1==0) { - in1 = []; -} - [ms,ns] = size(A); - if (ms!=ns) { -message("A matrix must be square"); - } else { - [model,graphics,ok] = check_io(model,graphics,in1,out,1,[]); - if (ok) { - graphics.exprs = exprs; - rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; - if (D!=[]) { - if (norm(D,1)!=0) { - mmm = [true,false]; - } else { - mmm = [false,false]; -} - if (or(model.dep_ut!=mmm)) { - model.dep_ut = mmm; -} - } else { - model.dep_ut = [false,false]; -} - model.dstate = x0.slice(); - model.rpar = rpar; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set discrete linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); + if (!ok) { + break; + } + out = size(C,1); + if (out==0) { + out = []; + } + in1 = size(B,2); + if (in1==0) { + in1 = []; + } + [ms,ns] = size(A); + if (ms!=ns) { + message("A matrix must be square"); + } else { + [model,graphics,ok] = check_io(model,graphics,in1,out,1,[]); + if (ok) { + graphics.exprs = exprs; + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + if (D!=[]) { + if (norm(D,1)!=0) { + mmm = [true,false]; + } else { + mmm = [false,false]; + } + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; + } + } else { + model.dep_ut = [false,false]; + } + model.dstate = x0.slice(); + model.rpar = rpar; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Linear/DLSS_f.pickle b/js/Linear/DLSS_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/DLSS_f.pickle +++ b/js/Linear/DLSS_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/DOLLAR.js b/js/Linear/DOLLAR.js index 5b736b28..b4413a70 100644 --- a/js/Linear/DOLLAR.js +++ b/js/Linear/DOLLAR.js @@ -14,77 +14,78 @@ function DOLLAR() { model.blocktype = "d"; model.dep_ut = [false,false]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } DOLLAR.prototype.details = function DOLLAR() { + return this.x; } DOLLAR.prototype.get = function DOLLAR() { } DOLLAR.prototype.set = function DOLLAR() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")<2) { - exprs[2-1] = "0"; -} + exprs[2-1] = "0"; + } while (true) { - [ok,a,inh,exprs] = scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("mat",[-1,-2],"vec",-1),exprs); - if (!ok) { -break; -} - out = [size(a,1),size(a,2)]; - if (out==0) { - out = []; -} - in1 = out; - model.sim = list("dollar4_m",4); - model.odstate = list(a); - model.dstate = []; - if (this.type[(a)==1-1]) { - if (isreal(a)) { - it = 1; - ot = 1; - if ((size(a,1)==1||size(a,2)==1)) { - model.sim = list("dollar4",4); - model.dstate = a.slice(); - model.odstate = list(); -} - } else { - it = 2; - ot = 2; -} - } else if ((typeof(a)=="int32")) { - it = 3; - ot = 3; - } else if ((typeof(a)=="int16")) { - it = 4; - ot = 4; - } else if ((typeof(a)=="int8")) { - it = 5; - ot = 5; - } else if ((typeof(a)=="uint32")) { - it = 6; - ot = 6; - } else if ((typeof(a)=="uint16")) { - it = 7; - ot = 7; - } else if ((typeof(a)=="uint8")) { - it = 8; - ot = 8; - } else { -message("type is not recognized"); - ok = false; -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]); -} - if (ok) { - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,a,inh,exprs] = scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("mat",[-1,-2],"vec",-1),exprs); + if (!ok) { + break; + } + out = [size(a,1),size(a,2)]; + if (out==0) { + out = []; + } + in1 = out; + model.sim = list("dollar4_m",4); + model.odstate = list(a); + model.dstate = []; + if (this.type[(a)==1-1]) { + if (isreal(a)) { + it = 1; + ot = 1; + if ((size(a,1)==1||size(a,2)==1)) { + model.sim = list("dollar4",4); + model.dstate = a.slice(); + model.odstate = list(); + } + } else { + it = 2; + ot = 2; + } + } else if ((typeof(a)=="int32")) { + it = 3; + ot = 3; + } else if ((typeof(a)=="int16")) { + it = 4; + ot = 4; + } else if ((typeof(a)=="int8")) { + it = 5; + ot = 5; + } else if ((typeof(a)=="uint32")) { + it = 6; + ot = 6; + } else if ((typeof(a)=="uint16")) { + it = 7; + ot = 7; + } else if ((typeof(a)=="uint8")) { + it = 8; + ot = 8; + } else { + message("type is not recognized"); + ok = false; + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]); + } + if (ok) { + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Linear/DOLLAR.pickle b/js/Linear/DOLLAR.pickle index 0ac03d7f..54a16ece 100644 --- a/js/Linear/DOLLAR.pickle +++ b/js/Linear/DOLLAR.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'type' +S'x' p2 -atp3 -Rp4 +aS'type' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Linear/DOLLAR_f.js b/js/Linear/DOLLAR_f.js index b5f1be1a..fb853821 100644 --- a/js/Linear/DOLLAR_f.js +++ b/js/Linear/DOLLAR_f.js @@ -14,42 +14,43 @@ function DOLLAR_f() { model.blocktype = "d"; model.dep_ut = [false,false]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } DOLLAR_f.prototype.details = function DOLLAR_f() { + return this.x; } DOLLAR_f.prototype.get = function DOLLAR_f() { } DOLLAR_f.prototype.set = function DOLLAR_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")<2) { - exprs[2-1] = "0"; -} + exprs[2-1] = "0"; + } while (true) { - [ok,a,inh,exprs] = scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - out = size(a,"*"); - if (out==0) { - out = []; -} - in1 = out; - if (ok) { - [model,graphics,ok] = check_io(model,graphics,-1,-1,ones(1-inh,1),[]); -} - if (ok) { - graphics.exprs = exprs; - model.dstate = a; - model.in1 = in1; - model.out = out; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,a,inh,exprs] = scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + out = size(a,"*"); + if (out==0) { + out = []; + } + in1 = out; + if (ok) { + [model,graphics,ok] = check_io(model,graphics,-1,-1,ones(1-inh,1),[]); + } + if (ok) { + graphics.exprs = exprs; + model.dstate = a; + model.in1 = in1; + model.out = out; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Linear/DOLLAR_f.pickle b/js/Linear/DOLLAR_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/DOLLAR_f.pickle +++ b/js/Linear/DOLLAR_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/DOLLAR_m.js b/js/Linear/DOLLAR_m.js index 8fa53e30..4cd2dfdf 100644 --- a/js/Linear/DOLLAR_m.js +++ b/js/Linear/DOLLAR_m.js @@ -14,77 +14,78 @@ function DOLLAR_m() { model.blocktype = "d"; model.dep_ut = [false,false]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } DOLLAR_m.prototype.details = function DOLLAR_m() { + return this.x; } DOLLAR_m.prototype.get = function DOLLAR_m() { } DOLLAR_m.prototype.set = function DOLLAR_m() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")<2) { - exprs[2-1] = "0"; -} + exprs[2-1] = "0"; + } while (true) { - [ok,a,inh,exprs] = scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("mat",[-1,-2],"vec",-1),exprs); - if (!ok) { -break; -} - out = [size(a,1),size(a,2)]; - if (out==0) { - out = []; -} - in1 = out; - model.sim = list("dollar4_m",4); - model.odstate = list(a); - model.dstate = []; - if ((this.type[a-1]==1)) { - if (isreal(a)) { - it = 1; - ot = 1; - if ((size(a,1)==1||size(a,2)==1)) { - model.sim = list("dollar4",4); - model.dstate = a.slice(); - model.odstate = list(); -} - } else { - it = 2; - ot = 2; -} - } else if ((typeof(a)=="int32")) { - it = 3; - ot = 3; - } else if ((typeof(a)=="int16")) { - it = 4; - ot = 4; - } else if ((typeof(a)=="int8")) { - it = 5; - ot = 5; - } else if ((typeof(a)=="uint32")) { - it = 6; - ot = 6; - } else if ((typeof(a)=="uint16")) { - it = 7; - ot = 7; - } else if ((typeof(a)=="uint8")) { - it = 8; - ot = 8; - } else { -message("type is not recognized"); - ok = false; -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]); -} - if (ok) { - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,a,inh,exprs] = scicos_getvalue("Set 1/z block parameters",[["initial condition"],["Inherit (no:0, yes:1)"]],list("mat",[-1,-2],"vec",-1),exprs); + if (!ok) { + break; + } + out = [size(a,1),size(a,2)]; + if (out==0) { + out = []; + } + in1 = out; + model.sim = list("dollar4_m",4); + model.odstate = list(a); + model.dstate = []; + if ((this.type[a-1]==1)) { + if (isreal(a)) { + it = 1; + ot = 1; + if ((size(a,1)==1||size(a,2)==1)) { + model.sim = list("dollar4",4); + model.dstate = a.slice(); + model.odstate = list(); + } + } else { + it = 2; + ot = 2; + } + } else if ((typeof(a)=="int32")) { + it = 3; + ot = 3; + } else if ((typeof(a)=="int16")) { + it = 4; + ot = 4; + } else if ((typeof(a)=="int8")) { + it = 5; + ot = 5; + } else if ((typeof(a)=="uint32")) { + it = 6; + ot = 6; + } else if ((typeof(a)=="uint16")) { + it = 7; + ot = 7; + } else if ((typeof(a)=="uint8")) { + it = 8; + ot = 8; + } else { + message("type is not recognized"); + ok = false; + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]); + } + if (ok) { + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Linear/DOLLAR_m.pickle b/js/Linear/DOLLAR_m.pickle index 0ac03d7f..54a16ece 100644 --- a/js/Linear/DOLLAR_m.pickle +++ b/js/Linear/DOLLAR_m.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'type' +S'x' p2 -atp3 -Rp4 +aS'type' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Linear/GAINBLK.js b/js/Linear/GAINBLK.js index b907fe60..edab742b 100644 --- a/js/Linear/GAINBLK.js +++ b/js/Linear/GAINBLK.js @@ -17,131 +17,132 @@ function GAINBLK() { model.dep_ut = [true,false]; exprs = [strcat(sci2exp(gain))]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } GAINBLK.prototype.details = function GAINBLK() { + return this.x; } GAINBLK.prototype.get = function GAINBLK() { } GAINBLK.prototype.set = function GAINBLK() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==1) { - exprs = [[exprs],[sci2exp(0)]]; -} + exprs = [[exprs],[sci2exp(0)]]; + } while (true) { - [ok,gain,over,exprs] = scicos_getvalue("Set gain block parameters",[["Gain"],["Do On Overflow(0=Nothing 1=Saturate 2=Error)"]],list("mat",[-1,-1],"vec",1),exprs); - if (!ok) { -break; -} - if (gain==[]) { -message("Gain must have at least one element"); - } else { - if (typeof(gain)=="constant") { - if (isreal(gain)) { - it = 1; - ot = 1; - model.sim = list("gainblk",4); - model.rpar = gain.slice(); - model.opar = list(); - } else { -message("type is not supported"); - ok = false; -} - } else { - if ((over==0)) { - if ((typeof(gain)=="int32")) { - ot = 3; - model.sim = list("gainblk_i32n",4); - } else if ((typeof(gain)=="int16")) { - ot = 4; - model.sim = list("gainblk_i16n",4); - } else if ((typeof(gain)=="int8")) { - ot = 5; - model.sim = list("gainblk_i8n",4); - } else if ((typeof(gain)=="uint32")) { - ot = 6; - model.sim = list("gainblk_ui32n",4); - } else if ((typeof(gain)=="uint16")) { - ot = 7; - model.sim = list("gainblk_ui16n",4); - } else if ((typeof(gain)=="uint8")) { - ot = 8; - model.sim = list("gainblk_ui8n",4); - } else { -message("type is not supported."); - ok = false; -} - } else if ((over==1)) { - if ((typeof(gain)=="int32")) { - ot = 3; - model.sim = list("gainblk_i32s",4); - } else if ((typeof(gain)=="int16")) { - ot = 4; - model.sim = list("gainblk_i16s",4); - } else if ((typeof(gain)=="int8")) { - ot = 5; - model.sim = list("gainblk_i8s",4); - } else if ((typeof(gain)=="uint32")) { - ot = 6; - model.sim = list("gainblk_ui32s",4); - } else if ((typeof(gain)=="uint16")) { - ot = 7; - model.sim = list("gainblk_ui16s",4); - } else if ((typeof(gain)=="uint8")) { - ot = 8; - model.sim = list("gainblk_ui8s",4); - } else { -message("type is not supported."); - ok = false; -} - } else if ((over==2)) { - if ((typeof(gain)=="int32")) { - ot = 3; - model.sim = list("gainblk_i32e",4); - } else if ((typeof(gain)=="int16")) { - ot = 4; - model.sim = list("gainblk_i16e",4); - } else if ((typeof(gain)=="int8")) { - ot = 5; - model.sim = list("gainblk_i8e",4); - } else if ((typeof(gain)=="uint32")) { - ot = 6; - model.sim = list("gainblk_ui32e",4); - } else if ((typeof(gain)=="uint16")) { - ot = 7; - model.sim = list("gainblk_ui16e",4); - } else if ((typeof(gain)=="uint8")) { - ot = 8; - model.sim = list("gainblk_ui8e",4); - } else { -message("type is not an integer."); - ok = false; -} - } else { -message("Do on Overflow must be 0,1,2"); - ok = false; -} - model.rpar = []; - model.opar = list(gain.slice()); -} - if (ok) { - [out,in1] = size(gain); - if (out*in1!=1) { - [model,graphics,ok] = set_io(model,graphics,list([in1,-1],ot),list([out,-1],ot),[],[]); - } else { - [model,graphics,ok] = set_io(model,graphics,list([-1,-2],ot),list([-1,-2],ot),[],[]); -} -} - if (ok) { - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,gain,over,exprs] = scicos_getvalue("Set gain block parameters",[["Gain"],["Do On Overflow(0=Nothing 1=Saturate 2=Error)"]],list("mat",[-1,-1],"vec",1),exprs); + if (!ok) { + break; + } + if (gain==[]) { + message("Gain must have at least one element"); + } else { + if (typeof(gain)=="constant") { + if (isreal(gain)) { + it = 1; + ot = 1; + model.sim = list("gainblk",4); + model.rpar = gain.slice(); + model.opar = list(); + } else { + message("type is not supported"); + ok = false; + } + } else { + if ((over==0)) { + if ((typeof(gain)=="int32")) { + ot = 3; + model.sim = list("gainblk_i32n",4); + } else if ((typeof(gain)=="int16")) { + ot = 4; + model.sim = list("gainblk_i16n",4); + } else if ((typeof(gain)=="int8")) { + ot = 5; + model.sim = list("gainblk_i8n",4); + } else if ((typeof(gain)=="uint32")) { + ot = 6; + model.sim = list("gainblk_ui32n",4); + } else if ((typeof(gain)=="uint16")) { + ot = 7; + model.sim = list("gainblk_ui16n",4); + } else if ((typeof(gain)=="uint8")) { + ot = 8; + model.sim = list("gainblk_ui8n",4); + } else { + message("type is not supported."); + ok = false; + } + } else if ((over==1)) { + if ((typeof(gain)=="int32")) { + ot = 3; + model.sim = list("gainblk_i32s",4); + } else if ((typeof(gain)=="int16")) { + ot = 4; + model.sim = list("gainblk_i16s",4); + } else if ((typeof(gain)=="int8")) { + ot = 5; + model.sim = list("gainblk_i8s",4); + } else if ((typeof(gain)=="uint32")) { + ot = 6; + model.sim = list("gainblk_ui32s",4); + } else if ((typeof(gain)=="uint16")) { + ot = 7; + model.sim = list("gainblk_ui16s",4); + } else if ((typeof(gain)=="uint8")) { + ot = 8; + model.sim = list("gainblk_ui8s",4); + } else { + message("type is not supported."); + ok = false; + } + } else if ((over==2)) { + if ((typeof(gain)=="int32")) { + ot = 3; + model.sim = list("gainblk_i32e",4); + } else if ((typeof(gain)=="int16")) { + ot = 4; + model.sim = list("gainblk_i16e",4); + } else if ((typeof(gain)=="int8")) { + ot = 5; + model.sim = list("gainblk_i8e",4); + } else if ((typeof(gain)=="uint32")) { + ot = 6; + model.sim = list("gainblk_ui32e",4); + } else if ((typeof(gain)=="uint16")) { + ot = 7; + model.sim = list("gainblk_ui16e",4); + } else if ((typeof(gain)=="uint8")) { + ot = 8; + model.sim = list("gainblk_ui8e",4); + } else { + message("type is not an integer."); + ok = false; + } + } else { + message("Do on Overflow must be 0,1,2"); + ok = false; + } + model.rpar = []; + model.opar = list(gain.slice()); + } + if (ok) { + [out,in1] = size(gain); + if (out*in1!=1) { + [model,graphics,ok] = set_io(model,graphics,list([in1,-1],ot),list([out,-1],ot),[],[]); + } else { + [model,graphics,ok] = set_io(model,graphics,list([-1,-2],ot),list([-1,-2],ot),[],[]); + } + } + if (ok) { + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Linear/GAINBLK.pickle b/js/Linear/GAINBLK.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/GAINBLK.pickle +++ b/js/Linear/GAINBLK.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/GAINBLK_f.js b/js/Linear/GAINBLK_f.js index b2efa274..7c574416 100644 --- a/js/Linear/GAINBLK_f.js +++ b/js/Linear/GAINBLK_f.js @@ -13,35 +13,36 @@ function GAINBLK_f() { model.dep_ut = [true,false]; exprs = [strcat(sci2exp(gain))]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } GAINBLK_f.prototype.details = function GAINBLK_f() { + return this.x; } GAINBLK_f.prototype.get = function GAINBLK_f() { } GAINBLK_f.prototype.set = function GAINBLK_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,gain,exprs] = scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]); - if (!ok) { -break; -} - if (gain==[]) { -message("Gain must have at least one element"); - } else { - [out,in1] = size(gain); - [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]); - if (ok) { - graphics.exprs = exprs; - model.rpar = gain.slice(); - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,gain,exprs] = scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]); + if (!ok) { + break; + } + if (gain==[]) { + message("Gain must have at least one element"); + } else { + [out,in1] = size(gain); + [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]); + if (ok) { + graphics.exprs = exprs; + model.rpar = gain.slice(); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Linear/GAINBLK_f.pickle b/js/Linear/GAINBLK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/GAINBLK_f.pickle +++ b/js/Linear/GAINBLK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/GAIN_f.js b/js/Linear/GAIN_f.js index 836dee96..4af1dce9 100644 --- a/js/Linear/GAIN_f.js +++ b/js/Linear/GAIN_f.js @@ -13,35 +13,36 @@ function GAIN_f() { model.dep_ut = [true,false]; exprs = [[strcat(sci2exp(gain))],[strcat(sci2exp(in1))],[strcat(sci2exp(out))]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } GAIN_f.prototype.details = function GAIN_f() { + return this.x; } GAIN_f.prototype.get = function GAIN_f() { } GAIN_f.prototype.set = function GAIN_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,gain,exprs] = scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]); - if (!ok) { -break; -} - if (gain==[]) { -message("Gain must have at least one element"); - } else { - [out,in1] = size(gain); - [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]); - if (ok) { - graphics.exprs = exprs; - model.rpar = gain.slice(); - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,gain,exprs] = scicos_getvalue("Set gain block parameters",["Gain"],list("mat",[-1,-1]),exprs[1-1]); + if (!ok) { + break; + } + if (gain==[]) { + message("Gain must have at least one element"); + } else { + [out,in1] = size(gain); + [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]); + if (ok) { + graphics.exprs = exprs; + model.rpar = gain.slice(); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Linear/GAIN_f.pickle b/js/Linear/GAIN_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/GAIN_f.pickle +++ b/js/Linear/GAIN_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/INTEGRAL.js b/js/Linear/INTEGRAL.js index 289c882c..4184d619 100644 --- a/js/Linear/INTEGRAL.js +++ b/js/Linear/INTEGRAL.js @@ -14,67 +14,68 @@ function INTEGRAL() { model.dep_ut = [false,true]; exprs = string([[0],[0],[0],[maxp],[minp]]); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); - x.graphics.id = "1/s"; + this.x = standard_define([2,2],model,exprs,gr_i); + this.x.graphics.id = "1/s"; } INTEGRAL.prototype.details = function INTEGRAL() { + return this.x; } INTEGRAL.prototype.get = function INTEGRAL() { } INTEGRAL.prototype.set = function INTEGRAL() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,x0,reinit,satur,maxp,lowp,exprs] = scicos_getvalue("Set Integral block parameters",[["Initial Condition"],["With re-intialization (1:yes, 0:no)"],["With saturation (1:yes, 0:no)"],["Upper limit"],["Lower limit"]],list("vec",-1,"vec",1,"vec",1,"vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - x0 = x0.slice(); - maxp = maxp.slice(); - lowp = lowp.slice(); - if (reinit!=0) { - reinit = 1; -} - if (satur!=0) { - satur = 1; - if (size(maxp,"*")==1) { - maxp = maxp*ones(x0); -} - if (size(lowp,"*")==1) { - lowp = lowp*ones(x0); -} - if ((size(x0,1)!=size(maxp,1)||size(x0,1)!=size(lowp,1))) { -message("x0 and Upper limit and Lower limit must have same size"); - ok = false; - } else if (or(maxp<=lowp)) { -message("Upper limits must be > Lower limits"); - ok = false; - } else if (or(x0>maxp)||or(x0 Lower limits"); + ok = false; + } else if (or(x0>maxp)||or(x0 Lower limits"); - ok = false; - } else if (or(x0>maxp)||or(x0 Lower limits"); - ok = false; - } else if (or(real(x0)>real(maxp))||or(real(x0)imag(maxp))||or(imag(x0) Lower limits"); + ok = false; + } else if (or(x0>maxp)||or(x0 Lower limits"); + ok = false; + } else if (or(real(x0)>real(maxp))||or(real(x0)imag(maxp))||or(imag(x0)8))) { -message("Datatype is not supported"); - ok = false; -} - if (ok) { - in1 = [model.in1,model.in2]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(in1,it),1,[]); - if (ok) { - graphics.exprs = exprs; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} -} + [ok,it,exprs] = scicos_getvalue("Set parameters Block",["Datatype(1=real double 2=Complex 3=int32 ...)"],list("vec",1),label); + if (!ok) { + break; + } + if (((it<1)||(it>8))) { + message("Datatype is not supported"); + ok = false; + } + if (ok) { + in1 = [model.in1,model.in2]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(in1,it),1,[]); + if (ok) { + graphics.exprs = exprs; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } + } } } diff --git a/js/Linear/SAMPHOLD_m.pickle b/js/Linear/SAMPHOLD_m.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/SAMPHOLD_m.pickle +++ b/js/Linear/SAMPHOLD_m.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/SAMPLEHOLD_f.js b/js/Linear/SAMPLEHOLD_f.js index c56fe8a5..916f2834 100644 --- a/js/Linear/SAMPLEHOLD_f.js +++ b/js/Linear/SAMPLEHOLD_f.js @@ -10,14 +10,15 @@ function SAMPLEHOLD_f() { model.blocktype = "d"; model.dep_ut = [true,false]; gr_i = []; - x = standard_define([2,2],model," ",gr_i); + this.x = standard_define([2,2],model," ",gr_i); } SAMPLEHOLD_f.prototype.details = function SAMPLEHOLD_f() { + return this.x; } SAMPLEHOLD_f.prototype.get = function SAMPLEHOLD_f() { } SAMPLEHOLD_f.prototype.set = function SAMPLEHOLD_f() { - x = arg1; - x.model.firing = []; + this.x = arg1; + this.x.model.firing = []; } } diff --git a/js/Linear/SAMPLEHOLD_f.pickle b/js/Linear/SAMPLEHOLD_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/SAMPLEHOLD_f.pickle +++ b/js/Linear/SAMPLEHOLD_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/SOM_f.js b/js/Linear/SOM_f.js index e119ce47..0e4cedcc 100644 --- a/js/Linear/SOM_f.js +++ b/js/Linear/SOM_f.js @@ -11,30 +11,31 @@ function SOM_f() { model.dep_ut = [true,false]; exprs = [[sci2exp(1)],[sci2exp(sgn)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } SOM_f.prototype.details = function SOM_f() { + return this.x; } SOM_f.prototype.get = function SOM_f() { } SOM_f.prototype.set = function SOM_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; if (size(exprs,"*")==2) { - exprs = exprs[2-1]; -} + exprs = exprs[2-1]; + } if (size(exprs,"*")!=3) { - exprs = string(model.rpar); -} + exprs = string(model.rpar); + } if (graphics.flip) { - labs = ["down","left","up"]; + labs = ["down","left","up"]; } else { - labs = ["down","right","up"]; -} + labs = ["down","right","up"]; + } str = [["This sum block is obsolete","parameters cannot be modified. Please replace it with new sum block"],["and gain blocks in the linear palette"," ","Input ports are located at up, side and down positions.","Current gains are:"]]; str = [[str],[(part(labs.slice(),1,7)+exprs.slice())]]; -message(str); + message(str); } } diff --git a/js/Linear/SOM_f.pickle b/js/Linear/SOM_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/SOM_f.pickle +++ b/js/Linear/SOM_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/SUMMATION.js b/js/Linear/SUMMATION.js index d5171c25..4b5481ec 100644 --- a/js/Linear/SUMMATION.js +++ b/js/Linear/SUMMATION.js @@ -13,125 +13,126 @@ function SUMMATION() { model.dep_ut = [true,false]; exprs = sci2exp(sgn); gr_i = []; - x = standard_define([2,3],model,exprs,gr_i); + this.x = standard_define([2,3],model,exprs,gr_i); } SUMMATION.prototype.details = function SUMMATION() { + return this.x; } SUMMATION.prototype.get = function SUMMATION() { } SUMMATION.prototype.set = function SUMMATION() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; if (size(exprs,1)==1) { - exprs = [[sci2exp(1)],[exprs],[sci2exp(0)]]; + exprs = [[sci2exp(1)],[exprs],[sci2exp(0)]]; } else if (size(exprs,1)==2) { - exprs = [[exprs],[sci2exp(0)]]; -} + exprs = [[exprs],[sci2exp(0)]]; + } while (true) { - [ok,Datatype,sgn,satur,exprs] = scicos_getvalue("Set sum block parameters",[["Datatype (1=real double 2=complex 3=int32 ...)"],["Number of inputs or sign vector (of +1, -1)"],["Do on Overflow(0=Nothing 1=Saturate 2=Error)"]],list("vec",1,"vec",-1,"vec",1),exprs); - if (!ok) { -break; -} - sgn = sgn.slice(); - if ((satur!=0&&satur!=1&&satur!=2)) { -message("Do on overflow must be 0,1,2"); - ok = false; -} - if (size(sgn,1)==1) { - if (sgn<1) { -message("Number of inputs must be > 0"); - ok = false; - } else if (sgn==1) { - in1 = -1; - in2 = -2; - sgn = []; - nout = 1; - nout2 = 1; - } else { - in1 = -ones(sgn,1); - in2 = 2*in1; - sgn = ones(sgn,1); - nout = -1; - nout2 = -2; -} - } else { - if (!and(abs(sgn)==1)) { -message("Signs can only be +1 or -1"); - ok = false; - } else { - in1 = -ones(size(sgn,1),1); - in2 = 2*in1; - nout = -1; - nout2 = -2; -} -} - it = Datatype*ones(1,size(in1,1)); - ot = Datatype; - if (Datatype==1) { - model.sim = list("summation",4); - } else if (Datatype==2) { - model.sim = list("summation_z",4); - } else if (((Datatype<1)||(Datatype>8))) { -message("Datatype is not supported"); - ok = false; - } else { - if (satur==0) { - if (Datatype==3) { - model.sim = list("summation_i32n",4); - } else if (Datatype==4) { - model.sim = list("summation_i16n",4); - } else if (Datatype==5) { - model.sim = list("summation_i8n",4); - } else if (Datatype==6) { - model.sim = list("summation_ui32n",4); - } else if (Datatype==7) { - model.sim = list("summation_ui16n",4); - } else if (Datatype==8) { - model.sim = list("summation_ui8n",4); -} - } else if (satur==1) { - if (Datatype==3) { - model.sim = list("summation_i32s",4); - } else if (Datatype==4) { - model.sim = list("summation_i16s",4); - } else if (Datatype==5) { - model.sim = list("summation_i8s",4); - } else if (Datatype==6) { - model.sim = list("summation_ui32s",4); - } else if (Datatype==7) { - model.sim = list("summation_ui16s",4); - } else if (Datatype==8) { - model.sim = list("summation_ui8s",4); -} - } else if (satur==2) { - if (Datatype==3) { - model.sim = list("summation_i32e",4); - } else if (Datatype==4) { - model.sim = list("summation_i16e",4); - } else if (Datatype==5) { - model.sim = list("summation_i8e",4); - } else if (Datatype==6) { - model.sim = list("summation_ui32e",4); - } else if (Datatype==7) { - model.sim = list("summation_ui16e",4); - } else if (Datatype==8) { - model.sim = list("summation_ui8e",4); -} -} -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list([in1,in2],it),list([nout,nout2],ot),[],[]); -} - if (ok) { - model.rpar = satur; - model.ipar = sgn; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,Datatype,sgn,satur,exprs] = scicos_getvalue("Set sum block parameters",[["Datatype (1=real double 2=complex 3=int32 ...)"],["Number of inputs or sign vector (of +1, -1)"],["Do on Overflow(0=Nothing 1=Saturate 2=Error)"]],list("vec",1,"vec",-1,"vec",1),exprs); + if (!ok) { + break; + } + sgn = sgn.slice(); + if ((satur!=0&&satur!=1&&satur!=2)) { + message("Do on overflow must be 0,1,2"); + ok = false; + } + if (size(sgn,1)==1) { + if (sgn<1) { + message("Number of inputs must be > 0"); + ok = false; + } else if (sgn==1) { + in1 = -1; + in2 = -2; + sgn = []; + nout = 1; + nout2 = 1; + } else { + in1 = -ones(sgn,1); + in2 = 2*in1; + sgn = ones(sgn,1); + nout = -1; + nout2 = -2; + } + } else { + if (!and(abs(sgn)==1)) { + message("Signs can only be +1 or -1"); + ok = false; + } else { + in1 = -ones(size(sgn,1),1); + in2 = 2*in1; + nout = -1; + nout2 = -2; + } + } + it = Datatype*ones(1,size(in1,1)); + ot = Datatype; + if (Datatype==1) { + model.sim = list("summation",4); + } else if (Datatype==2) { + model.sim = list("summation_z",4); + } else if (((Datatype<1)||(Datatype>8))) { + message("Datatype is not supported"); + ok = false; + } else { + if (satur==0) { + if (Datatype==3) { + model.sim = list("summation_i32n",4); + } else if (Datatype==4) { + model.sim = list("summation_i16n",4); + } else if (Datatype==5) { + model.sim = list("summation_i8n",4); + } else if (Datatype==6) { + model.sim = list("summation_ui32n",4); + } else if (Datatype==7) { + model.sim = list("summation_ui16n",4); + } else if (Datatype==8) { + model.sim = list("summation_ui8n",4); + } + } else if (satur==1) { + if (Datatype==3) { + model.sim = list("summation_i32s",4); + } else if (Datatype==4) { + model.sim = list("summation_i16s",4); + } else if (Datatype==5) { + model.sim = list("summation_i8s",4); + } else if (Datatype==6) { + model.sim = list("summation_ui32s",4); + } else if (Datatype==7) { + model.sim = list("summation_ui16s",4); + } else if (Datatype==8) { + model.sim = list("summation_ui8s",4); + } + } else if (satur==2) { + if (Datatype==3) { + model.sim = list("summation_i32e",4); + } else if (Datatype==4) { + model.sim = list("summation_i16e",4); + } else if (Datatype==5) { + model.sim = list("summation_i8e",4); + } else if (Datatype==6) { + model.sim = list("summation_ui32e",4); + } else if (Datatype==7) { + model.sim = list("summation_ui16e",4); + } else if (Datatype==8) { + model.sim = list("summation_ui8e",4); + } + } + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],it),list([nout,nout2],ot),[],[]); + } + if (ok) { + model.rpar = satur; + model.ipar = sgn; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Linear/SUMMATION.pickle b/js/Linear/SUMMATION.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/SUMMATION.pickle +++ b/js/Linear/SUMMATION.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/SUM_f.js b/js/Linear/SUM_f.js index 024692bd..a9f25a10 100644 --- a/js/Linear/SUM_f.js +++ b/js/Linear/SUM_f.js @@ -9,13 +9,14 @@ function SUM_f() { model.dep_ut = [true,false]; gr_i = []; exprs = []; - x = standard_define([1,1],model,exprs,gr_i); + this.x = standard_define([1,1],model,exprs,gr_i); } SUM_f.prototype.details = function SUM_f() { + return this.x; } SUM_f.prototype.get = function SUM_f() { } SUM_f.prototype.set = function SUM_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Linear/SUM_f.pickle b/js/Linear/SUM_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/SUM_f.pickle +++ b/js/Linear/SUM_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/TCLSS.js b/js/Linear/TCLSS.js index 516eb048..e6a19aa3 100644 --- a/js/Linear/TCLSS.js +++ b/js/Linear/TCLSS.js @@ -20,65 +20,66 @@ function TCLSS() { model.dep_ut = [false,true]; exprs = [[strcat(sci2exp(A))],[strcat(sci2exp(B))],[strcat(sci2exp(C))],[strcat(sci2exp(D))],[strcat(sci2exp(x0))]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } TCLSS.prototype.details = function TCLSS() { + return this.x; } TCLSS.prototype.get = function TCLSS() { } TCLSS.prototype.set = function TCLSS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==7) { - exprs = exprs[[1:4,7]-1]; -} + exprs = exprs[[1:4,7]-1]; + } while (true) { - [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); - if (!ok) { -break; -} - out = size(C,1); - if (out==0) { - out = []; -} - in1 = size(B,2); - if (in1==0) { - in1 = []; -} - [ms,ns] = size(A); - if (ms!=ns) { -message("A matrix must be square"); - } else { - [model,graphics,ok] = check_io(model,graphics,[[in1],[ms]],out,1,[]); - if (ok) { - graphics.exprs = exprs; - rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; - if (D!=[]) { - if (norm(D,1)!=0) { - mmm = [true,true]; - } else { - mmm = [false,true]; -} - if (or(model.dep_ut!=mmm)) { - model.dep_ut = mmm; -} - } else { - model.dep_ut = [false,true]; -} - model.state = x0.slice(); - model.rpar = rpar; - if (D!=[]) { - model.sim = list("tcslti4",4); - } else { - model.sim = list("tcsltj4",4); -} - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); + if (!ok) { + break; + } + out = size(C,1); + if (out==0) { + out = []; + } + in1 = size(B,2); + if (in1==0) { + in1 = []; + } + [ms,ns] = size(A); + if (ms!=ns) { + message("A matrix must be square"); + } else { + [model,graphics,ok] = check_io(model,graphics,[[in1],[ms]],out,1,[]); + if (ok) { + graphics.exprs = exprs; + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + if (D!=[]) { + if (norm(D,1)!=0) { + mmm = [true,true]; + } else { + mmm = [false,true]; + } + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; + } + } else { + model.dep_ut = [false,true]; + } + model.state = x0.slice(); + model.rpar = rpar; + if (D!=[]) { + model.sim = list("tcslti4",4); + } else { + model.sim = list("tcsltj4",4); + } + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Linear/TCLSS.pickle b/js/Linear/TCLSS.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/TCLSS.pickle +++ b/js/Linear/TCLSS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/TCLSS_f.js b/js/Linear/TCLSS_f.js index 9d43d97e..fd5483b1 100644 --- a/js/Linear/TCLSS_f.js +++ b/js/Linear/TCLSS_f.js @@ -20,65 +20,66 @@ function TCLSS_f() { model.dep_ut = [false,true]; exprs = [[strcat(sci2exp(A))],[strcat(sci2exp(B))],[strcat(sci2exp(C))],[strcat(sci2exp(D))],[strcat(sci2exp(x0))]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } TCLSS_f.prototype.details = function TCLSS_f() { + return this.x; } TCLSS_f.prototype.get = function TCLSS_f() { } TCLSS_f.prototype.set = function TCLSS_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==7) { - exprs = exprs[[1:4,7]-1]; -} + exprs = exprs[[1:4,7]-1]; + } while (true) { - [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); - if (!ok) { -break; -} - out = size(C,1); - if (out==0) { - out = []; -} - in1 = size(B,2); - if (in1==0) { - in1 = []; -} - [ms,ns] = size(A); - if (ms!=ns) { -message("A matrix must be square"); - } else { - [model,graphics,ok] = check_io(model,graphics,[[in1],[ms]],out,1,[]); - if (ok) { - graphics.exprs = exprs; - rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; - if (D!=[]) { - if (norm(D,1)!=0) { - mmm = [true,true]; - } else { - mmm = [false,true]; -} - if (or(model.dep_ut!=mmm)) { - model.dep_ut = mmm; -} - } else { - model.dep_ut = [false,true]; -} - model.state = x0.slice(); - model.rpar = rpar; - if (D!=[]) { - model.sim = list("tcslti",1); - } else { - model.sim = list("tcsltj",1); -} - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs); + if (!ok) { + break; + } + out = size(C,1); + if (out==0) { + out = []; + } + in1 = size(B,2); + if (in1==0) { + in1 = []; + } + [ms,ns] = size(A); + if (ms!=ns) { + message("A matrix must be square"); + } else { + [model,graphics,ok] = check_io(model,graphics,[[in1],[ms]],out,1,[]); + if (ok) { + graphics.exprs = exprs; + rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]]; + if (D!=[]) { + if (norm(D,1)!=0) { + mmm = [true,true]; + } else { + mmm = [false,true]; + } + if (or(model.dep_ut!=mmm)) { + model.dep_ut = mmm; + } + } else { + model.dep_ut = [false,true]; + } + model.state = x0.slice(); + model.rpar = rpar; + if (D!=[]) { + model.sim = list("tcslti",1); + } else { + model.sim = list("tcsltj",1); + } + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Linear/TCLSS_f.pickle b/js/Linear/TCLSS_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/TCLSS_f.pickle +++ b/js/Linear/TCLSS_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/TIME_DELAY.js b/js/Linear/TIME_DELAY.js index e4d235c6..8834f518 100644 --- a/js/Linear/TIME_DELAY.js +++ b/js/Linear/TIME_DELAY.js @@ -15,43 +15,44 @@ function TIME_DELAY() { model.dep_ut = [false,true]; exprs = [[string(T)],[string(init)],[string(N)]]; gr_i = []; - x = standard_define([3.5,2],model,exprs,gr_i); + this.x = standard_define([3.5,2],model,exprs,gr_i); } TIME_DELAY.prototype.details = function TIME_DELAY() { + return this.x; } TIME_DELAY.prototype.get = function TIME_DELAY() { } TIME_DELAY.prototype.set = function TIME_DELAY() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; nin = model.in1[1-1]; while (true) { - [ok,T,init,N,exprs] = scicos_getvalue("Set delay parameters",[["Delay"],["initial input"],["Buffer size"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (N<2) { -message("Buffer must be larger than 2"); - ok = false; -} - if (T<=0) { -message("Delay must be positive"); - ok = false; -} - if (ok) { - [model,graphics,ok] = check_io(model,graphics,[-1],-1,[],[]); -} - if (ok) { - graphics.exprs = exprs; - model.rpar = [[T],[init]]; - model.ipar = N; - model.dep_ut = [false,true]; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,T,init,N,exprs] = scicos_getvalue("Set delay parameters",[["Delay"],["initial input"],["Buffer size"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (N<2) { + message("Buffer must be larger than 2"); + ok = false; + } + if (T<=0) { + message("Delay must be positive"); + ok = false; + } + if (ok) { + [model,graphics,ok] = check_io(model,graphics,[-1],-1,[],[]); + } + if (ok) { + graphics.exprs = exprs; + model.rpar = [[T],[init]]; + model.ipar = N; + model.dep_ut = [false,true]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Linear/TIME_DELAY.pickle b/js/Linear/TIME_DELAY.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/TIME_DELAY.pickle +++ b/js/Linear/TIME_DELAY.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Linear/VARIABLE_DELAY.js b/js/Linear/VARIABLE_DELAY.js index 3a87c5c0..f1607678 100644 --- a/js/Linear/VARIABLE_DELAY.js +++ b/js/Linear/VARIABLE_DELAY.js @@ -15,42 +15,43 @@ function VARIABLE_DELAY() { model.dep_ut = [false,false]; exprs = [[string(T)],[string(init)],[string(N)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } VARIABLE_DELAY.prototype.details = function VARIABLE_DELAY() { + return this.x; } VARIABLE_DELAY.prototype.get = function VARIABLE_DELAY() { } VARIABLE_DELAY.prototype.set = function VARIABLE_DELAY() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; nin = model.in1[1-1]; while (true) { - [ok,T,init,N,exprs] = scicos_getvalue("Set delay parameters",[["Max delay"],["initial input"],["Buffer size"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (N<2) { -message("Buffer must be larger than 2"); - ok = false; -} - if (T<=0) { -message("Delay must be positive"); - ok = false; -} - if (ok) { - [model,graphics,ok] = check_io(model,graphics,[[-1],[1]],-1,[],[]); -} - if (ok) { - graphics.exprs = exprs; - model.rpar = [[T],[init]]; - model.ipar = N; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,T,init,N,exprs] = scicos_getvalue("Set delay parameters",[["Max delay"],["initial input"],["Buffer size"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (N<2) { + message("Buffer must be larger than 2"); + ok = false; + } + if (T<=0) { + message("Delay must be positive"); + ok = false; + } + if (ok) { + [model,graphics,ok] = check_io(model,graphics,[[-1],[1]],-1,[],[]); + } + if (ok) { + graphics.exprs = exprs; + model.rpar = [[T],[init]]; + model.ipar = N; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Linear/VARIABLE_DELAY.pickle b/js/Linear/VARIABLE_DELAY.pickle index 154645d8..0d1dde24 100644 --- a/js/Linear/VARIABLE_DELAY.pickle +++ b/js/Linear/VARIABLE_DELAY.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/CUMSUM.js b/js/MatrixOp/CUMSUM.js index 08cc8d5a..362ece2f 100644 --- a/js/MatrixOp/CUMSUM.js +++ b/js/MatrixOp/CUMSUM.js @@ -22,73 +22,74 @@ function CUMSUM() { model.dep_ut = [true,false]; label = [[sci2exp(1)],[sci2exp(0)]]; gr_i = []; - x = standard_define([3,2],model,label,gr_i); + this.x = standard_define([3,2],model,label,gr_i); } CUMSUM.prototype.details = function CUMSUM() { + return this.x; } CUMSUM.prototype.get = function CUMSUM() { } CUMSUM.prototype.set = function CUMSUM() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,decomptyp,lab] = scicos_getvalue("Set CUMSUM block parameters",[["Datatype(1=real double 2=Complex)"],["Sum along (0=the first non singleton dimension 1=Rows 2=Columns)"]],list("vec",1,"vec",1),label); - if (!ok) { -break; -} - label = lab; - if ((typ==1)) { - if ((decomptyp==0)) { - function_name = "cumsum_m"; - out = [-1,-2]; - } else if ((decomptyp==1)) { - function_name = "cumsum_r"; - out = [-1,1]; - } else if ((decomptyp==2)) { - function_name = "cumsum_c"; - out = [1,-2]; - } else { -message("decomposition type is not supported"); - ok = false; -} - it = 1; - ot = 1; - } else if ((typ==2)) { - if ((decomptyp==0)) { - function_name = "cumsumz_m"; - } else if ((decomptyp==1)) { - function_name = "cumsumz_r"; - } else if ((decomptyp==2)) { - function_name = "cumsumz_c"; - } else { -message("decomposition type is not supported"); - ok = false; -} - it = 2; - ot = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - funtyp = 4; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - model.sim = list(function_name,funtyp); - arg1.model = model; - graphics.exprs = label; - arg1.graphics = graphics; - x = arg1; -break; -} -} + [ok,typ,decomptyp,lab] = scicos_getvalue("Set CUMSUM block parameters",[["Datatype(1=real double 2=Complex)"],["Sum along (0=the first non singleton dimension 1=Rows 2=Columns)"]],list("vec",1,"vec",1),label); + if (!ok) { + break; + } + label = lab; + if ((typ==1)) { + if ((decomptyp==0)) { + function_name = "cumsum_m"; + out = [-1,-2]; + } else if ((decomptyp==1)) { + function_name = "cumsum_r"; + out = [-1,1]; + } else if ((decomptyp==2)) { + function_name = "cumsum_c"; + out = [1,-2]; + } else { + message("decomposition type is not supported"); + ok = false; + } + it = 1; + ot = 1; + } else if ((typ==2)) { + if ((decomptyp==0)) { + function_name = "cumsumz_m"; + } else if ((decomptyp==1)) { + function_name = "cumsumz_r"; + } else if ((decomptyp==2)) { + function_name = "cumsumz_c"; + } else { + message("decomposition type is not supported"); + ok = false; + } + it = 2; + ot = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + funtyp = 4; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + model.sim = list(function_name,funtyp); + arg1.model = model; + graphics.exprs = label; + arg1.graphics = graphics; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/CUMSUM.pickle b/js/MatrixOp/CUMSUM.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/CUMSUM.pickle +++ b/js/MatrixOp/CUMSUM.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/EXTRACT.js b/js/MatrixOp/EXTRACT.js index 0d5e5c18..4afd5810 100644 --- a/js/MatrixOp/EXTRACT.js +++ b/js/MatrixOp/EXTRACT.js @@ -22,71 +22,72 @@ function EXTRACT() { model.dep_ut = [true,false]; label = [[sci2exp(1)],[sci2exp([1])],[sci2exp([1])]]; gr_i = []; - x = standard_define([3,2],model,label,gr_i); + this.x = standard_define([3,2],model,label,gr_i); } EXTRACT.prototype.details = function EXTRACT() { + return this.x; } EXTRACT.prototype.get = function EXTRACT() { } EXTRACT.prototype.set = function EXTRACT() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,a,b,exprs] = scicos_getvalue("Set EXTRACT Block",[["Datatype (1=real double 2=Complex)"],["Lines to extract"],["Columns to extract"]],list("vec",1,"mat",[1,-1],"mat",[1,-1]),label); - a = a.slice(); - b = b.slice(); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "extract"; - ot = 1; - it = 1; - } else if ((typ==2)) { - function_name = "extractz"; - ot = 2; - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - ma = size(a,1); - mb = size(b,1); - if ((ma==0||mb==0)) { -message("empty field"); - ok = false; -} -for (i=1;i<=ma;i+=1) { - if ((a[i-1]<=0)) { -message("invalid index"); - ok = false; -} -} -for (j=1;j<=mb;j+=1) { - if ((b[j-1]<=0)) { -message("invalid index"); - ok = false; -} -} - model.ipar = [[a],[b],[ma],[mb]]; - in1 = [model.in1,model.in2]; - out = [ma,mb]; - funtyp = 4; - if (ok) { - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,a,b,exprs] = scicos_getvalue("Set EXTRACT Block",[["Datatype (1=real double 2=Complex)"],["Lines to extract"],["Columns to extract"]],list("vec",1,"mat",[1,-1],"mat",[1,-1]),label); + a = a.slice(); + b = b.slice(); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "extract"; + ot = 1; + it = 1; + } else if ((typ==2)) { + function_name = "extractz"; + ot = 2; + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + ma = size(a,1); + mb = size(b,1); + if ((ma==0||mb==0)) { + message("empty field"); + ok = false; + } + for (i=1;i<=ma;i+=1) { + if ((a[i-1]<=0)) { + message("invalid index"); + ok = false; + } + } + for (j=1;j<=mb;j+=1) { + if ((b[j-1]<=0)) { + message("invalid index"); + ok = false; + } + } + model.ipar = [[a],[b],[ma],[mb]]; + in1 = [model.in1,model.in2]; + out = [ma,mb]; + funtyp = 4; + if (ok) { + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/EXTRACT.pickle b/js/MatrixOp/EXTRACT.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/EXTRACT.pickle +++ b/js/MatrixOp/EXTRACT.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/EXTTRI.js b/js/MatrixOp/EXTTRI.js index 319de0cc..5ebaaf18 100644 --- a/js/MatrixOp/EXTTRI.js +++ b/js/MatrixOp/EXTTRI.js @@ -22,70 +22,71 @@ function EXTTRI() { model.dep_ut = [true,false]; label = [[sci2exp(1)],[sci2exp(1)]]; gr_i = []; - x = standard_define([3,2],model,label,gr_i); + this.x = standard_define([3,2],model,label,gr_i); } EXTTRI.prototype.details = function EXTTRI() { + return this.x; } EXTTRI.prototype.get = function EXTTRI() { } EXTTRI.prototype.set = function EXTTRI() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,decomptyp,lab] = scicos_getvalue("Set EXTTRI block parameters",[["Datatype(1=real double 2=Complex)"],["extraction type (1=lower 2=upper 3=diagonal)"]],list("vec",1,"vec",1),label); - if (!ok) { -break; -} - label = lab; - if ((typ==1)) { - if ((decomptyp==1)) { - function_name = "exttril"; - } else if ((decomptyp==2)) { - function_name = "exttriu"; - } else if ((decomptyp==3)) { - function_name = "extdiag"; - } else { -message("decomposition type is not supported"); - ok = false; -} - it = 1; - ot = 1; - } else if ((typ==2)) { - if ((decomptyp==1)) { - function_name = "exttrilz"; - } else if ((decomptyp==2)) { - function_name = "exttriuz"; - } else if ((decomptyp==3)) { - function_name = "extdiagz"; - } else { -message("decomposition type is not supported"); - ok = false; -} - it = 2; - ot = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - funtyp = 4; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - model.sim = list(function_name,funtyp); - arg1.model = model; - graphics.exprs = label; - arg1.graphics = graphics; - x = arg1; -break; -} -} + [ok,typ,decomptyp,lab] = scicos_getvalue("Set EXTTRI block parameters",[["Datatype(1=real double 2=Complex)"],["extraction type (1=lower 2=upper 3=diagonal)"]],list("vec",1,"vec",1),label); + if (!ok) { + break; + } + label = lab; + if ((typ==1)) { + if ((decomptyp==1)) { + function_name = "exttril"; + } else if ((decomptyp==2)) { + function_name = "exttriu"; + } else if ((decomptyp==3)) { + function_name = "extdiag"; + } else { + message("decomposition type is not supported"); + ok = false; + } + it = 1; + ot = 1; + } else if ((typ==2)) { + if ((decomptyp==1)) { + function_name = "exttrilz"; + } else if ((decomptyp==2)) { + function_name = "exttriuz"; + } else if ((decomptyp==3)) { + function_name = "extdiagz"; + } else { + message("decomposition type is not supported"); + ok = false; + } + it = 2; + ot = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + funtyp = 4; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + model.sim = list(function_name,funtyp); + arg1.model = model; + graphics.exprs = label; + arg1.graphics = graphics; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/EXTTRI.pickle b/js/MatrixOp/EXTTRI.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/EXTTRI.pickle +++ b/js/MatrixOp/EXTTRI.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATBKSL.js b/js/MatrixOp/MATBKSL.js index a87bef95..06235455 100644 --- a/js/MatrixOp/MATBKSL.js +++ b/js/MatrixOp/MATBKSL.js @@ -22,50 +22,51 @@ function MATBKSL() { model.dep_ut = [true,false]; label = [sci2exp(1)]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } MATBKSL.prototype.details = function MATBKSL() { + return this.x; } MATBKSL.prototype.get = function MATBKSL() { } MATBKSL.prototype.set = function MATBKSL() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,exprs] = scicos_getvalue("Set MATBKSL Block",["Datatype (1=real double 2=Complex)"],list("vec",1),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "mat_bksl"; - ot = 1; - it = [1,1]; - } else if ((typ==2)) { - function_name = "matz_bksl"; - ot = 2; - it = [2,2]; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - funtyp = 4; - if (ok) { - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,exprs] = scicos_getvalue("Set MATBKSL Block",["Datatype (1=real double 2=Complex)"],list("vec",1),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "mat_bksl"; + ot = 1; + it = [1,1]; + } else if ((typ==2)) { + function_name = "matz_bksl"; + ot = 2; + it = [2,2]; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + funtyp = 4; + if (ok) { + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATBKSL.pickle b/js/MatrixOp/MATBKSL.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATBKSL.pickle +++ b/js/MatrixOp/MATBKSL.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATCATH.js b/js/MatrixOp/MATCATH.js index 29da12eb..f365bb52 100644 --- a/js/MatrixOp/MATCATH.js +++ b/js/MatrixOp/MATCATH.js @@ -22,40 +22,41 @@ function MATCATH() { model.dep_ut = [true,false]; label = [sci2exp(2)]; gr_i = []; - x = standard_define([2,3],model,label,gr_i); + this.x = standard_define([2,3],model,label,gr_i); } MATCATH.prototype.details = function MATCATH() { + return this.x; } MATCATH.prototype.get = function MATCATH() { } MATCATH.prototype.set = function MATCATH() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")>1) { - label = "size(evstr("+label[2-1]+"),\'*\')"; -} + label = "size(evstr("+label[2-1]+"),\'*\')"; + } while (true) { - [ok,nin,lab] = scicos_getvalue("Set MATCATH block parameters",["Number of input"],list("vec",1),label); - if (!ok) { -break; -} - label = lab; - in1 = [-1*(ones(nin,1)),-(transpose([2:nin+1]))]; - out = [-1,0]; - it = -1*(ones(nin,1)); - ot = -1; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - if (ok) { - funtyp = 4; - model.sim = list("mat_cath",funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,nin,lab] = scicos_getvalue("Set MATCATH block parameters",["Number of input"],list("vec",1),label); + if (!ok) { + break; + } + label = lab; + in1 = [-1*(ones(nin,1)),-(transpose([2:nin+1]))]; + out = [-1,0]; + it = -1*(ones(nin,1)); + ot = -1; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + if (ok) { + funtyp = 4; + model.sim = list("mat_cath",funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATCATH.pickle b/js/MatrixOp/MATCATH.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATCATH.pickle +++ b/js/MatrixOp/MATCATH.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATCATV.js b/js/MatrixOp/MATCATV.js index 02682ea6..7e011ea2 100644 --- a/js/MatrixOp/MATCATV.js +++ b/js/MatrixOp/MATCATV.js @@ -23,40 +23,41 @@ function MATCATV() { model.dep_ut = [true,false]; label = [sci2exp(2)]; gr_i = []; - x = standard_define([2,3],model,label,gr_i); + this.x = standard_define([2,3],model,label,gr_i); } MATCATV.prototype.details = function MATCATV() { + return this.x; } MATCATV.prototype.get = function MATCATV() { } MATCATV.prototype.set = function MATCATV() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")>1) { - label = "size(evstr("+label[2-1]+"),\'*\')"; -} + label = "size(evstr("+label[2-1]+"),\'*\')"; + } while (true) { - [ok,nin,lab] = scicos_getvalue("Set MATCATV block parameters",["Number od inputs"],list("vec",1),label); - if (!ok) { -break; -} - label = lab; - in1 = [-(transpose([2:nin+1])),-ones(nin,1)]; - it = -ones(nin,1); - ot = -1; - out = [0,-1]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - if (ok) { - funtyp = 4; - model.sim = list("mat_catv",funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,nin,lab] = scicos_getvalue("Set MATCATV block parameters",["Number od inputs"],list("vec",1),label); + if (!ok) { + break; + } + label = lab; + in1 = [-(transpose([2:nin+1])),-ones(nin,1)]; + it = -ones(nin,1); + ot = -1; + out = [0,-1]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + if (ok) { + funtyp = 4; + model.sim = list("mat_catv",funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATCATV.pickle b/js/MatrixOp/MATCATV.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATCATV.pickle +++ b/js/MatrixOp/MATCATV.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATDET.js b/js/MatrixOp/MATDET.js index 41f4a0a4..176268ce 100644 --- a/js/MatrixOp/MATDET.js +++ b/js/MatrixOp/MATDET.js @@ -22,50 +22,51 @@ function MATDET() { model.dep_ut = [true,false]; label = [sci2exp(1)]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } MATDET.prototype.details = function MATDET() { + return this.x; } MATDET.prototype.get = function MATDET() { } MATDET.prototype.set = function MATDET() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,exprs] = scicos_getvalue("Set MATDET Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "mat_det"; - ot = 1; - it = 1; - } else if ((typ==2)) { - function_name = "matz_det"; - ot = 2; - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - funtyp = 4; - if (ok) { - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,exprs] = scicos_getvalue("Set MATDET Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "mat_det"; + ot = 1; + it = 1; + } else if ((typ==2)) { + function_name = "matz_det"; + ot = 2; + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + funtyp = 4; + if (ok) { + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATDET.pickle b/js/MatrixOp/MATDET.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATDET.pickle +++ b/js/MatrixOp/MATDET.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATDIAG.js b/js/MatrixOp/MATDIAG.js index 5c565daa..8f76bb54 100644 --- a/js/MatrixOp/MATDIAG.js +++ b/js/MatrixOp/MATDIAG.js @@ -22,50 +22,51 @@ function MATDIAG() { model.dep_ut = [true,false]; label = [sci2exp(1)]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } MATDIAG.prototype.details = function MATDIAG() { + return this.x; } MATDIAG.prototype.get = function MATDIAG() { } MATDIAG.prototype.set = function MATDIAG() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,exprs] = scicos_getvalue("Set MATDIAG Block",["Datatype (1=real double 2=Complex)"],list("vec",1),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "mat_diag"; - ot = 1; - it = 1; - } else if ((typ==2)) { - function_name = "matz_diag"; - ot = 2; - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - funtyp = 4; - if (ok) { - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,exprs] = scicos_getvalue("Set MATDIAG Block",["Datatype (1=real double 2=Complex)"],list("vec",1),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "mat_diag"; + ot = 1; + it = 1; + } else if ((typ==2)) { + function_name = "matz_diag"; + ot = 2; + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + funtyp = 4; + if (ok) { + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATDIAG.pickle b/js/MatrixOp/MATDIAG.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATDIAG.pickle +++ b/js/MatrixOp/MATDIAG.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATDIV.js b/js/MatrixOp/MATDIV.js index 01922e06..64a39f47 100644 --- a/js/MatrixOp/MATDIV.js +++ b/js/MatrixOp/MATDIV.js @@ -22,50 +22,51 @@ function MATDIV() { model.dep_ut = [true,false]; label = [sci2exp(1)]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } MATDIV.prototype.details = function MATDIV() { + return this.x; } MATDIV.prototype.get = function MATDIV() { } MATDIV.prototype.set = function MATDIV() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,exprs] = scicos_getvalue("Set MATDIV Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "mat_div"; - ot = 1; - it = [1,1]; - } else if ((typ==2)) { - function_name = "matz_div"; - ot = 2; - it = [2,2]; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - funtyp = 4; - if (ok) { - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,exprs] = scicos_getvalue("Set MATDIV Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "mat_div"; + ot = 1; + it = [1,1]; + } else if ((typ==2)) { + function_name = "matz_div"; + ot = 2; + it = [2,2]; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + funtyp = 4; + if (ok) { + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATDIV.pickle b/js/MatrixOp/MATDIV.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATDIV.pickle +++ b/js/MatrixOp/MATDIV.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATEIG.js b/js/MatrixOp/MATEIG.js index e4925787..5cda9f2a 100644 --- a/js/MatrixOp/MATEIG.js +++ b/js/MatrixOp/MATEIG.js @@ -22,71 +22,72 @@ function MATEIG() { model.dep_ut = [true,false]; label = [[sci2exp(1)],[sci2exp(1)]]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } MATEIG.prototype.details = function MATEIG() { + return this.x; } MATEIG.prototype.get = function MATEIG() { } MATEIG.prototype.set = function MATEIG() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,decomptyp,lab] = scicos_getvalue("Set MATEIG block parameters",[["Datatype(1=real double 2=Complex)"],["decomposition type (1=eig values 2=eig values+eig vectors"]],list("vec",1,"vec",1),label); - if (!ok) { -break; -} - label = lab; - if ((typ==1)) { - if ((decomptyp==1)) { - function_name = "mat_vps"; - out = [-1,1]; - ot = 2; - } else if ((decomptyp==2)) { - function_name = "mat_vpv"; - out = [[-1,-1],[-1,-1]]; - ot = [2,2]; - } else { -message("decomposition type is not supported"); - ok = false; -} - it = 1; - } else if ((typ==2)) { - if ((decomptyp==1)) { - function_name = "matz_vps"; - out = [-1,1]; - ot = 2; - } else if ((decomptyp==2)) { - function_name = "matz_vpv"; - out = [[-1,-1],[-1,-1]]; - ot = [2,2]; - } else { -message("decomposition type is not supported"); - ok = false; -} - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [-1,-1]; - funtyp = 4; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - model.sim = list(function_name,funtyp); - arg1.model = model; - graphics.exprs = label; - arg1.graphics = graphics; - x = arg1; -break; -} -} + [ok,typ,decomptyp,lab] = scicos_getvalue("Set MATEIG block parameters",[["Datatype(1=real double 2=Complex)"],["decomposition type (1=eig values 2=eig values+eig vectors"]],list("vec",1,"vec",1),label); + if (!ok) { + break; + } + label = lab; + if ((typ==1)) { + if ((decomptyp==1)) { + function_name = "mat_vps"; + out = [-1,1]; + ot = 2; + } else if ((decomptyp==2)) { + function_name = "mat_vpv"; + out = [[-1,-1],[-1,-1]]; + ot = [2,2]; + } else { + message("decomposition type is not supported"); + ok = false; + } + it = 1; + } else if ((typ==2)) { + if ((decomptyp==1)) { + function_name = "matz_vps"; + out = [-1,1]; + ot = 2; + } else if ((decomptyp==2)) { + function_name = "matz_vpv"; + out = [[-1,-1],[-1,-1]]; + ot = [2,2]; + } else { + message("decomposition type is not supported"); + ok = false; + } + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [-1,-1]; + funtyp = 4; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + model.sim = list(function_name,funtyp); + arg1.model = model; + graphics.exprs = label; + arg1.graphics = graphics; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATEIG.pickle b/js/MatrixOp/MATEIG.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATEIG.pickle +++ b/js/MatrixOp/MATEIG.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATEXPM.js b/js/MatrixOp/MATEXPM.js index d92b3b1f..0c9e22ef 100644 --- a/js/MatrixOp/MATEXPM.js +++ b/js/MatrixOp/MATEXPM.js @@ -22,50 +22,51 @@ function MATEXPM() { model.dep_ut = [true,false]; label = [sci2exp(1)]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } MATEXPM.prototype.details = function MATEXPM() { + return this.x; } MATEXPM.prototype.get = function MATEXPM() { } MATEXPM.prototype.set = function MATEXPM() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,exprs] = scicos_getvalue("Set EXPM Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "mat_expm"; - ot = 1; - it = 1; - } else if ((typ==2)) { - function_name = "matz_expm"; - ot = 2; - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - funtyp = 4; - if (ok) { - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,exprs] = scicos_getvalue("Set EXPM Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "mat_expm"; + ot = 1; + it = 1; + } else if ((typ==2)) { + function_name = "matz_expm"; + ot = 2; + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + funtyp = 4; + if (ok) { + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATEXPM.pickle b/js/MatrixOp/MATEXPM.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATEXPM.pickle +++ b/js/MatrixOp/MATEXPM.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATINV.js b/js/MatrixOp/MATINV.js index dbccd957..f260f75b 100644 --- a/js/MatrixOp/MATINV.js +++ b/js/MatrixOp/MATINV.js @@ -22,50 +22,51 @@ function MATINV() { model.dep_ut = [true,false]; label = [sci2exp(1)]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } MATINV.prototype.details = function MATINV() { + return this.x; } MATINV.prototype.get = function MATINV() { } MATINV.prototype.set = function MATINV() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,exprs] = scicos_getvalue("Set MATINV Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "mat_inv"; - ot = 1; - it = 1; - } else if ((typ==2)) { - function_name = "matz_inv"; - ot = 2; - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - funtyp = 4; - if (ok) { - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,exprs] = scicos_getvalue("Set MATINV Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "mat_inv"; + ot = 1; + it = 1; + } else if ((typ==2)) { + function_name = "matz_inv"; + ot = 2; + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + funtyp = 4; + if (ok) { + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATINV.pickle b/js/MatrixOp/MATINV.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATINV.pickle +++ b/js/MatrixOp/MATINV.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATLU.js b/js/MatrixOp/MATLU.js index bcf94fae..24f53803 100644 --- a/js/MatrixOp/MATLU.js +++ b/js/MatrixOp/MATLU.js @@ -22,48 +22,49 @@ function MATLU() { model.dep_ut = [true,false]; label = sci2exp(1); gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } MATLU.prototype.details = function MATLU() { + return this.x; } MATLU.prototype.get = function MATLU() { } MATLU.prototype.set = function MATLU() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,lab] = scicos_getvalue("Set MATLU block parameters",["Datatype(1=real double 2=Complex)"],list("vec",1),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "mat_lu"; - ot = [1,1]; - it = 1; - } else if ((typ==2)) { - function_name = "matz_lu"; - ot = [2,2]; - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list([model.in1,model.in2],it),list([model.out,model.out2],ot),[],[]); -} - if (ok) { - funtyp = 4; - model.sim = list(function_name,funtyp); - graphics.exprs = lab; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,typ,lab] = scicos_getvalue("Set MATLU block parameters",["Datatype(1=real double 2=Complex)"],list("vec",1),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "mat_lu"; + ot = [1,1]; + it = 1; + } else if ((typ==2)) { + function_name = "matz_lu"; + ot = [2,2]; + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([model.in1,model.in2],it),list([model.out,model.out2],ot),[],[]); + } + if (ok) { + funtyp = 4; + model.sim = list(function_name,funtyp); + graphics.exprs = lab; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/MatrixOp/MATLU.pickle b/js/MatrixOp/MATLU.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATLU.pickle +++ b/js/MatrixOp/MATLU.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATMAGPHI.js b/js/MatrixOp/MATMAGPHI.js index e33aded1..4716d263 100644 --- a/js/MatrixOp/MATMAGPHI.js +++ b/js/MatrixOp/MATMAGPHI.js @@ -22,54 +22,55 @@ function MATMAGPHI() { model.dep_ut = [true,false]; label = [sci2exp(1)]; gr_i = []; - x = standard_define([3,2],model,label,gr_i); + this.x = standard_define([3,2],model,label,gr_i); } MATMAGPHI.prototype.details = function MATMAGPHI() { + return this.x; } MATMAGPHI.prototype.get = function MATMAGPHI() { } MATMAGPHI.prototype.set = function MATMAGPHI() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,decomptyp,lab] = scicos_getvalue("Set MATMAGPHI block parameters",["decomposition type (1=Complex2MAG&PHI 2=MAG&PHI2Complex)"],list("vec",1),label); - if (!ok) { -break; -} - label = lab; - if ((decomptyp==1)) { - function_name = "matz_abs"; - in1 = [-1,-2]; - it = 2; - out = [[-1,-2],[-1,-2]]; - ot = [1,1]; - } else if ((decomptyp==2)) { - function_name = "matz_absc"; - in1 = [[-1,-2],[-1,-2]]; - it = [1,1]; - out = [-1,-2]; - ot = 2; - } else { -message("decomposition type is not supported"); - ok = false; -} - funtyp = 4; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - model.sim = list(function_name,funtyp); - arg1.model = model; - graphics.exprs = label; - arg1.graphics = graphics; - x = arg1; -break; -} -} + [ok,decomptyp,lab] = scicos_getvalue("Set MATMAGPHI block parameters",["decomposition type (1=Complex2MAG&PHI 2=MAG&PHI2Complex)"],list("vec",1),label); + if (!ok) { + break; + } + label = lab; + if ((decomptyp==1)) { + function_name = "matz_abs"; + in1 = [-1,-2]; + it = 2; + out = [[-1,-2],[-1,-2]]; + ot = [1,1]; + } else if ((decomptyp==2)) { + function_name = "matz_absc"; + in1 = [[-1,-2],[-1,-2]]; + it = [1,1]; + out = [-1,-2]; + ot = 2; + } else { + message("decomposition type is not supported"); + ok = false; + } + funtyp = 4; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + model.sim = list(function_name,funtyp); + arg1.model = model; + graphics.exprs = label; + arg1.graphics = graphics; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATMAGPHI.pickle b/js/MatrixOp/MATMAGPHI.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATMAGPHI.pickle +++ b/js/MatrixOp/MATMAGPHI.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATMUL.js b/js/MatrixOp/MATMUL.js index 26740490..0d8657b1 100644 --- a/js/MatrixOp/MATMUL.js +++ b/js/MatrixOp/MATMUL.js @@ -11,141 +11,142 @@ function MATMUL() { model.ipar = 1; label = [sci2exp(model.ipar)]; gr_i = []; - x = standard_define([3,2],model,label,gr_i); + this.x = standard_define([3,2],model,label,gr_i); } MATMUL.prototype.details = function MATMUL() { + return this.x; } MATMUL.prototype.get = function MATMUL() { } MATMUL.prototype.set = function MATMUL() { - x = arg1; - graphics = x.graphics; + this.x = arg1; + graphics = this.x.graphics; label = graphics.exprs; - model = x.model; + model = this.x.model; if (model.ipar==[]) { - model.ipar = 1; -} + model.ipar = 1; + } if (size(label,"*")==1) { - label[2-1] = sci2exp(1); -} + label[2-1] = sci2exp(1); + } if (size(label,"*")==2) { - label[3-1] = sci2exp(1); -} + label[3-1] = sci2exp(1); + } while (true) { - [ok,dtype,rule,np,exprs] = scicos_getvalue([["Set MATMUL parameter"],["For the Multipication rule:"],[" 1= Matrix by Matrix"],[" 2= Matrix by Matrix element wise "],[" 3= Matrix by Scalar"],["In the third case the second input will be the scalar"]],[["Datatype(1=real double 2=Complex 3=int32 ...)"],["Multiplication rule"],["Do on Overflow(0=Nothing 1=Saturate 2=Error)"]],list("vec",1,"vec",1,"vec",1),label); - if (!ok) { -break; -} - rule = int(rule); - if ((dtype<1||dtype>8)) { -message("type is not supported"); - ok = false; -} - if ((rule<1||rule>3)) { -message("Multiplication rule must be only 1,2 or 3"); - ok = false; -} - if ((dtype==1||dtype==2)) { - np = 0; -} - TABMIN = [[0],[0],[-(2^31)],[-(2^15)],[-(2^7)],[0],[0],[0]]; - TABMAX = [[0],[0],[(2^31)-1],[(2^15)-1],[(2^7)-1],[(2^32)-1],[(2^16)-1],[(2^8)-1]]; - if (rule==2) { - if (np==0) { - model.sim = list("matmul2_m",4); - } else if (np==1) { - model.sim = list("matmul2_s",4); - } else { - model.sim = list("matmul2_e",4); -} - } else if (rule==3) { - if (np==0) { - model.sim = list("matbyscal",4); - } else if (np==1) { - model.sim = list("matbyscal_s",4); - } else { - model.sim = list("matbyscal_e",4); -} - } else { - if ((dtype==1)) { - model.sim = list("matmul_m",4); - } else if ((dtype==2)) { - model.sim = list("matzmul_m",4); - } else if (dtype==3) { - if (np==0) { - model.sim = list("matmul_i32n",4); - } else if (np==1) { - model.sim = list("matmul_i32s",4); - } else { - model.sim = list("matmul_i32e",4); -} - } else if (dtype==4) { - if (np==0) { - model.sim = list("matmul_i16n",4); - } else if (np==1) { - model.sim = list("matmul_i16s",4); - } else { - model.sim = list("matmul_i16e",4); -} - } else if (dtype==5) { - if (np==0) { - model.sim = list("matmul_i8n",4); - } else if (np==1) { - model.sim = list("matmul_i8s",4); - } else { - model.sim = list("matmul_i8e",4); -} - } else if (dtype==6) { - if (np==0) { - model.sim = list("matmul_ui32n",4); - } else if (np==1) { - model.sim = list("matmul_ui32s",4); - } else { - model.sim = list("matmul_ui32e",4); -} - } else if (dtype==7) { - if (np==0) { - model.sim = list("matmul_ui16n",4); - } else if (np==1) { - model.sim = list("matmul_ui16s",4); - } else { - model.sim = list("matmul_ui16e",4); -} - } else if (dtype==8) { - if (np==0) { - model.sim = list("matmul_ui8n",4); - } else if (np==1) { - model.sim = list("matmul_ui8s",4); - } else { - model.sim = list("matmul_ui8e",4); -} -} -} - kmin = TABMIN[dtype-1]; - kmax = TABMAX[dtype-1]; - it = dtype*ones(1,2); - ot = dtype; - if (rule==1) { - in1 = [[-1,-2],[-2,-3]]; - out = [-1,-3]; - } else if (rule==2) { - in1 = [[-1,-2],[-1,-2]]; - out = [-1,-2]; - } else { - in1 = [[-1,-2],[1,1]]; - out = [-1,-2]; -} - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - if (ok) { - label = exprs; - model.ipar = rule; - model.rpar = [[kmin],[kmax]]; - graphics.exprs = label; - x.graphics = graphics; - x.model = model; - arg1 = x; -break; -} -} + [ok,dtype,rule,np,exprs] = scicos_getvalue([["Set MATMUL parameter"],["For the Multipication rule:"],[" 1= Matrix by Matrix"],[" 2= Matrix by Matrix element wise "],[" 3= Matrix by Scalar"],["In the third case the second input will be the scalar"]],[["Datatype(1=real double 2=Complex 3=int32 ...)"],["Multiplication rule"],["Do on Overflow(0=Nothing 1=Saturate 2=Error)"]],list("vec",1,"vec",1,"vec",1),label); + if (!ok) { + break; + } + rule = int(rule); + if ((dtype<1||dtype>8)) { + message("type is not supported"); + ok = false; + } + if ((rule<1||rule>3)) { + message("Multiplication rule must be only 1,2 or 3"); + ok = false; + } + if ((dtype==1||dtype==2)) { + np = 0; + } + TABMIN = [[0],[0],[-(2^31)],[-(2^15)],[-(2^7)],[0],[0],[0]]; + TABMAX = [[0],[0],[(2^31)-1],[(2^15)-1],[(2^7)-1],[(2^32)-1],[(2^16)-1],[(2^8)-1]]; + if (rule==2) { + if (np==0) { + model.sim = list("matmul2_m",4); + } else if (np==1) { + model.sim = list("matmul2_s",4); + } else { + model.sim = list("matmul2_e",4); + } + } else if (rule==3) { + if (np==0) { + model.sim = list("matbyscal",4); + } else if (np==1) { + model.sim = list("matbyscal_s",4); + } else { + model.sim = list("matbyscal_e",4); + } + } else { + if ((dtype==1)) { + model.sim = list("matmul_m",4); + } else if ((dtype==2)) { + model.sim = list("matzmul_m",4); + } else if (dtype==3) { + if (np==0) { + model.sim = list("matmul_i32n",4); + } else if (np==1) { + model.sim = list("matmul_i32s",4); + } else { + model.sim = list("matmul_i32e",4); + } + } else if (dtype==4) { + if (np==0) { + model.sim = list("matmul_i16n",4); + } else if (np==1) { + model.sim = list("matmul_i16s",4); + } else { + model.sim = list("matmul_i16e",4); + } + } else if (dtype==5) { + if (np==0) { + model.sim = list("matmul_i8n",4); + } else if (np==1) { + model.sim = list("matmul_i8s",4); + } else { + model.sim = list("matmul_i8e",4); + } + } else if (dtype==6) { + if (np==0) { + model.sim = list("matmul_ui32n",4); + } else if (np==1) { + model.sim = list("matmul_ui32s",4); + } else { + model.sim = list("matmul_ui32e",4); + } + } else if (dtype==7) { + if (np==0) { + model.sim = list("matmul_ui16n",4); + } else if (np==1) { + model.sim = list("matmul_ui16s",4); + } else { + model.sim = list("matmul_ui16e",4); + } + } else if (dtype==8) { + if (np==0) { + model.sim = list("matmul_ui8n",4); + } else if (np==1) { + model.sim = list("matmul_ui8s",4); + } else { + model.sim = list("matmul_ui8e",4); + } + } + } + kmin = TABMIN[dtype-1]; + kmax = TABMAX[dtype-1]; + it = dtype*ones(1,2); + ot = dtype; + if (rule==1) { + in1 = [[-1,-2],[-2,-3]]; + out = [-1,-3]; + } else if (rule==2) { + in1 = [[-1,-2],[-1,-2]]; + out = [-1,-2]; + } else { + in1 = [[-1,-2],[1,1]]; + out = [-1,-2]; + } + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + if (ok) { + label = exprs; + model.ipar = rule; + model.rpar = [[kmin],[kmax]]; + graphics.exprs = label; + this.x.graphics = graphics; + this.x.model = model; + arg1 = this.x; + break; + } + } } } diff --git a/js/MatrixOp/MATMUL.pickle b/js/MatrixOp/MATMUL.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATMUL.pickle +++ b/js/MatrixOp/MATMUL.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATPINV.js b/js/MatrixOp/MATPINV.js index 9344c72f..467ea072 100644 --- a/js/MatrixOp/MATPINV.js +++ b/js/MatrixOp/MATPINV.js @@ -22,50 +22,51 @@ function MATPINV() { model.dep_ut = [true,false]; label = [sci2exp(1)]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } MATPINV.prototype.details = function MATPINV() { + return this.x; } MATPINV.prototype.get = function MATPINV() { } MATPINV.prototype.set = function MATPINV() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,exprs] = scicos_getvalue("Set MATPINV Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "mat_pinv"; - ot = 1; - it = 1; - } else if ((typ==2)) { - function_name = "matz_pinv"; - ot = 2; - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - funtyp = 4; - if (ok) { - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,exprs] = scicos_getvalue("Set MATPINV Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "mat_pinv"; + ot = 1; + it = 1; + } else if ((typ==2)) { + function_name = "matz_pinv"; + ot = 2; + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + funtyp = 4; + if (ok) { + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATPINV.pickle b/js/MatrixOp/MATPINV.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATPINV.pickle +++ b/js/MatrixOp/MATPINV.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATRESH.js b/js/MatrixOp/MATRESH.js index c8ee4ff7..a20293de 100644 --- a/js/MatrixOp/MATRESH.js +++ b/js/MatrixOp/MATRESH.js @@ -22,75 +22,76 @@ function MATRESH() { model.dep_ut = [true,false]; label = [[sci2exp(1)],[sci2exp([1,1])],[sci2exp([1,1])]]; gr_i = []; - x = standard_define([3,2],model,label,gr_i); + this.x = standard_define([3,2],model,label,gr_i); } MATRESH.prototype.details = function MATRESH() { + return this.x; } MATRESH.prototype.get = function MATRESH() { } MATRESH.prototype.set = function MATRESH() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,l1,out,lab] = scicos_getvalue("Set MATRESH block parameters",[["Datatype(1=real double 2=Complex)","input size"],["output size desired"]],list("vec",-1,"vec",-1,"vec",-1),label); - if (!ok) { -break; -} - nout = size(out); - nin = size(l1); - if (nout==0) { -message("output must have at least one element"); - ok = false; -} - if (nin==0) { -message("input must have at least one element"); - ok = false; -} - if (ok) { - if (((out[1-1]>(l1[1-1]*l1[2-1])))) { -message("the first dimension of the output is too big"); - ok = false; -} - if (((out[2-1]>(l1[1-1]*l1[2-1])))) { -message("the second dimension of the output is too big"); - ok = false; -} - if ((((out[2-1]*out[1-1])>(l1[1-1]*l1[2-1])))) { -message("the dimensions of the output are too big"); - ok = false; -} -} - if ((typ==1)) { - function_name = "mat_reshape"; - ot = 1; - it = 1; - } else if ((typ==2)) { - function_name = "matz_reshape"; - ot = 2; - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - if (ok) { - label = lab; - [model,graphics,ok] = set_io(model,graphics,list(l1,it),list(out,ot),[],[]); -} - if (ok) { - funtyp = 4; - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} -needcompile=resume(needcompile) + [ok,typ,l1,out,lab] = scicos_getvalue("Set MATRESH block parameters",[["Datatype(1=real double 2=Complex)","input size"],["output size desired"]],list("vec",-1,"vec",-1,"vec",-1),label); + if (!ok) { + break; + } + nout = size(out); + nin = size(l1); + if (nout==0) { + message("output must have at least one element"); + ok = false; + } + if (nin==0) { + message("input must have at least one element"); + ok = false; + } + if (ok) { + if (((out[1-1]>(l1[1-1]*l1[2-1])))) { + message("the first dimension of the output is too big"); + ok = false; + } + if (((out[2-1]>(l1[1-1]*l1[2-1])))) { + message("the second dimension of the output is too big"); + ok = false; + } + if ((((out[2-1]*out[1-1])>(l1[1-1]*l1[2-1])))) { + message("the dimensions of the output are too big"); + ok = false; + } + } + if ((typ==1)) { + function_name = "mat_reshape"; + ot = 1; + it = 1; + } else if ((typ==2)) { + function_name = "matz_reshape"; + ot = 2; + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + if (ok) { + label = lab; + [model,graphics,ok] = set_io(model,graphics,list(l1,it),list(out,ot),[],[]); + } + if (ok) { + funtyp = 4; + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/MatrixOp/MATRESH.pickle b/js/MatrixOp/MATRESH.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATRESH.pickle +++ b/js/MatrixOp/MATRESH.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATSING.js b/js/MatrixOp/MATSING.js index 67c3170f..cd5daad6 100644 --- a/js/MatrixOp/MATSING.js +++ b/js/MatrixOp/MATSING.js @@ -22,74 +22,75 @@ function MATSING() { model.dep_ut = [true,false]; label = [[sci2exp(1)],[sci2exp(1)]]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } MATSING.prototype.details = function MATSING() { + return this.x; } MATSING.prototype.get = function MATSING() { } MATSING.prototype.set = function MATSING() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,decomptyp,lab] = scicos_getvalue("Set MATSVD block parameters",[["Datatype(1=real double 2=Complex)"],["decomposition type (1=singular values 2=sing values+matrix U & V)"]],list("vec",1,"vec",1),label); - if (!ok) { -break; -} - label = lab; - if ((typ==1)) { - if ((decomptyp==1)) { - function_name = "mat_sing"; - in1 = [-1,-2]; - out = [-1,1]; - ot = 1; - } else if ((decomptyp==2)) { - function_name = "mat_svd"; - in1 = [-1,-2]; - out = [[-1,-1],[-1,-2],[-2,-2]]; - ot = [1,1,1]; - } else { -message("decomposition type is not supported"); - ok = false; -} - it = 1; - } else if ((typ==2)) { - if ((decomptyp==1)) { - function_name = "matz_sing"; - in1 = [-1,-2]; - out = [-1,1]; - ot = 1; - } else if ((decomptyp==2)) { - function_name = "matz_svd"; - in1 = [-1,-2]; - out = [[-1,-1],[-1,-2],[-2,-2]]; - ot = [2,1,2]; - } else { -message("decomposition type is not supported"); - ok = false; -} - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - funtyp = 4; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - model.sim = list(function_name,funtyp); - arg1.model = model; - graphics.exprs = label; - arg1.graphics = graphics; - x = arg1; -break; -} -} + [ok,typ,decomptyp,lab] = scicos_getvalue("Set MATSVD block parameters",[["Datatype(1=real double 2=Complex)"],["decomposition type (1=singular values 2=sing values+matrix U & V)"]],list("vec",1,"vec",1),label); + if (!ok) { + break; + } + label = lab; + if ((typ==1)) { + if ((decomptyp==1)) { + function_name = "mat_sing"; + in1 = [-1,-2]; + out = [-1,1]; + ot = 1; + } else if ((decomptyp==2)) { + function_name = "mat_svd"; + in1 = [-1,-2]; + out = [[-1,-1],[-1,-2],[-2,-2]]; + ot = [1,1,1]; + } else { + message("decomposition type is not supported"); + ok = false; + } + it = 1; + } else if ((typ==2)) { + if ((decomptyp==1)) { + function_name = "matz_sing"; + in1 = [-1,-2]; + out = [-1,1]; + ot = 1; + } else if ((decomptyp==2)) { + function_name = "matz_svd"; + in1 = [-1,-2]; + out = [[-1,-1],[-1,-2],[-2,-2]]; + ot = [2,1,2]; + } else { + message("decomposition type is not supported"); + ok = false; + } + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + funtyp = 4; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + model.sim = list(function_name,funtyp); + arg1.model = model; + graphics.exprs = label; + arg1.graphics = graphics; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATSING.pickle b/js/MatrixOp/MATSING.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATSING.pickle +++ b/js/MatrixOp/MATSING.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATSUM.js b/js/MatrixOp/MATSUM.js index 35256aa1..894c5a97 100644 --- a/js/MatrixOp/MATSUM.js +++ b/js/MatrixOp/MATSUM.js @@ -22,75 +22,76 @@ function MATSUM() { model.dep_ut = [true,false]; label = [[sci2exp(1)],[sci2exp(0)]]; gr_i = []; - x = standard_define([3,2],model,label,gr_i); + this.x = standard_define([3,2],model,label,gr_i); } MATSUM.prototype.details = function MATSUM() { + return this.x; } MATSUM.prototype.get = function MATSUM() { } MATSUM.prototype.set = function MATSUM() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,decomptyp,lab] = scicos_getvalue("Set MATSUM block parameters",[["Datatype(1=real double 2=Complex)"],["Sum along (0=all 1=lines 2=Columns)"]],list("vec",1,"vec",1),label); - if (!ok) { -break; -} - label = lab; - if ((typ==1)) { - if ((decomptyp==0)) { - function_name = "mat_sum"; - out = [1,1]; - } else if ((decomptyp==2)) { - function_name = "mat_suml"; - out = [-1,1]; - } else if ((decomptyp==1)) { - function_name = "mat_sumc"; - out = [1,-2]; - } else { -message("decomposition type is not supported"); - ok = false; -} - it = 1; - ot = 1; - } else if ((typ==2)) { - if ((decomptyp==0)) { - function_name = "matz_sum"; - out = [1,1]; - } else if ((decomptyp==2)) { - function_name = "matz_suml"; - out = [-1,1]; - } else if ((decomptyp==1)) { - function_name = "matz_sumc"; - out = [1,-2]; - } else { -message("decomposition type is not supported"); - ok = false; -} - it = 2; - ot = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [model.in1,model.in2]; - funtyp = 4; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - model.sim = list(function_name,funtyp); - arg1.model = model; - graphics.exprs = label; - arg1.graphics = graphics; - x = arg1; -break; -} -} + [ok,typ,decomptyp,lab] = scicos_getvalue("Set MATSUM block parameters",[["Datatype(1=real double 2=Complex)"],["Sum along (0=all 1=lines 2=Columns)"]],list("vec",1,"vec",1),label); + if (!ok) { + break; + } + label = lab; + if ((typ==1)) { + if ((decomptyp==0)) { + function_name = "mat_sum"; + out = [1,1]; + } else if ((decomptyp==2)) { + function_name = "mat_suml"; + out = [-1,1]; + } else if ((decomptyp==1)) { + function_name = "mat_sumc"; + out = [1,-2]; + } else { + message("decomposition type is not supported"); + ok = false; + } + it = 1; + ot = 1; + } else if ((typ==2)) { + if ((decomptyp==0)) { + function_name = "matz_sum"; + out = [1,1]; + } else if ((decomptyp==2)) { + function_name = "matz_suml"; + out = [-1,1]; + } else if ((decomptyp==1)) { + function_name = "matz_sumc"; + out = [1,-2]; + } else { + message("decomposition type is not supported"); + ok = false; + } + it = 2; + ot = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [model.in1,model.in2]; + funtyp = 4; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + model.sim = list(function_name,funtyp); + arg1.model = model; + graphics.exprs = label; + arg1.graphics = graphics; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATSUM.pickle b/js/MatrixOp/MATSUM.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATSUM.pickle +++ b/js/MatrixOp/MATSUM.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATTRAN.js b/js/MatrixOp/MATTRAN.js index b55aa3c3..4cef2ada 100644 --- a/js/MatrixOp/MATTRAN.js +++ b/js/MatrixOp/MATTRAN.js @@ -10,54 +10,55 @@ function MATTRAN() { model.dep_ut = [true,false]; label = [sci2exp(1)]; gr_i = []; - x = standard_define([3,2],model,label,gr_i); + this.x = standard_define([3,2],model,label,gr_i); } MATTRAN.prototype.details = function MATTRAN() { + return this.x; } MATTRAN.prototype.get = function MATTRAN() { } MATTRAN.prototype.set = function MATTRAN() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==1) { - label[2-1] = sci2exp(1); -} + label[2-1] = sci2exp(1); + } while (true) { - [ok,typ,rule,exprs] = scicos_getvalue("Set MATTRAN Block",[["Datatype(1=real double 2=Complex)"],["rule (1=.\' 2=\')"]],list("vec",1,"vec",1),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "mattran_m"; - ot = 1; - it = 1; - } else if ((typ==2)) { - if (rule==1) { - function_name = "matztran_m"; - } else { - function_name = "mathermit_m"; -} - ot = 2; - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - funtyp = 4; - if (ok) { - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,rule,exprs] = scicos_getvalue("Set MATTRAN Block",[["Datatype(1=real double 2=Complex)"],["rule (1=.\' 2=\')"]],list("vec",1,"vec",1),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "mattran_m"; + ot = 1; + it = 1; + } else if ((typ==2)) { + if (rule==1) { + function_name = "matztran_m"; + } else { + function_name = "mathermit_m"; + } + ot = 2; + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + funtyp = 4; + if (ok) { + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATTRAN.pickle b/js/MatrixOp/MATTRAN.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATTRAN.pickle +++ b/js/MatrixOp/MATTRAN.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATZCONJ.js b/js/MatrixOp/MATZCONJ.js index 79a24c55..382a025c 100644 --- a/js/MatrixOp/MATZCONJ.js +++ b/js/MatrixOp/MATZCONJ.js @@ -22,13 +22,14 @@ function MATZCONJ() { model.dep_ut = [true,false]; label = []; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } MATZCONJ.prototype.details = function MATZCONJ() { + return this.x; } MATZCONJ.prototype.get = function MATZCONJ() { } MATZCONJ.prototype.set = function MATZCONJ() { - x = arg1; + this.x = arg1; } } diff --git a/js/MatrixOp/MATZCONJ.pickle b/js/MatrixOp/MATZCONJ.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATZCONJ.pickle +++ b/js/MatrixOp/MATZCONJ.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/MATZREIM.js b/js/MatrixOp/MATZREIM.js index b02e8e59..f332d237 100644 --- a/js/MatrixOp/MATZREIM.js +++ b/js/MatrixOp/MATZREIM.js @@ -22,54 +22,55 @@ function MATZREIM() { model.dep_ut = [true,false]; label = sci2exp(1); gr_i = []; - x = standard_define([3,2],model,label,gr_i); + this.x = standard_define([3,2],model,label,gr_i); } MATZREIM.prototype.details = function MATZREIM() { + return this.x; } MATZREIM.prototype.get = function MATZREIM() { } MATZREIM.prototype.set = function MATZREIM() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,decomptyp,lab] = scicos_getvalue("Set MATZREIM block parameters",["decomposition type (1=Complex2Real&Imag 2=Real&Imag2Complex)"],list("vec",1),label); - if (!ok) { -break; -} - label = lab; - if ((decomptyp==1)) { - function_name = "matz_reim"; - in1 = [-1,-2]; - it = 2; - out = [[-1,-2],[-1,-2]]; - ot = [1,1]; - } else if ((decomptyp==2)) { - function_name = "matz_reimc"; - in1 = [[-1,-2],[-1,-2]]; - it = [1,1]; - out = [-1,-2]; - ot = 2; - } else { -message("decomposition type is not supported"); - ok = false; -} - funtyp = 4; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - model.sim = list(function_name,funtyp); - arg1.model = model; - graphics.exprs = label; - arg1.graphics = graphics; - x = arg1; -break; -} -} + [ok,decomptyp,lab] = scicos_getvalue("Set MATZREIM block parameters",["decomposition type (1=Complex2Real&Imag 2=Real&Imag2Complex)"],list("vec",1),label); + if (!ok) { + break; + } + label = lab; + if ((decomptyp==1)) { + function_name = "matz_reim"; + in1 = [-1,-2]; + it = 2; + out = [[-1,-2],[-1,-2]]; + ot = [1,1]; + } else if ((decomptyp==2)) { + function_name = "matz_reimc"; + in1 = [[-1,-2],[-1,-2]]; + it = [1,1]; + out = [-1,-2]; + ot = 2; + } else { + message("decomposition type is not supported"); + ok = false; + } + funtyp = 4; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + model.sim = list(function_name,funtyp); + arg1.model = model; + graphics.exprs = label; + arg1.graphics = graphics; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/MATZREIM.pickle b/js/MatrixOp/MATZREIM.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/MATZREIM.pickle +++ b/js/MatrixOp/MATZREIM.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/RICC.js b/js/MatrixOp/RICC.js index 048958fa..037c41eb 100644 --- a/js/MatrixOp/RICC.js +++ b/js/MatrixOp/RICC.js @@ -22,39 +22,40 @@ function RICC() { model.dep_ut = [true,false]; label = [[sci2exp(1)],[sci2exp(1)]]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } RICC.prototype.details = function RICC() { + return this.x; } RICC.prototype.get = function RICC() { } RICC.prototype.set = function RICC() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,tpe,mod,exprs] = scicos_getvalue("Set RICC Block",[["Type (1=Cont 2=Disc)"],["Model(1=Schr 2=sign(cont) inv(disc))"]],list("vec",1,"vec",1),label); - if (!ok) { -break; -} - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - it = [1,1,1]; - ot = 1; - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - if (ok) { - model.ipar = [[tpe],[mod]]; - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,tpe,mod,exprs] = scicos_getvalue("Set RICC Block",[["Type (1=Cont 2=Disc)"],["Model(1=Schr 2=sign(cont) inv(disc))"]],list("vec",1,"vec",1),label); + if (!ok) { + break; + } + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + it = [1,1,1]; + ot = 1; + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + if (ok) { + model.ipar = [[tpe],[mod]]; + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/RICC.pickle b/js/MatrixOp/RICC.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/RICC.pickle +++ b/js/MatrixOp/RICC.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/ROOTCOEF.js b/js/MatrixOp/ROOTCOEF.js index 95702c64..8e968567 100644 --- a/js/MatrixOp/ROOTCOEF.js +++ b/js/MatrixOp/ROOTCOEF.js @@ -22,50 +22,51 @@ function ROOTCOEF() { model.dep_ut = [true,false]; label = [[sci2exp(1)],[sci2exp(1)]]; gr_i = []; - x = standard_define([3,2],model,label,gr_i); + this.x = standard_define([3,2],model,label,gr_i); } ROOTCOEF.prototype.details = function ROOTCOEF() { + return this.x; } ROOTCOEF.prototype.get = function ROOTCOEF() { } ROOTCOEF.prototype.set = function ROOTCOEF() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,typ,inp,exprs] = scicos_getvalue("Set ROOTCOEF Block",[["Datatype(1=real double 2=Complex)"],["input row size"]],list("vec",1,"vec",1),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "root_coef"; - ot = 1; - it = 1; - } else if ((typ==2)) { - function_name = "rootz_coef"; - ot = 2; - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - in1 = [inp,model.in2]; - out = [inp+1,model.out2]; - funtyp = 4; - if (ok) { - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,inp,exprs] = scicos_getvalue("Set ROOTCOEF Block",[["Datatype(1=real double 2=Complex)"],["input row size"]],list("vec",1,"vec",1),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "root_coef"; + ot = 1; + it = 1; + } else if ((typ==2)) { + function_name = "rootz_coef"; + ot = 2; + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + in1 = [inp,model.in2]; + out = [inp+1,model.out2]; + funtyp = 4; + if (ok) { + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/ROOTCOEF.pickle b/js/MatrixOp/ROOTCOEF.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/ROOTCOEF.pickle +++ b/js/MatrixOp/ROOTCOEF.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/SQRT.js b/js/MatrixOp/SQRT.js index b235782c..f686b27a 100644 --- a/js/MatrixOp/SQRT.js +++ b/js/MatrixOp/SQRT.js @@ -12,45 +12,46 @@ function SQRT() { model.dep_ut = [true,false]; label = [sci2exp(1)]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } SQRT.prototype.details = function SQRT() { + return this.x; } SQRT.prototype.get = function SQRT() { } SQRT.prototype.set = function SQRT() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; while (true) { - [ok,typ,exprs] = scicos_getvalue("Set SQRT Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "mat_sqrt"; - } else if ((typ==2)) { - function_name = "matz_sqrt"; - } else { -message("type is not supported"); - ok = false; -} - it = typ; - ot = typ; - in1 = [model.in1,model.in2]; - out = [model.out,model.out2]; - funtyp = 4; - if (ok) { - label = exprs; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,exprs] = scicos_getvalue("Set SQRT Block",["Datatype(1=real double 2=Complex)"],list("vec",1),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "mat_sqrt"; + } else if ((typ==2)) { + function_name = "matz_sqrt"; + } else { + message("type is not supported"); + ok = false; + } + it = typ; + ot = typ; + in1 = [model.in1,model.in2]; + out = [model.out,model.out2]; + funtyp = 4; + if (ok) { + label = exprs; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/SQRT.pickle b/js/MatrixOp/SQRT.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/SQRT.pickle +++ b/js/MatrixOp/SQRT.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/MatrixOp/SUBMAT.js b/js/MatrixOp/SUBMAT.js index 3f896eaf..a797b764 100644 --- a/js/MatrixOp/SUBMAT.js +++ b/js/MatrixOp/SUBMAT.js @@ -22,71 +22,72 @@ function SUBMAT() { model.dep_ut = [true,false]; label = [[sci2exp(1)],[sci2exp(1)],[sci2exp(1)],[sci2exp(1)],[sci2exp(1)]]; gr_i = []; - x = standard_define([2.5,2],model,label,gr_i); + this.x = standard_define([2.5,2],model,label,gr_i); } SUBMAT.prototype.details = function SUBMAT() { + return this.x; } SUBMAT.prototype.get = function SUBMAT() { } SUBMAT.prototype.set = function SUBMAT() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; if (size(label,"*")==5) { - label[6-1] = sci2exp([1,1]); -} + label[6-1] = sci2exp([1,1]); + } while (true) { - [ok,typ,a,b,c,d,inp,exprs] = scicos_getvalue("Set SUBMAT Block",[["Datatype (1=real double 2=Complex)"],["Starting Row Index"],["Ending Row Index"],["Starting Column Index"],["Ending Column Index"],["Input Dimensions"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",2),label); - if (!ok) { -break; -} - if ((typ==1)) { - function_name = "submat"; - ot = 1; - it = 1; - } else if ((typ==2)) { - function_name = "submatz"; - ot = 2; - it = 2; - } else { -message("Datatype is not supported"); - ok = false; -} - if ((a<=0)||(b<=0)||(c<=0)||(d<=0)) { -message("invalid index"); - ok = false; -} - if (binp[1-1]) { -message("index of ending row is out of range"); - ok = false; -} - if (d>inp[2-1]) { -message("index of ending column is out of range"); - ok = false; -} - model.ipar = [[a],[b],[c],[d]]; - in1 = [inp[1-1],inp[2-1]]; - out = [(b-a)+1,(d-c)+1]; - funtyp = 4; - label = exprs; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - model.sim = list(function_name,funtyp); - graphics.exprs = label; - arg1.graphics = graphics; - arg1.model = model; - x = arg1; -break; -} -} + [ok,typ,a,b,c,d,inp,exprs] = scicos_getvalue("Set SUBMAT Block",[["Datatype (1=real double 2=Complex)"],["Starting Row Index"],["Ending Row Index"],["Starting Column Index"],["Ending Column Index"],["Input Dimensions"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",2),label); + if (!ok) { + break; + } + if ((typ==1)) { + function_name = "submat"; + ot = 1; + it = 1; + } else if ((typ==2)) { + function_name = "submatz"; + ot = 2; + it = 2; + } else { + message("Datatype is not supported"); + ok = false; + } + if ((a<=0)||(b<=0)||(c<=0)||(d<=0)) { + message("invalid index"); + ok = false; + } + if (binp[1-1]) { + message("index of ending row is out of range"); + ok = false; + } + if (d>inp[2-1]) { + message("index of ending column is out of range"); + ok = false; + } + model.ipar = [[a],[b],[c],[d]]; + in1 = [inp[1-1],inp[2-1]]; + out = [(b-a)+1,(d-c)+1]; + funtyp = 4; + label = exprs; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + model.sim = list(function_name,funtyp); + graphics.exprs = label; + arg1.graphics = graphics; + arg1.model = model; + this.x = arg1; + break; + } + } } } diff --git a/js/MatrixOp/SUBMAT.pickle b/js/MatrixOp/SUBMAT.pickle index 154645d8..0d1dde24 100644 --- a/js/MatrixOp/SUBMAT.pickle +++ b/js/MatrixOp/SUBMAT.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/AUTOMAT.js b/js/Misc/AUTOMAT.js index b46f9ce9..42d505f6 100644 --- a/js/Misc/AUTOMAT.js +++ b/js/Misc/AUTOMAT.js @@ -24,14 +24,15 @@ function AUTOMAT() { model.ipar = ipar; model.rpar = rpar; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } AUTOMAT.prototype.details = function AUTOMAT() { + return this.x; } AUTOMAT.prototype.get = function AUTOMAT() { } AUTOMAT.prototype.set = function AUTOMAT() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -39,96 +40,96 @@ function AUTOMAT() { NMode = ipar[1-1]; NX = ipar[3-1]; while (true) { - CX = "C1"; - MSG0 = "\'Jump from Mode "; - MSG2 = ":[..;M_final(Guard=In("; - MSG3 = ").i);..]\'"; - MSG = MSG0+"1"+MSG2+"1"+MSG3; - VEC = "\'mat\',[-1,1]"; -for (i=2;i<=NMode;i+=1) { - CX = CX+","+"C"+string(i); - MSG = MSG+";"+MSG0+string(i)+MSG2+string(i)+MSG3; - VEC = VEC+","+"\'mat\',[-1,1]"; -} - GTV = "[ok,NMode,Minitial,NX,X0,XP,"+CX+",exprs]=scicos_getvalue(\'Set Finite state machine model\', [\'Number (finite-state) Modes\';\'Initial Mode\';\'Number of continuous-time states\';\'Continuous-time states intial values\';\'Xproperties of continuous-time states in each Mode\';"+MSG+"], list(\'vec\',1,\'vec\',1,\'vec\',1,\'mat\',[-1,-1],\'mat\',[-1,-1],"+VEC+"),exprs)"; -execstr(GTV); - if (!this.ok) { -break; -} - NMode_old = size(exprs,"*")-5; - ModifEncore = false; - if ((NMode_old>NMode)) { - exprs.slice(NMode+6-1,NMode_old+5) = []; - ModifEncore = true; -} - if ((NMode_old1))) { -messagebox("Xproperty matrix is not valid: it should have NMode="+string(NMode)+" or 1 row(s)","modal","error"); - ModifEncore = true; - } else if ((rXP==1)) { -for (i=1;i<=NMode-1;i+=1) { - this.XP = [[this.XP],[this.XP[1-1].slice()]]; -} -} - if ((NMode_old==NMode)&&(!ModifEncore)) { - this.XP = matrix(transpose(this.XP),NMode*NX,1); - ipar = [[NMode],[this.Minitial],[NX],[this.XP]]; - rpar = matrix(this.X0,NX,1); - INP = ones(NMode,1); - if (NX>0) { - OUT = [[2],[2*NX]]; - } else { - OUT = [2]; -} - MaxModes = 1; - nzcross = 0; -for (i=1;i<=NMode;i+=1) { - Ci = evstr(exprs[5+i-1]); - ipar = [[ipar],[Ci]]; - INP[i-1][1-1] = 2*NX+length(Ci); - if ((nzcrossNMode) { -messagebox([["Number of Modes should be "+string(MaxModes)],["A destination Mode in Mode#"+string(imax)+"\'s targets is invalid!"]],"modal","error"); - ModifEncore = true; -} - if (MaxModesNMode)) { + exprs.slice(NMode+6-1,NMode_old+5) = []; + ModifEncore = true; + } + if ((NMode_old1))) { + messagebox("Xproperty matrix is not valid: it should have NMode="+string(NMode)+" or 1 row(s)","modal","error"); + ModifEncore = true; + } else if ((rXP==1)) { + for (i=1;i<=NMode-1;i+=1) { + this.XP = [[this.XP],[this.XP[1-1].slice()]]; + } + } + if ((NMode_old==NMode)&&(!ModifEncore)) { + this.XP = matrix(transpose(this.XP),NMode*NX,1); + ipar = [[NMode],[this.Minitial],[NX],[this.XP]]; + rpar = matrix(this.X0,NX,1); + INP = ones(NMode,1); + if (NX>0) { + OUT = [[2],[2*NX]]; + } else { + OUT = [2]; + } + MaxModes = 1; + nzcross = 0; + for (i=1;i<=NMode;i+=1) { + Ci = evstr(exprs[5+i-1]); + ipar = [[ipar],[Ci]]; + INP[i-1][1-1] = 2*NX+length(Ci); + if ((nzcrossNMode) { + messagebox([["Number of Modes should be "+string(MaxModes)],["A destination Mode in Mode#"+string(imax)+"\'s targets is invalid!"]],"modal","error"); + ModifEncore = true; + } + if (MaxModeswalls[2-1]) { - walls = walls[[2,1]-1]; -} - if (walls[3-1]>walls[3-1]) { - walls = walls[[3,4]-1]; -} - if (n!=size(y,"*")||n!=size(rpar1,"*")||n!=size(rpar2,"*")||n!=size(xd,"*")||n!=size(yd,"*")) { -message("All vectors must have equal size"); - ok = false; - } else if (!(min([[rpar1],[rpar2]])>0)) { -message("Mass and radius must be >0"); - ok = false; -} - if (!ok) { -break; -} - [model,graphics,ok] = check_io(model,graphics,[],[n,n],[],[]); - if (ok) { - k = 1; - ipar = []; -for (i=1;i<=n;i+=1) { -for (j=i+1;j<=n;j+=1) { - ipar[k-1] = i; - k = k+1; - ipar[k-1] = j; - k = k+1; -} -} - model.rpar = [[rpar1],[rpar2],[walls],[g],[C]]; - model.ipar = ipar; - state = [xt,xd,y,yd]; - state = transpose(state); - model.state = state.slice(); - model.nzcross = n*(n-1)/2+4*n; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,rpar1,rpar2,walls,xt,xd,y,yd,g,C,exprs] = scicos_getvalue(["Set Bounce Block"],[["Mass"],["Radius"],["[xmin,xmax,ymin,ymax]"],["xpos"],["xdpos"],["ypos"],["ydpos"],["g (gravity)"],["C (aerodynamic coeff"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + xt = xt.slice(); + y = y.slice(); + xd = xd.slice(); + yd = yd.slice(); + rpar1 = rpar1.slice(); + rpar2 = rpar2.slice(); + n = size(xt,"*"); + walls = walls.slice(); + if (walls[1-1]>walls[2-1]) { + walls = walls[[2,1]-1]; + } + if (walls[3-1]>walls[3-1]) { + walls = walls[[3,4]-1]; + } + if (n!=size(y,"*")||n!=size(rpar1,"*")||n!=size(rpar2,"*")||n!=size(xd,"*")||n!=size(yd,"*")) { + message("All vectors must have equal size"); + ok = false; + } else if (!(min([[rpar1],[rpar2]])>0)) { + message("Mass and radius must be >0"); + ok = false; + } + if (!ok) { + break; + } + [model,graphics,ok] = check_io(model,graphics,[],[n,n],[],[]); + if (ok) { + k = 1; + ipar = []; + for (i=1;i<=n;i+=1) { + for (j=i+1;j<=n;j+=1) { + ipar[k-1] = i; + k = k+1; + ipar[k-1] = j; + k = k+1; + } + } + model.rpar = [[rpar1],[rpar2],[walls],[g],[C]]; + model.ipar = ipar; + state = [xt,xd,y,yd]; + state = transpose(state); + model.state = state.slice(); + model.nzcross = n*(n-1)/2+4*n; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Misc/BOUNCE.pickle b/js/Misc/BOUNCE.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/BOUNCE.pickle +++ b/js/Misc/BOUNCE.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/BOUNCEXY.js b/js/Misc/BOUNCEXY.js index f8845bfc..22e71214 100644 --- a/js/Misc/BOUNCEXY.js +++ b/js/Misc/BOUNCEXY.js @@ -16,14 +16,14 @@ function BOUNCEXY() { model.intyp = [[1],[1]]; model.evtin = 1; z = []; -for (i=1;i<=size(clrs,"*");i+=1) { - z[6*(i-1)+1-1] = 0; - z[6*(i-1)+2-1] = 0; - z[6*(i-1)+3-1] = 2*siz[i-1]; - z[6*(i-1)+4-1] = 2*siz[i-1]; - z[6*(i-1)+5-1] = 0.000; - z[6*(i-1)+6-1] = 64.0*360.000; -} + for (i=1;i<=size(clrs,"*");i+=1) { + z[6*(i-1)+1-1] = 0; + z[6*(i-1)+2-1] = 0; + z[6*(i-1)+3-1] = 2*siz[i-1]; + z[6*(i-1)+4-1] = 2*siz[i-1]; + z[6*(i-1)+5-1] = 0.000; + z[6*(i-1)+6-1] = 64.0*360.000; + } model.dstate = z; model.rpar = [[xmin],[xmax],[ymin],[ymax]]; model.ipar = [[win],[imode],[clrs.slice()]]; @@ -32,62 +32,63 @@ for (i=1;i<=size(clrs,"*");i+=1) { model.dep_ut = [false,false]; exprs = [[strcat(sci2exp(clrs))],[strcat(sci2exp(siz))],[strcat(sci2exp(win))],[strcat(sci2exp(1))],[strcat(sci2exp(xmin))],[strcat(sci2exp(xmax))],[strcat(sci2exp(ymin))],[strcat(sci2exp(ymax))]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } BOUNCEXY.prototype.details = function BOUNCEXY() { + return this.x; } BOUNCEXY.prototype.get = function BOUNCEXY() { } BOUNCEXY.prototype.set = function BOUNCEXY() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; dstate = model.dstate; while (true) { - [ok,clrs,siz,win,imode,xmin,xmax,ymin,ymax,exprs] = scicos_getvalue("Set Scope parameters",[["colors"],["radii"],["window number (-1 for automatic)"],["animation mode (0,1)"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(clrs,"*")!=size(siz,"*")) { - mess = [[mess],["colors and radii must have equal size (number of balls)"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (xmin>=xmax) { - mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - rpar = [[xmin],[xmax],[ymin],[ymax]]; - ipar = [[win],[imode],[clrs.slice()]]; - z = []; -for (i=1;i<=size(clrs,"*");i+=1) { - z[6*(i-1)+1-1] = 0; - z[6*(i-1)+2-1] = 0; - z[6*(i-1)+3-1] = 2*siz[i-1]; - z[6*(i-1)+4-1] = 2*siz[i-1]; - z[6*(i-1)+5-1] = 0.000; - z[6*(i-1)+6-1] = 64.0*360.000; -} - model.dstate = z; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,clrs,siz,win,imode,xmin,xmax,ymin,ymax,exprs] = scicos_getvalue("Set Scope parameters",[["colors"],["radii"],["window number (-1 for automatic)"],["animation mode (0,1)"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(clrs,"*")!=size(siz,"*")) { + mess = [[mess],["colors and radii must have equal size (number of balls)"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (xmin>=xmax) { + mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + rpar = [[xmin],[xmax],[ymin],[ymax]]; + ipar = [[win],[imode],[clrs.slice()]]; + z = []; + for (i=1;i<=size(clrs,"*");i+=1) { + z[6*(i-1)+1-1] = 0; + z[6*(i-1)+2-1] = 0; + z[6*(i-1)+3-1] = 2*siz[i-1]; + z[6*(i-1)+4-1] = 2*siz[i-1]; + z[6*(i-1)+5-1] = 0.000; + z[6*(i-1)+6-1] = 64.0*360.000; + } + model.dstate = z; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Misc/BOUNCEXY.pickle b/js/Misc/BOUNCEXY.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/BOUNCEXY.pickle +++ b/js/Misc/BOUNCEXY.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/BPLATFORM.js b/js/Misc/BPLATFORM.js index b0a0a517..c2798629 100644 --- a/js/Misc/BPLATFORM.js +++ b/js/Misc/BPLATFORM.js @@ -18,46 +18,47 @@ function BPLATFORM() { model.dep_ut = [false,false]; exprs = string(model.rpar); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } BPLATFORM.prototype.details = function BPLATFORM() { + return this.x; } BPLATFORM.prototype.get = function BPLATFORM() { } BPLATFORM.prototype.set = function BPLATFORM() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; dstate = model.dstate; while (true) { - [ok,plen,csiz,phi,xmin,xmax,ymin,ymax,exprs] = scicos_getvalue("Set Scope parameters",[["pendulum length"],["cart size (square side)"],["slope"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (plen<=0||csiz<=0) { - mess = [[mess],["Pendulum length and cart size must be positive."],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (xmin>=xmax) { - mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - rpar = [[plen],[csiz],[phi],[xmin],[xmax],[ymin],[ymax]]; - model.rpar = rpar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,plen,csiz,phi,xmin,xmax,ymin,ymax,exprs] = scicos_getvalue("Set Scope parameters",[["pendulum length"],["cart size (square side)"],["slope"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (plen<=0||csiz<=0) { + mess = [[mess],["Pendulum length and cart size must be positive."],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (xmin>=xmax) { + mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + rpar = [[plen],[csiz],[phi],[xmin],[xmax],[ymin],[ymax]]; + model.rpar = rpar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Misc/BPLATFORM.pickle b/js/Misc/BPLATFORM.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/BPLATFORM.pickle +++ b/js/Misc/BPLATFORM.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/CBLOCK.js b/js/Misc/CBLOCK.js index 42f8c884..d119c0bb 100644 --- a/js/Misc/CBLOCK.js +++ b/js/Misc/CBLOCK.js @@ -29,100 +29,101 @@ function CBLOCK() { model.nzcross = ng; label = list(transpose([funam,"n",sci2exp(in1),sci2exp(out),sci2exp(clkin),sci2exp(clkout),sci2exp(x0),sci2exp(0),sci2exp(z0),sci2exp(rpar),sci2exp(ipar),sci2exp(auto),"y","n"]),[]); gr_i = []; - x = standard_define([4,2],model,label,gr_i); + this.x = standard_define([4,2],model,label,gr_i); } CBLOCK.prototype.details = function CBLOCK() { + return this.x; } CBLOCK.prototype.get = function CBLOCK() { } CBLOCK.prototype.set = function CBLOCK() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; while (true) { - [ok,function_name,impli,i,o,ci,co,xx,ng,z,rpar,ipar,auto0,depu,dept,lab] = scicos_getvalue("Set C-Block2 block parameters",[["simulation function"],["is block implicit? (y,n)"],["input ports sizes"],["output ports sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["number of zero crossing surfaces"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"str",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%6)","str",1,"str",1),label[1-1]); - if (!ok) { -break; -} - label[1-1] = lab; - funam = stripblanks(function_name); - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - ipar = int(ipar.slice()); - nx = size(xx,1); - nz = size(z,1); - i = int(i.slice()); - o = int(o.slice()); - nout = size(o,1); - ci = int(ci.slice()); - nevin = size(ci,1); - co = int(co.slice()); - nevout = size(co,1); - if (part(impli,1)=="y") { - funtyp = 12004; - } else { - funtyp = 2004; -} - if ([[ci],[co]]!=[]) { - if (max([[ci],[co]])>1) { -message("vector event links not supported"); - ok = false; -} -} - depu = stripblanks(depu); - if (part(depu,1)=="y") { - depu = true; - } else { - depu = false; -} - dept = stripblanks(dept); - if (part(dept,1)=="y") { - dept = true; - } else { - dept = false; -} - dep_ut = [depu,dept]; - if (funam==" ") { -break; -} - if (model.sim[1-1]!=funam||sign(size(model.state,"*"))!=sign(nx)||sign(size(model.dstate,"*"))!=sign(nz)||model.nzcross!=ng||sign(size(model.evtout,"*"))!=sign(nevout)) { - tt = []; -} - tt = label[2-1]; - while (true) { - [ok,tt,cancel] = CFORTR2(funam,tt); - if (!ok) { - if (cancel) { -break; -} - } else { - [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); - if (ok) { - model.sim = list(funam,funtyp); - model.in1 = i; - model.out = o; - model.evtin = ci; - model.evtout = co; - model.state = xx; - model.dstate = z; - model.rpar = rpar; - model.ipar = ipar; - model.firing = auto0; - model.dep_ut = dep_ut; - model.nzcross = ng; - label[2-1] = tt; - x.model = model; - graphics.exprs = label; - x.graphics = graphics; -break; -} -} -} - if (ok||cancel) { -break; -} -} + [ok,function_name,impli,i,o,ci,co,xx,ng,z,rpar,ipar,auto0,depu,dept,lab] = scicos_getvalue("Set C-Block2 block parameters",[["simulation function"],["is block implicit? (y,n)"],["input ports sizes"],["output ports sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["number of zero crossing surfaces"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"str",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%6)","str",1,"str",1),label[1-1]); + if (!ok) { + break; + } + label[1-1] = lab; + funam = stripblanks(function_name); + xx = xx.slice(); + z = z.slice(); + rpar = rpar.slice(); + ipar = int(ipar.slice()); + nx = size(xx,1); + nz = size(z,1); + i = int(i.slice()); + o = int(o.slice()); + nout = size(o,1); + ci = int(ci.slice()); + nevin = size(ci,1); + co = int(co.slice()); + nevout = size(co,1); + if (part(impli,1)=="y") { + funtyp = 12004; + } else { + funtyp = 2004; + } + if ([[ci],[co]]!=[]) { + if (max([[ci],[co]])>1) { + message("vector event links not supported"); + ok = false; + } + } + depu = stripblanks(depu); + if (part(depu,1)=="y") { + depu = true; + } else { + depu = false; + } + dept = stripblanks(dept); + if (part(dept,1)=="y") { + dept = true; + } else { + dept = false; + } + dep_ut = [depu,dept]; + if (funam==" ") { + break; + } + if (model.sim[1-1]!=funam||sign(size(model.state,"*"))!=sign(nx)||sign(size(model.dstate,"*"))!=sign(nz)||model.nzcross!=ng||sign(size(model.evtout,"*"))!=sign(nevout)) { + tt = []; + } + tt = label[2-1]; + while (true) { + [ok,tt,cancel] = CFORTR2(funam,tt); + if (!ok) { + if (cancel) { + break; + } + } else { + [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); + if (ok) { + model.sim = list(funam,funtyp); + model.in1 = i; + model.out = o; + model.evtin = ci; + model.evtout = co; + model.state = xx; + model.dstate = z; + model.rpar = rpar; + model.ipar = ipar; + model.firing = auto0; + model.dep_ut = dep_ut; + model.nzcross = ng; + label[2-1] = tt; + this.x.model = model; + graphics.exprs = label; + this.x.graphics = graphics; + break; + } + } + } + if (ok||cancel) { + break; + } + } } } diff --git a/js/Misc/CBLOCK.pickle b/js/Misc/CBLOCK.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/CBLOCK.pickle +++ b/js/Misc/CBLOCK.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/CBLOCK4.js b/js/Misc/CBLOCK4.js index 92b58837..aa5861a4 100644 --- a/js/Misc/CBLOCK4.js +++ b/js/Misc/CBLOCK4.js @@ -13,98 +13,99 @@ function CBLOCK4() { model.dep_ut = [true,false]; label = list([[funam],["n"],[sci2exp([model.in1,model.in2])],[sci2exp(model.intyp)],[sci2exp([model.out,model.out2])],[sci2exp(model.outtyp)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.odstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.opar)],[sci2exp(model.nmode)],[sci2exp(model.nzcross)],[sci2exp(model.firing)],["y"],["n"]],[]); gr_i = []; - x = standard_define([4,2],model,label,gr_i); + this.x = standard_define([4,2],model,label,gr_i); } CBLOCK4.prototype.details = function CBLOCK4() { + return this.x; } CBLOCK4.prototype.get = function CBLOCK4() { } CBLOCK4.prototype.set = function CBLOCK4() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; while (true) { - [ok,function_name,impli,in1,it,out,ot,ci,co,xx,z,oz,rpar,ipar,opar,nmode,nzcr,auto0,depu,dept,lab] = scicos_getvalue("Set C-Block4 block parameters",[["Simulation function"],["Is block implicit? (y,n)"],["Input ports sizes"],["Input ports type"],["Output port sizes"],["Output ports type"],["Input event ports sizes"],["Output events ports sizes"],["Initial continuous state"],["Initial discrete state"],["Initial object state"],["Real parameters vector"],["Integer parameters vector"],["Object parameters list"],["Number of modes"],["Number of zero crossings"],["Initial firing vector (<0 for no firing)"],["Direct feedthrough (y or n)"],["Time dependence (y or n)"]],list("str",1,"str",1,"mat",[-1,2],"vec",-1,"mat",[-1,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"lis",-1,"vec",-1,"vec",-1,"lis",-1,"vec",1,"vec",1,"vec","sum(%8)","str",1,"str",1),label[1-1]); - if (!ok) { -break; -} - label[1-1] = lab; - funam = stripblanks(function_name); - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - ipar = int(ipar.slice()); - nx = size(xx,1); - nz = size(z,1); - ci = int(ci.slice()); - nevin = size(ci,1); - co = int(co.slice()); - nevout = size(co,1); - if (part(impli,1)=="y") { - funtyp = 12004; - } else { - funtyp = 2004; -} - if ([[ci],[co]]!=[]) { - if (max([[ci],[co]])>1) { -message("vector event links not supported"); - ok = false; -} -} - if (ok) { - depu = stripblanks(depu); - if (part(depu,1)=="y") { - depu = true; - } else { - depu = false; -} - dept = stripblanks(dept); - if (part(dept,1)=="y") { - dept = true; - } else { - dept = false; -} - dep_ut = [depu,dept]; - if (funam==" ") { -break; -} - if (model.sim[1-1]!=funam||sign(size(model.state,"*"))!=sign(nx)||sign(size(model.dstate,"*"))!=sign(nz)||model.nzcross!=nzcr||sign(size(model.evtout,"*"))!=sign(nevout)) { - tt = []; -} - tt = label[2-1]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ci,co); -} - if (ok) { - while (true) { - [ok,tt,cancel] = this.CC4[funam-1][tt-1]; - if (!ok) { - if (cancel) { -break; -} - } else { - model.sim = list(funam,funtyp); - model.state = xx; - model.dstate = z; - model.odstate = oz; - model.rpar = rpar; - model.ipar = ipar; - model.opar = opar; - model.firing = auto0; - model.nzcross = nzcr; - model.nmode = nmode; - model.dep_ut = dep_ut; - label[2-1] = tt; - x.model = model; - graphics.exprs = label; - x.graphics = graphics; -break; -} -} - if (ok||cancel) { -break; -} -} -} + [ok,function_name,impli,in1,it,out,ot,ci,co,xx,z,oz,rpar,ipar,opar,nmode,nzcr,auto0,depu,dept,lab] = scicos_getvalue("Set C-Block4 block parameters",[["Simulation function"],["Is block implicit? (y,n)"],["Input ports sizes"],["Input ports type"],["Output port sizes"],["Output ports type"],["Input event ports sizes"],["Output events ports sizes"],["Initial continuous state"],["Initial discrete state"],["Initial object state"],["Real parameters vector"],["Integer parameters vector"],["Object parameters list"],["Number of modes"],["Number of zero crossings"],["Initial firing vector (<0 for no firing)"],["Direct feedthrough (y or n)"],["Time dependence (y or n)"]],list("str",1,"str",1,"mat",[-1,2],"vec",-1,"mat",[-1,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"lis",-1,"vec",-1,"vec",-1,"lis",-1,"vec",1,"vec",1,"vec","sum(%8)","str",1,"str",1),label[1-1]); + if (!ok) { + break; + } + label[1-1] = lab; + funam = stripblanks(function_name); + xx = xx.slice(); + z = z.slice(); + rpar = rpar.slice(); + ipar = int(ipar.slice()); + nx = size(xx,1); + nz = size(z,1); + ci = int(ci.slice()); + nevin = size(ci,1); + co = int(co.slice()); + nevout = size(co,1); + if (part(impli,1)=="y") { + funtyp = 12004; + } else { + funtyp = 2004; + } + if ([[ci],[co]]!=[]) { + if (max([[ci],[co]])>1) { + message("vector event links not supported"); + ok = false; + } + } + if (ok) { + depu = stripblanks(depu); + if (part(depu,1)=="y") { + depu = true; + } else { + depu = false; + } + dept = stripblanks(dept); + if (part(dept,1)=="y") { + dept = true; + } else { + dept = false; + } + dep_ut = [depu,dept]; + if (funam==" ") { + break; + } + if (model.sim[1-1]!=funam||sign(size(model.state,"*"))!=sign(nx)||sign(size(model.dstate,"*"))!=sign(nz)||model.nzcross!=nzcr||sign(size(model.evtout,"*"))!=sign(nevout)) { + tt = []; + } + tt = label[2-1]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ci,co); + } + if (ok) { + while (true) { + [ok,tt,cancel] = this.CC4[funam-1][tt-1]; + if (!ok) { + if (cancel) { + break; + } + } else { + model.sim = list(funam,funtyp); + model.state = xx; + model.dstate = z; + model.odstate = oz; + model.rpar = rpar; + model.ipar = ipar; + model.opar = opar; + model.firing = auto0; + model.nzcross = nzcr; + model.nmode = nmode; + model.dep_ut = dep_ut; + label[2-1] = tt; + this.x.model = model; + graphics.exprs = label; + this.x.graphics = graphics; + break; + } + } + if (ok||cancel) { + break; + } + } + } } } diff --git a/js/Misc/CBLOCK4.pickle b/js/Misc/CBLOCK4.pickle index 96223756..97b4636e 100644 --- a/js/Misc/CBLOCK4.pickle +++ b/js/Misc/CBLOCK4.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'CC4' +S'x' p2 -atp3 -Rp4 +aS'CC4' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Misc/CONSTRAINT2_c.js b/js/Misc/CONSTRAINT2_c.js index 4d755545..50012f65 100644 --- a/js/Misc/CONSTRAINT2_c.js +++ b/js/Misc/CONSTRAINT2_c.js @@ -14,59 +14,60 @@ function CONSTRAINT2_c() { model.dep_ut = [false,true]; exprs = list(strcat(sci2exp(x0)),strcat(sci2exp(xd0)),strcat(sci2exp(id))); gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } CONSTRAINT2_c.prototype.details = function CONSTRAINT2_c() { + return this.x; } CONSTRAINT2_c.prototype.get = function CONSTRAINT2_c() { } CONSTRAINT2_c.prototype.set = function CONSTRAINT2_c() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - ask_again = false; - [ok,x0,xd0,id,exprs] = scicos_getvalue("Set Constraint block parameters",[["Initial guess values of states x"],["Initial guess values of derivative x\'"],["Id(i)=1: if x\'(i) is present in the feedback, else Id(i)=0"]],list("vec",-1,"vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - x0 = x0.slice(); - N = size(x0,"*"); - xd0 = xd0.slice(); - Nxd = size(xd0,"*"); - id = id.slice(); - Nid = size(id,"*"); - if ((N!=Nxd)||(N!=Nid)) { -message("incompatible sizes, states, their derivatives, and ID should be the same size "); - ask_again = true; -} - if ((N<=0&&!ask_again)) { -x_message("number of states (constraints) must be > 0 "); - ask_again = true; -} - if ((!ask_again)) { -for (i=1;i<=N;i+=1) { - if (!((id[i-1]==0)||(id[i-1]==1))) { - ask_again = true; -x_message([["Id(i) must be either"],["0 when x\'(i) is not present in the feedback"],["1: when x\'(i) is present in the feedback"]]); -break; -} - if ((id[i-1]==0)) { - id[i-1] = -1; -} -} -} - if (!ask_again) { - graphics.exprs = exprs; - model.state = [[x0],[xd0]]; - model.out = [[N],[N]]; - model.in1 = N; - model.ipar = id; - x.graphics = graphics; - x.model = model; -break; -} -} + ask_again = false; + [ok,x0,xd0,id,exprs] = scicos_getvalue("Set Constraint block parameters",[["Initial guess values of states x"],["Initial guess values of derivative x\'"],["Id(i)=1: if x\'(i) is present in the feedback, else Id(i)=0"]],list("vec",-1,"vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + x0 = x0.slice(); + N = size(x0,"*"); + xd0 = xd0.slice(); + Nxd = size(xd0,"*"); + id = id.slice(); + Nid = size(id,"*"); + if ((N!=Nxd)||(N!=Nid)) { + message("incompatible sizes, states, their derivatives, and ID should be the same size "); + ask_again = true; + } + if ((N<=0&&!ask_again)) { + x_message("number of states (constraints) must be > 0 "); + ask_again = true; + } + if ((!ask_again)) { + for (i=1;i<=N;i+=1) { + if (!((id[i-1]==0)||(id[i-1]==1))) { + ask_again = true; + x_message([["Id(i) must be either"],["0 when x\'(i) is not present in the feedback"],["1: when x\'(i) is present in the feedback"]]); + break; + } + if ((id[i-1]==0)) { + id[i-1] = -1; + } + } + } + if (!ask_again) { + graphics.exprs = exprs; + model.state = [[x0],[xd0]]; + model.out = [[N],[N]]; + model.in1 = N; + model.ipar = id; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Misc/CONSTRAINT2_c.pickle b/js/Misc/CONSTRAINT2_c.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/CONSTRAINT2_c.pickle +++ b/js/Misc/CONSTRAINT2_c.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/CONSTRAINT_c.js b/js/Misc/CONSTRAINT_c.js index 40deaf9c..eba60cb5 100644 --- a/js/Misc/CONSTRAINT_c.js +++ b/js/Misc/CONSTRAINT_c.js @@ -12,39 +12,40 @@ function CONSTRAINT_c() { model.dep_ut = [false,true]; exprs = "0"; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } CONSTRAINT_c.prototype.details = function CONSTRAINT_c() { + return this.x; } CONSTRAINT_c.prototype.get = function CONSTRAINT_c() { } CONSTRAINT_c.prototype.set = function CONSTRAINT_c() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,x0,exprs] = scicos_getvalue("Set solver block parameters","Initial guess values",list("vec",-1),exprs); - if (!ok) { -break; -} - x0 = x0.slice(); - N = size(x0,"*"); - if (N<=0) { -message("number of states (constraints) must be > 0 "); - } else { - [model,graphics,ok] = check_io(model,graphics,N,N,[],[]); - if (ok) { - graphics.exprs = exprs; - model.state = [[x0],[zeros(N,1)]]; - model.out = N; - model.in1 = N; - model.ipar = -1*ones(N,1); - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,x0,exprs] = scicos_getvalue("Set solver block parameters","Initial guess values",list("vec",-1),exprs); + if (!ok) { + break; + } + x0 = x0.slice(); + N = size(x0,"*"); + if (N<=0) { + message("number of states (constraints) must be > 0 "); + } else { + [model,graphics,ok] = check_io(model,graphics,N,N,[],[]); + if (ok) { + graphics.exprs = exprs; + model.state = [[x0],[zeros(N,1)]]; + model.out = N; + model.in1 = N; + model.ipar = -1*ones(N,1); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Misc/CONSTRAINT_c.pickle b/js/Misc/CONSTRAINT_c.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/CONSTRAINT_c.pickle +++ b/js/Misc/CONSTRAINT_c.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/DEADBAND.js b/js/Misc/DEADBAND.js index c83ce6aa..45f7ee9d 100644 --- a/js/Misc/DEADBAND.js +++ b/js/Misc/DEADBAND.js @@ -15,39 +15,40 @@ function DEADBAND() { model.dep_ut = [true,false]; exprs = [[string(maxp)],[string(minp)],[string(model.nmode)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } DEADBAND.prototype.details = function DEADBAND() { + return this.x; } DEADBAND.prototype.get = function DEADBAND() { } DEADBAND.prototype.set = function DEADBAND() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,maxp,minp,zeroc,exprs] = scicos_getvalue("Set Deadband parameters",[["End of dead band"],["Start of dead band"],["zero crossing (0:no, 1:yes)"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (maxp<=minp) { -message("Upper limit must be > Lower limit"); - } else { - rpar = [[maxp],[minp]]; - model.rpar = rpar; - if (zeroc!=0) { - model.nzcross = 2; - model.nmode = 1; - } else { - model.nzcross = 0; - model.nmode = 0; -} - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,maxp,minp,zeroc,exprs] = scicos_getvalue("Set Deadband parameters",[["End of dead band"],["Start of dead band"],["zero crossing (0:no, 1:yes)"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (maxp<=minp) { + message("Upper limit must be > Lower limit"); + } else { + rpar = [[maxp],[minp]]; + model.rpar = rpar; + if (zeroc!=0) { + model.nzcross = 2; + model.nmode = 1; + } else { + model.nzcross = 0; + model.nmode = 0; + } + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Misc/DEADBAND.pickle b/js/Misc/DEADBAND.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/DEADBAND.pickle +++ b/js/Misc/DEADBAND.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/DEBUG.js b/js/Misc/DEBUG.js index 5ea59058..7c29a588 100644 --- a/js/Misc/DEBUG.js +++ b/js/Misc/DEBUG.js @@ -6,43 +6,44 @@ function DEBUG() { model.blocktype = "d"; exprs = list("","xcos_debug_gui(flag,block);"); gr_i = []; - x = standard_define([8,2],model,exprs,gr_i); + this.x = standard_define([8,2],model,exprs,gr_i); } DEBUG.prototype.details = function DEBUG() { + return this.x; } DEBUG.prototype.get = function DEBUG() { } DEBUG.prototype.set = function DEBUG() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; textmp = exprs[2-1]; ok = true; while (1==1) { - [txt] = this.dialog[[["Enter scilab instructions for debugging."],[" Inputs are block and flag, output is block"]]-1][textmp-1]; - if (txt!=[]) { - tt = ["block=debug_scicos(block,flag)"]; - if (execstr("deff(tt,txt)","errcatch")==0) { - warnMode = warning("query"); -warning("off"); -save(this.TMPDIR+"/debug_scicos",this.debug_scicos); -warning(warnMode); - exprs[2-1] = txt; - if ((scicos_debug()!=2&&scicos_debug()!=3)) { -scicos_debug(2); -} -break; - } else { -message([["Error in the instructions"],[lasterror()]]); -} - } else { - ok = false; -break; -} -} + [txt] = this.dialog[[["Enter scilab instructions for debugging."],[" Inputs are block and flag, output is block"]]-1][textmp-1]; + if (txt!=[]) { + tt = ["block=debug_scicos(block,flag)"]; + if (execstr("deff(tt,txt)","errcatch")==0) { + warnMode = warning("query"); + warning("off"); + save(this.TMPDIR+"/debug_scicos",this.debug_scicos); + warning(warnMode); + exprs[2-1] = txt; + if ((scicos_debug()!=2&&scicos_debug()!=3)) { + scicos_debug(2); + } + break; + } else { + message([["Error in the instructions"],[lasterror()]]); + } + } else { + ok = false; + break; + } + } if (ok) { - graphics.exprs = exprs; - x.graphics = graphics; -} + graphics.exprs = exprs; + this.x.graphics = graphics; + } } } diff --git a/js/Misc/DEBUG.pickle b/js/Misc/DEBUG.pickle index 0f09469f..9556061e 100644 --- a/js/Misc/DEBUG.pickle +++ b/js/Misc/DEBUG.pickle @@ -4,10 +4,12 @@ p0 ((lp1 S'debug_scicos' p2 -aS'TMPDIR' +aS'x' p3 -aS'dialog' +aS'TMPDIR' p4 -atp5 -Rp6 +aS'dialog' +p5 +atp6 +Rp7 . \ No newline at end of file diff --git a/js/Misc/DEBUG_SCICOS.js b/js/Misc/DEBUG_SCICOS.js index dba81ebc..b6ecb6ac 100644 --- a/js/Misc/DEBUG_SCICOS.js +++ b/js/Misc/DEBUG_SCICOS.js @@ -1,14 +1,15 @@ /* autogenerated from "macros/Misc/DEBUG_SCICOS.sci" */ function DEBUG_SCICOS() { DEBUG_SCICOS.prototype.define = function DEBUG_SCICOS() { - x = DEBUG("define"); + this.x = DEBUG("define"); } DEBUG_SCICOS.prototype.details = function DEBUG_SCICOS() { + return this.x; } DEBUG_SCICOS.prototype.get = function DEBUG_SCICOS() { } DEBUG_SCICOS.prototype.set = function DEBUG_SCICOS() { arg1.gui = "DEBUG"; - [x,y,typ] = DEBUG("set",arg1); + [this.x,y,typ] = DEBUG("set",arg1); } } diff --git a/js/Misc/DEBUG_SCICOS.pickle b/js/Misc/DEBUG_SCICOS.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/DEBUG_SCICOS.pickle +++ b/js/Misc/DEBUG_SCICOS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/DIFF_f.js b/js/Misc/DIFF_f.js index ee0cd582..2378c548 100644 --- a/js/Misc/DIFF_f.js +++ b/js/Misc/DIFF_f.js @@ -11,28 +11,29 @@ function DIFF_f() { model.dep_ut = [false,true]; exprs = [[strcat(sci2exp(x0[1-1]))],[strcat(sci2exp(x0[2-1]))]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } DIFF_f.prototype.details = function DIFF_f() { + return this.x; } DIFF_f.prototype.get = function DIFF_f() { } DIFF_f.prototype.set = function DIFF_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,x0,xd0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["Initial state"],["Initial Derivative"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - graphics.exprs = exprs; - model.state = [[x0.slice()],[xd0.slice()]]; - x.graphics = graphics; - x.model = model; -break; -} - x.model.firing = []; + [ok,x0,xd0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["Initial state"],["Initial Derivative"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + graphics.exprs = exprs; + model.state = [[x0.slice()],[xd0.slice()]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + this.x.model.firing = []; } } diff --git a/js/Misc/DIFF_f.pickle b/js/Misc/DIFF_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/DIFF_f.pickle +++ b/js/Misc/DIFF_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/DSUPER.js b/js/Misc/DSUPER.js index 7835a291..4e8f079f 100644 --- a/js/Misc/DSUPER.js +++ b/js/Misc/DSUPER.js @@ -3,6 +3,7 @@ function DSUPER() { DSUPER.prototype.define = function DSUPER() { } DSUPER.prototype.details = function DSUPER() { + return this.x; } DSUPER.prototype.get = function DSUPER() { } @@ -11,41 +12,41 @@ function DSUPER() { typ = list(); graphics = arg1.graphics; if ((length(graphics.exprs)==0)) { -warnBlockByUID(arg1.model.label,gettext("Invalid masked block.")); - x = arg1; -return; -} + warnBlockByUID(arg1.model.label,gettext("Invalid masked block.")); + this.x = arg1; + return; + } exprs = graphics.exprs[1-1]; exprs0 = graphics.exprs[2-1][1-1]; btitre = graphics.exprs[2-1][2-1][1-1]; bitems = graphics.exprs[2-1][2-1].slice(2-1,$); if (exprs0==[]) { - x = arg1; -return; -} + this.x = arg1; + return; + } context = [arg1.model.rpar.props.context]; [PREVAR_scicos_context,ierr] = script2var(context,PREVAR_scicos_context); if (ierr!=0) { - x = arg1; -return; -} + this.x = arg1; + return; + } tt = "scicos_context."+exprs0[1-1]; -for (i=2;i<=size(exprs0,1);i+=1) { - tt = tt+",scicos_context."+exprs0[i-1]; -} + for (i=2;i<=size(exprs0,1);i+=1) { + tt = tt+",scicos_context."+exprs0[i-1]; + } ss = graphics.exprs[2-1][3-1]; scicos_context = PREVAR_scicos_context; -execstr("[ok,"+tt+",exprs]=scicos_getvalue(btitre,bitems,ss,exprs)"); + execstr("[ok,"+tt+",exprs]=scicos_getvalue(btitre,bitems,ss,exprs)"); if (this.ok) { - x = arg1; - PREVAR_scicos_context = scicos_context; - sblock = x.model.rpar; - [sblock,%w,needcompile2,this.ok] = do_eval(sblock,list(),scicos_context); - y = max(2,this.needcompile,needcompile2); - x.graphics.exprs[1-1] = exprs; - x.model.rpar = sblock; + this.x = arg1; + PREVAR_scicos_context = scicos_context; + sblock = this.x.model.rpar; + [sblock,%w,needcompile2,this.ok] = do_eval(sblock,list(),scicos_context); + y = max(2,this.needcompile,needcompile2); + this.x.graphics.exprs[1-1] = exprs; + this.x.model.rpar = sblock; } else { - x = arg1; -} + this.x = arg1; + } } } diff --git a/js/Misc/DSUPER.pickle b/js/Misc/DSUPER.pickle index 44fb8b06..2f51419c 100644 --- a/js/Misc/DSUPER.pickle +++ b/js/Misc/DSUPER.pickle @@ -4,8 +4,10 @@ p0 ((lp1 S'needcompile' p2 -aS'ok' +aS'x' p3 -atp4 -Rp5 +aS'ok' +p4 +atp5 +Rp6 . \ No newline at end of file diff --git a/js/Misc/EDGETRIGGER.js b/js/Misc/EDGETRIGGER.js index fc4f063f..a91acc88 100644 --- a/js/Misc/EDGETRIGGER.js +++ b/js/Misc/EDGETRIGGER.js @@ -13,27 +13,28 @@ function EDGETRIGGER() { model.dep_ut = [true,false]; exprs = [string(edge)]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } EDGETRIGGER.prototype.details = function EDGETRIGGER() { + return this.x; } EDGETRIGGER.prototype.get = function EDGETRIGGER() { } EDGETRIGGER.prototype.set = function EDGETRIGGER() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,edge,exprs] = scicos_getvalue("Set edge trigger block parameters",["rising (1), falling (-1), both (0)"],list("vec",1),exprs); - if (!ok) { -break; -} - model.ipar = sign(edge); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,edge,exprs] = scicos_getvalue("Set edge trigger block parameters",["rising (1), falling (-1), both (0)"],list("vec",1),exprs); + if (!ok) { + break; + } + model.ipar = sign(edge); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Misc/EDGETRIGGER.pickle b/js/Misc/EDGETRIGGER.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/EDGETRIGGER.pickle +++ b/js/Misc/EDGETRIGGER.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/EDGE_TRIGGER.js b/js/Misc/EDGE_TRIGGER.js index 0f24996b..efd03837 100644 --- a/js/Misc/EDGE_TRIGGER.js +++ b/js/Misc/EDGE_TRIGGER.js @@ -70,87 +70,88 @@ function EDGE_TRIGGER() { lnk.from = [2,1,0]; lnk.to = [4,1,1]; scs_m_1.objs[7-1] = lnk; -blk={}; -lnk={}; + blk={}; + lnk={}; model = scicos_model(); model.sim = "csuper"; model.in1 = 1; model.evtout = 1; model.rpar = scs_m_1; gr_i = []; - x = standard_define([3,2],model,[],gr_i); + this.x = standard_define([3,2],model,[],gr_i); } EDGE_TRIGGER.prototype.details = function EDGE_TRIGGER() { + return this.x; } EDGE_TRIGGER.prototype.get = function EDGE_TRIGGER() { } EDGE_TRIGGER.prototype.set = function EDGE_TRIGGER() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="EDGETRIGGER") { - ppath = list(i); -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="EDGETRIGGER") { + ppath = list(i); + break; + } + } newpar = list(); y = 0; for (path in ppath) { - np = size(path,"*"); - spath = list(); -for (k=1;k<=np;k+=1) { - spath[$+1-1] = "model"; - spath[$+1-1] = "rpar"; - spath[$+1-1] = "objs"; - spath[$+1-1] = path[k-1]; -} - xx = arg1[spath-1]; -execstr("xxn="+xx.gui+"(\'set\',xx)"); - if (diffobjs(this.xxn,xx)) { - model = xx.model; - model_n = this.xxn.model; - if (!is_modelica_block(xx)) { - modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label); - if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) { - needcompile = 1; -} - if (or(model.firing!=model_n.firing)) { - needcompile = 2; -} - if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) { - needcompile = 4; -} - if (model.sim=="input"||model.sim=="output") { - if (model.ipar!=model_n.ipar) { - needcompile = 4; -} -} - if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { - needcompile = 4; -} - if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { - needcompile = 4; -} - if (prod(size(model_n.sim))>1) { - if (model_n.sim[2-1]>1000) { - if (model.sim[1-1]!=model_n.sim[1-1]) { - needcompile = 4; -} -} -} - } else { - modified = or(model_n!=model); - eq = model.equations; - eqn = model_n.equations; - if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { - needcompile = 4; -} -} - arg1[spath-1] = this.xxn; - newpar[size(newpar)+1-1] = path; - y = max(y,needcompile); -} -} - x = arg1; + np = size(path,"*"); + spath = list(); + for (k=1;k<=np;k+=1) { + spath[$+1-1] = "model"; + spath[$+1-1] = "rpar"; + spath[$+1-1] = "objs"; + spath[$+1-1] = path[k-1]; + } + xx = arg1[spath-1]; + execstr("xxn="+xx.gui+"(\'set\',xx)"); + if (diffobjs(this.xxn,xx)) { + model = xx.model; + model_n = this.xxn.model; + if (!is_modelica_block(xx)) { + modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label); + if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) { + needcompile = 1; + } + if (or(model.firing!=model_n.firing)) { + needcompile = 2; + } + if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) { + needcompile = 4; + } + if (model.sim=="input"||model.sim=="output") { + if (model.ipar!=model_n.ipar) { + needcompile = 4; + } + } + if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { + needcompile = 4; + } + if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; + } + if (prod(size(model_n.sim))>1) { + if (model_n.sim[2-1]>1000) { + if (model.sim[1-1]!=model_n.sim[1-1]) { + needcompile = 4; + } + } + } + } else { + modified = or(model_n!=model); + eq = model.equations; + eqn = model_n.equations; + if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { + needcompile = 4; + } + } + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; + y = max(y,needcompile); + } + } + this.x = arg1; typ = newpar; } } diff --git a/js/Misc/EDGE_TRIGGER.pickle b/js/Misc/EDGE_TRIGGER.pickle index 78b2b289..6b285a05 100644 --- a/js/Misc/EDGE_TRIGGER.pickle +++ b/js/Misc/EDGE_TRIGGER.pickle @@ -2,10 +2,12 @@ c__builtin__ set p0 ((lp1 -S'EDGETRIGGER' +S'x' p2 -aS'xxn' +aS'EDGETRIGGER' p3 -atp4 -Rp5 +aS'xxn' +p4 +atp5 +Rp6 . \ No newline at end of file diff --git a/js/Misc/ENDBLK.js b/js/Misc/ENDBLK.js index 3ee25214..ad60a07f 100644 --- a/js/Misc/ENDBLK.js +++ b/js/Misc/ENDBLK.js @@ -6,79 +6,80 @@ function ENDBLK() { scs_m_1.objs[2-1] = scicos_link(xx=[[292.104],[292.104],[261.83733],[261.83733],[292.104],[292.104]],yy=[[243.40305],[234.45067],[234.45067],[305.584],[305.584],[294.83162]],id="drawlink",thick=[0,0],ct=[5,-1],from=[1,1,0],to=[1,1,1]); model = scicos_model(sim="csuper",in1=[],in2=[],intyp=1,out=[],out2=[],outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=scs_m_1,ipar=[],opar=list(),blocktype="h",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()); gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } ENDBLK.prototype.details = function ENDBLK() { + return this.x; } ENDBLK.prototype.get = function ENDBLK() { } ENDBLK.prototype.set = function ENDBLK() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="END_c") { - ppath = list(i); -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="END_c") { + ppath = list(i); + break; + } + } newpar = list(); y = 0; for (path in ppath) { - np = size(path,"*"); - spath = list(); -for (k=1;k<=np;k+=1) { - spath[$+1-1] = "model"; - spath[$+1-1] = "rpar"; - spath[$+1-1] = "objs"; - spath[$+1-1] = path[k-1]; -} - xx = arg1[spath-1]; -execstr("xxn="+xx.gui+"(\'set\',xx)"); - if (!this.isequalbitwise[this.xxn-1][xx-1]) { - model = xx.model; - model_n = this.xxn.model; - if (!is_modelica_block(xx)) { - modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.odstate,model_n.odstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.opar,model_n.opar)||!isequal(model.label,model_n.label); - if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)||or(model.in2!=model_n.in2)||or(model.out2!=model_n.out2)||or(model.outtyp!=model_n.outtyp)||or(model.intyp!=model_n.intyp)) { - needcompile = 1; -} - if (or(model.firing!=model_n.firing)) { - needcompile = 2; -} - if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))||(size(model.evtin,"*")!=size(model_n.evtin,"*"))) { - needcompile = 4; -} - if (model.sim=="input"||model.sim=="output") { - if (model.ipar!=model_n.ipar) { - needcompile = 4; -} -} - if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { - needcompile = 4; -} - if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { - needcompile = 4; -} - if (prod(size(model_n.sim))>1) { - if (model_n.sim[2-1]>1000) { - if (model.sim[1-1]!=model_n.sim[1-1]) { - needcompile = 4; -} -} -} - } else { - modified = or(model_n!=model); - eq = model.equations; - eqn = model_n.equations; - if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { - needcompile = 4; -} -} - arg1[spath-1] = this.xxn; - newpar[size(newpar)+1-1] = path; - y = max(y,needcompile); -} -} - x = arg1; + np = size(path,"*"); + spath = list(); + for (k=1;k<=np;k+=1) { + spath[$+1-1] = "model"; + spath[$+1-1] = "rpar"; + spath[$+1-1] = "objs"; + spath[$+1-1] = path[k-1]; + } + xx = arg1[spath-1]; + execstr("xxn="+xx.gui+"(\'set\',xx)"); + if (!this.isequalbitwise[this.xxn-1][xx-1]) { + model = xx.model; + model_n = this.xxn.model; + if (!is_modelica_block(xx)) { + modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.odstate,model_n.odstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.opar,model_n.opar)||!isequal(model.label,model_n.label); + if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)||or(model.in2!=model_n.in2)||or(model.out2!=model_n.out2)||or(model.outtyp!=model_n.outtyp)||or(model.intyp!=model_n.intyp)) { + needcompile = 1; + } + if (or(model.firing!=model_n.firing)) { + needcompile = 2; + } + if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))||(size(model.evtin,"*")!=size(model_n.evtin,"*"))) { + needcompile = 4; + } + if (model.sim=="input"||model.sim=="output") { + if (model.ipar!=model_n.ipar) { + needcompile = 4; + } + } + if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { + needcompile = 4; + } + if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; + } + if (prod(size(model_n.sim))>1) { + if (model_n.sim[2-1]>1000) { + if (model.sim[1-1]!=model_n.sim[1-1]) { + needcompile = 4; + } + } + } + } else { + modified = or(model_n!=model); + eq = model.equations; + eqn = model_n.equations; + if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { + needcompile = 4; + } + } + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; + y = max(y,needcompile); + } + } + this.x = arg1; typ = newpar; } } diff --git a/js/Misc/ENDBLK.pickle b/js/Misc/ENDBLK.pickle index 794658bf..dd4ce05f 100644 --- a/js/Misc/ENDBLK.pickle +++ b/js/Misc/ENDBLK.pickle @@ -2,10 +2,12 @@ c__builtin__ set p0 ((lp1 -S'xxn' +S'x' p2 -aS'isequalbitwise' +aS'xxn' p3 -atp4 -Rp5 +aS'isequalbitwise' +p4 +atp5 +Rp6 . \ No newline at end of file diff --git a/js/Misc/EXPRESSION.pickle b/js/Misc/EXPRESSION.pickle index 2d95f3ab..de00e428 100644 --- a/js/Misc/EXPRESSION.pickle +++ b/js/Misc/EXPRESSION.pickle @@ -4,10 +4,12 @@ p0 ((lp1 S'getfield' p2 -aS'PREVAR_foo' +aS'x' p3 aS'PREVAR_scicos_context' p4 -atp5 -Rp6 +aS'PREVAR_foo' +p5 +atp6 +Rp7 . \ No newline at end of file diff --git a/js/Misc/Extract_Activation.js b/js/Misc/Extract_Activation.js index db78ee5e..cfd50124 100644 --- a/js/Misc/Extract_Activation.js +++ b/js/Misc/Extract_Activation.js @@ -75,21 +75,22 @@ function Extract_Activation() { lnk.from = [2,1,0]; lnk.to = [4,1,1]; scs_m_1.objs[8-1] = lnk; -blk={}; -lnk={}; + blk={}; + lnk={}; model = scicos_model(); model.sim = "csuper"; model.in1 = 1; model.evtout = 1; model.rpar = scs_m_1; gr_i = []; - x = standard_define([3,2],model,[],gr_i); + this.x = standard_define([3,2],model,[],gr_i); } Extract_Activation.prototype.details = function Extract_Activation() { + return this.x; } Extract_Activation.prototype.get = function Extract_Activation() { } Extract_Activation.prototype.set = function Extract_Activation() { - x = arg1; + this.x = arg1; } } diff --git a/js/Misc/Extract_Activation.pickle b/js/Misc/Extract_Activation.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/Extract_Activation.pickle +++ b/js/Misc/Extract_Activation.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/HYSTHERESIS.js b/js/Misc/HYSTHERESIS.js index cb53ebca..143022ac 100644 --- a/js/Misc/HYSTHERESIS.js +++ b/js/Misc/HYSTHERESIS.js @@ -16,35 +16,36 @@ function HYSTHERESIS() { model.dep_ut = [true,false]; exprs = [[string(rpar)],[string(sign(nzz))]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } HYSTHERESIS.prototype.details = function HYSTHERESIS() { + return this.x; } HYSTHERESIS.prototype.get = function HYSTHERESIS() { } HYSTHERESIS.prototype.set = function HYSTHERESIS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,high_lim,low_lim,out_high,out_low,nzz,exprs] = scicos_getvalue("Set parameters",[["switch on at"],["switch off at"],["output when on"],["output when off"],["use zero crossing: yes (1), no (0)"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (low_lim>high_lim) { -message("switch on value must be larger than switch off value"); - } else { - graphics.exprs = exprs; - model.rpar = transpose([high_lim,low_lim,out_high,out_low]); - if (nzz>0) { - nzz = 2; -} - model.nzcross = nzz; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,high_lim,low_lim,out_high,out_low,nzz,exprs] = scicos_getvalue("Set parameters",[["switch on at"],["switch off at"],["output when on"],["output when off"],["use zero crossing: yes (1), no (0)"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (low_lim>high_lim) { + message("switch on value must be larger than switch off value"); + } else { + graphics.exprs = exprs; + model.rpar = transpose([high_lim,low_lim,out_high,out_low]); + if (nzz>0) { + nzz = 2; + } + model.nzcross = nzz; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Misc/HYSTHERESIS.pickle b/js/Misc/HYSTHERESIS.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/HYSTHERESIS.pickle +++ b/js/Misc/HYSTHERESIS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/IMPSPLIT_f.js b/js/Misc/IMPSPLIT_f.js index 25e4799d..13d25e0b 100644 --- a/js/Misc/IMPSPLIT_f.js +++ b/js/Misc/IMPSPLIT_f.js @@ -10,15 +10,16 @@ function IMPSPLIT_f() { model.equations = mo; model.in1 = ones(size(mo.inputs,"*"),1); model.out = ones(size(mo.outputs,"*"),1); - x = standard_define([1,1]/3,model,[],[]); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I","I"]; + this.x = standard_define([1,1]/3,model,[],[]); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I","I"]; } IMPSPLIT_f.prototype.details = function IMPSPLIT_f() { + return this.x; } IMPSPLIT_f.prototype.get = function IMPSPLIT_f() { } IMPSPLIT_f.prototype.set = function IMPSPLIT_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Misc/IMPSPLIT_f.pickle b/js/Misc/IMPSPLIT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/IMPSPLIT_f.pickle +++ b/js/Misc/IMPSPLIT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/LOGICAL_OP.js b/js/Misc/LOGICAL_OP.js index 25ee74a3..66ddcac6 100644 --- a/js/Misc/LOGICAL_OP.js +++ b/js/Misc/LOGICAL_OP.js @@ -13,100 +13,101 @@ function LOGICAL_OP() { model.dep_ut = [true,false]; exprs = [[string(nin)],[string(ipar)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } LOGICAL_OP.prototype.details = function LOGICAL_OP() { + return this.x; } LOGICAL_OP.prototype.get = function LOGICAL_OP() { } LOGICAL_OP.prototype.set = function LOGICAL_OP() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,1)==2) { - exprs = [[exprs],[sci2exp(1)],[sci2exp(0)]]; -} + exprs = [[exprs],[sci2exp(1)],[sci2exp(0)]]; + } while (true) { - [ok,nin,rule,Datatype,tp,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["Operator: AND (0), OR (1), NAND (2), NOR (3), XOR (4), NOT (5)","Datatype (1=double 3=int32 ...)"],["Bitwise Rule(0=No 1=yes)"]],list("vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - nin = int(nin); - rule = int(rule); - tp = int(tp); - if (nin<1) { -message("Number of inputs must be >=1 "); - ok = false; - } else if ((rule<0)||(rule>5)) { -message("Incorrect operator "+string(rule)+" ; must be 0 to 5."); - ok = false; - } else if ((rule==5)&&(nin>1)) { -message("Only one input allowed for NOT operation"); - nin = 1; - } else if (((Datatype==1)&&(tp!=0))) { -message("Bitwise Rule is only activated when Data type is integer"); - ok = false; -} - if (ok) { - if ((tp!=0)) { - tp = 1; -} - if (Datatype==1) { - model.sim = list("logicalop",4); - model.ipar = [rule]; - } else { - if (Datatype==3) { - model.sim = list("logicalop_i32",4); - } else if (Datatype==4) { - model.sim = list("logicalop_i16",4); - } else if (Datatype==5) { - model.sim = list("logicalop_i8",4); - } else if (Datatype==6) { - model.sim = list("logicalop_ui32",4); - } else if (Datatype==7) { - model.sim = list("logicalop_ui16",4); - } else if (Datatype==8) { - model.sim = list("logicalop_ui8",4); - } else { -message("Datatype is not supported"); - ok = false; -} - model.ipar = [[rule],[tp]]; -} - if (ok) { - it = Datatype*ones(nin,1); - ot = Datatype; - in1 = [-ones(nin,1),-2*ones(nin,1)]; - if ((rule!=5)&&(nin==1)) { - out = [1,1]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); - } else { - out = [-1,-2]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} -} - if (ok) { - if (rule==0) { - label = "AND"; - } else if (rule==1) { - label = "OR"; - } else if (rule==2) { - label = "NAND"; - } else if (rule==3) { - label = "NOR"; - } else if (rule==4) { - label = "XOR"; - } else if (rule==5) { - label = "NOT"; -} - graphics.exprs = exprs; - graphics.style = ["blockWithLabel;displayedLabel="+label]; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,nin,rule,Datatype,tp,exprs] = scicos_getvalue("Set parameters",[["number of inputs"],["Operator: AND (0), OR (1), NAND (2), NOR (3), XOR (4), NOT (5)","Datatype (1=double 3=int32 ...)"],["Bitwise Rule(0=No 1=yes)"]],list("vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + nin = int(nin); + rule = int(rule); + tp = int(tp); + if (nin<1) { + message("Number of inputs must be >=1 "); + ok = false; + } else if ((rule<0)||(rule>5)) { + message("Incorrect operator "+string(rule)+" ; must be 0 to 5."); + ok = false; + } else if ((rule==5)&&(nin>1)) { + message("Only one input allowed for NOT operation"); + nin = 1; + } else if (((Datatype==1)&&(tp!=0))) { + message("Bitwise Rule is only activated when Data type is integer"); + ok = false; + } + if (ok) { + if ((tp!=0)) { + tp = 1; + } + if (Datatype==1) { + model.sim = list("logicalop",4); + model.ipar = [rule]; + } else { + if (Datatype==3) { + model.sim = list("logicalop_i32",4); + } else if (Datatype==4) { + model.sim = list("logicalop_i16",4); + } else if (Datatype==5) { + model.sim = list("logicalop_i8",4); + } else if (Datatype==6) { + model.sim = list("logicalop_ui32",4); + } else if (Datatype==7) { + model.sim = list("logicalop_ui16",4); + } else if (Datatype==8) { + model.sim = list("logicalop_ui8",4); + } else { + message("Datatype is not supported"); + ok = false; + } + model.ipar = [[rule],[tp]]; + } + if (ok) { + it = Datatype*ones(nin,1); + ot = Datatype; + in1 = [-ones(nin,1),-2*ones(nin,1)]; + if ((rule!=5)&&(nin==1)) { + out = [1,1]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } else { + out = [-1,-2]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + } + if (ok) { + if (rule==0) { + label = "AND"; + } else if (rule==1) { + label = "OR"; + } else if (rule==2) { + label = "NAND"; + } else if (rule==3) { + label = "NOR"; + } else if (rule==4) { + label = "XOR"; + } else if (rule==5) { + label = "NOT"; + } + graphics.exprs = exprs; + graphics.style = ["blockWithLabel;displayedLabel="+label]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Misc/LOGICAL_OP.pickle b/js/Misc/LOGICAL_OP.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/LOGICAL_OP.pickle +++ b/js/Misc/LOGICAL_OP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/MBLOCK.js b/js/Misc/MBLOCK.js index 17c1ffc5..2b478a8a 100644 --- a/js/Misc/MBLOCK.js +++ b/js/Misc/MBLOCK.js @@ -14,9 +14,9 @@ function MBLOCK() { model.blocktype = "c"; model.dep_ut = [false,true]; model.rpar = []; -for (i=1;i<=lstsize(paramv);i+=1) { - model.rpar = [[model.rpar],[paramv[i-1].slice()]]; -} + for (i=1;i<=lstsize(paramv);i+=1) { + model.rpar = [[model.rpar],[paramv[i-1].slice()]]; + } mo = modelica(); mo.model = nameF; mo.parameters = list(param,paramv); @@ -27,247 +27,248 @@ for (i=1;i<=lstsize(paramv);i+=1) { model.out = ones(size(mo.outputs,"r"),1); model.equations = mo; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); - x.graphics.in_implicit = this.intype; - x.graphics.out_implicit = this.outtype; + this.x = standard_define([3,2],model,exprs,gr_i); + this.x.graphics.in_implicit = this.intype; + this.x.graphics.out_implicit = this.outtype; } MBLOCK.prototype.details = function MBLOCK() { + return this.x; } MBLOCK.prototype.get = function MBLOCK() { } MBLOCK.prototype.set = function MBLOCK() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; exprs = graphics.exprs; if (this.type[exprs-1]==15) { - paramv = list(); - pprop = []; -for (i=1;i<=size(model.rpar,"*");i+=1) { - paramv[$+1-1] = string(model.rpar[i-1]); - pprop[$+1-1] = 0; -} - exprs = tlist(["MBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],exprs[1-1][1-1],exprs[1-1][2-1],exprs[1-1][3-1],exprs[1-1][4-1],exprs[1-1][5-1],paramv,sci2exp(pprop.slice()),exprs[1-1][7-1],exprs[2-1]); -} + paramv = list(); + pprop = []; + for (i=1;i<=size(model.rpar,"*");i+=1) { + paramv[$+1-1] = string(model.rpar[i-1]); + pprop[$+1-1] = 0; + } + exprs = tlist(["MBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],exprs[1-1][1-1],exprs[1-1][2-1],exprs[1-1][3-1],exprs[1-1][4-1],exprs[1-1][5-1],paramv,sci2exp(pprop.slice()),exprs[1-1][7-1],exprs[2-1]); + } lab_1 = list(exprs.in1,exprs.intype,exprs.out,exprs.outtype,exprs.param,exprs.pprop,exprs.nameF); lab_2 = exprs.paramv; while (true) { - [ok,Tin,Tintype,Tout,Touttype,Tparam,pprop,Tfunam,lab_1] = scicos_getvalue("Set Modelica generic block parameters",[["Input variables: "],["Input variables types: "],["Output variables: "],["Output variables types:"],["Parameters in Modelica:"],["Parameters properties: "],["Function name: "]],list("str",-1,"str",-1,"str",-1,"str",-1,"str",-1,"vec",-1,"str",-1),lab_1); - if (!ok) { -break; -} - ierr = execstr("in=stripblanks(evstr(Tin)); intype=stripblanks(evstr(Tintype)); out=stripblanks(evstr(Tout)); outtype=stripblanks(evstr(Touttype)); param=stripblanks(evstr(Tparam)); funam=stripblanks(Tfunam)","errcatch"); - if (ierr!=0) { -messagebox("Error in evaluation of variables.","modal","error"); - ok = false; -} - if (ok) { -for (i=1;i<=size(this.in1,"*");i+=1) { - r = false; - ierr = execstr("r=validvar(in(i))","errcatch"); - if (!r) { - ok = false; -break; -} -} - if (!ok) { -messagebox([["Invalid variable name for the input "+string(i)+"."],["\""+this.in1[i-1]+"\""],["Please choose another variable name."]],"modal","error"); -} -} - if (ok) { -for (i=1;i<=size(this.out,"*");i+=1) { - r = false; - ierr = execstr("r=validvar(out(i))","errcatch"); - if (!r) { - ok = false; -break; -} -} - if (!ok) { -messagebox([["Invalid variable name for the output "+string(i)+"."],["\""+this.out[i-1]+"\""],["Please choose another variable name."]],"modal","error"); -} -} - if (ok) { - param = param.slice(); -for (i=1;i<=size(param,"*");i+=1) { - r = false; - ierr = execstr("r=validvar(param(i))","errcatch"); - if (!r) { - ok = false; -break; -} -} - if (!ok) { -messagebox([["Invalid variable name for the parameter "+string(i)+"."],["\""+param[i-1]+"\""],["Please choose another variable name."]],"modal","error"); -} -} - if (ok) { -for (i=1;i<=size(this.intype,"*");i+=1) { - if (this.intype[i-1]!="E"&&this.intype[i-1]!="I") { -messagebox("Input type should be \'E\' or \'I\'!","modal","error"); - ok = false; -break; -} -} -} - if (ok) { -for (i=1;i<=size(this.outtype,"*");i+=1) { - if (this.outtype[i-1]!="E"&&this.outtype[i-1]!="I") { -messagebox("Output type should be \'E\' or \'I\'!","modal","error"); - ok = false; -break; -} -} -} - if (ok) { - if (or(size(this.intype)!=size(this.in1))) { -messagebox("Input variables are not well defined!","modal","error"); - ok = false; -} -} - if (ok) { - if (or(size(this.outtype)!=size(this.out))) { -messagebox("Output variables are not well defined!","modal","error"); - ok = false; -} -} - if (ok) { - pprop = pprop.slice(); - if ((size(param,"*")!=size(pprop,"*"))) { -messagebox([["There is differences in"],["size of param and size "],["of param properties."]],"modal","error"); - ok = false; -} -} - if (ok) { - if (max(pprop)>2||min(pprop)<0) { -messagebox([["Parameters properties must be :"],["0 : for simple paramater,"],["1 : for initial state value,"],["2 : for a fixed initial state value."]],"modal","error"); - ok = false; -} -} - if (ok) { - if (this.funam=="") { -messagebox("The filename is not defined!","modal","error"); - ok = false; -} -} - if (ok) { - [dirF,nameF,extF] = fileparts(this.funam); - if ((extF!=""&&extF!=".mo")||(dirF!=""&&extF!=".mo")) { -messagebox("Filename extention should be \'.mo \' !","modal","error"); - ok = false; -} -} - if (ok) { - intypex = find(this.intype=="I"); - outtypex = find(this.outtype=="I"); - [model,graphics,ok] = set_io(model,graphics,list([ones(this.in1),ones(this.in1)],ones(this.in1)),list([ones(this.out),ones(this.out)],ones(this.out)),[],[],intypex,outtypex); -} - if (ok) { - Tparam_lab = evstr(Tparam); - Tparam_sz = size(Tparam_lab,"*"); - if (Tparam_sz>lstsize(lab_2)) { -for (i=1;i<=(Tparam_sz-lstsize(lab_2));i+=1) { - lab_2[$+1-1] = "0"; -} - } else if (Tparam_sz0) { - mo.parameters = list(transpose(param),paramv,transpose(pprop)); - } else { - mo.parameters = list(transpose(param),paramv); -} - model.equations = mo; - model.rpar = []; -for (i=1;i<=lstsize(paramv);i+=1) { - model.rpar = [[model.rpar],[paramv[i-1].slice()]]; -} - model.sim[1-1] = this.funam; - exprs.in1 = lab_1[1-1]; - exprs.intype = lab_1[2-1]; - exprs.out = lab_1[3-1]; - exprs.outtype = lab_1[4-1]; - exprs.param = lab_1[5-1]; - exprs.paramv = list(); - if (Tparam_sz!=0) { - if (this.type[lab_2-1]==15) { -for (i=1;i<=lstsize(lab_2);i+=1) { - exprs.paramv[i-1] = lab_2[i-1]; -} - } else { -for (i=1;i<=size(lab_2,"*");i+=1) { - exprs.paramv[i-1] = lab_2[i-1]; -} -} -} - exprs.pprop = lab_1[6-1]; - exprs.nameF = lab_1[7-1]; - exprs.funtxt = tt; - x.model = model; - graphics.gr_i[1-1][1-1] = "txt=[\'Modelica\';\' "+nameF+" \'];"; - graphics.in_implicit = this.intype; - graphics.out_implicit = this.outtype; - graphics.exprs = exprs; - x.graphics = graphics; -break; -} -} + [ok,Tin,Tintype,Tout,Touttype,Tparam,pprop,Tfunam,lab_1] = scicos_getvalue("Set Modelica generic block parameters",[["Input variables: "],["Input variables types: "],["Output variables: "],["Output variables types:"],["Parameters in Modelica:"],["Parameters properties: "],["Function name: "]],list("str",-1,"str",-1,"str",-1,"str",-1,"str",-1,"vec",-1,"str",-1),lab_1); + if (!ok) { + break; + } + ierr = execstr("in=stripblanks(evstr(Tin)); intype=stripblanks(evstr(Tintype)); out=stripblanks(evstr(Tout)); outtype=stripblanks(evstr(Touttype)); param=stripblanks(evstr(Tparam)); funam=stripblanks(Tfunam)","errcatch"); + if (ierr!=0) { + messagebox("Error in evaluation of variables.","modal","error"); + ok = false; + } + if (ok) { + for (i=1;i<=size(this.in1,"*");i+=1) { + r = false; + ierr = execstr("r=validvar(in(i))","errcatch"); + if (!r) { + ok = false; + break; + } + } + if (!ok) { + messagebox([["Invalid variable name for the input "+string(i)+"."],["\""+this.in1[i-1]+"\""],["Please choose another variable name."]],"modal","error"); + } + } + if (ok) { + for (i=1;i<=size(this.out,"*");i+=1) { + r = false; + ierr = execstr("r=validvar(out(i))","errcatch"); + if (!r) { + ok = false; + break; + } + } + if (!ok) { + messagebox([["Invalid variable name for the output "+string(i)+"."],["\""+this.out[i-1]+"\""],["Please choose another variable name."]],"modal","error"); + } + } + if (ok) { + param = param.slice(); + for (i=1;i<=size(param,"*");i+=1) { + r = false; + ierr = execstr("r=validvar(param(i))","errcatch"); + if (!r) { + ok = false; + break; + } + } + if (!ok) { + messagebox([["Invalid variable name for the parameter "+string(i)+"."],["\""+param[i-1]+"\""],["Please choose another variable name."]],"modal","error"); + } + } + if (ok) { + for (i=1;i<=size(this.intype,"*");i+=1) { + if (this.intype[i-1]!="E"&&this.intype[i-1]!="I") { + messagebox("Input type should be \'E\' or \'I\'!","modal","error"); + ok = false; + break; + } + } + } + if (ok) { + for (i=1;i<=size(this.outtype,"*");i+=1) { + if (this.outtype[i-1]!="E"&&this.outtype[i-1]!="I") { + messagebox("Output type should be \'E\' or \'I\'!","modal","error"); + ok = false; + break; + } + } + } + if (ok) { + if (or(size(this.intype)!=size(this.in1))) { + messagebox("Input variables are not well defined!","modal","error"); + ok = false; + } + } + if (ok) { + if (or(size(this.outtype)!=size(this.out))) { + messagebox("Output variables are not well defined!","modal","error"); + ok = false; + } + } + if (ok) { + pprop = pprop.slice(); + if ((size(param,"*")!=size(pprop,"*"))) { + messagebox([["There is differences in"],["size of param and size "],["of param properties."]],"modal","error"); + ok = false; + } + } + if (ok) { + if (max(pprop)>2||min(pprop)<0) { + messagebox([["Parameters properties must be :"],["0 : for simple paramater,"],["1 : for initial state value,"],["2 : for a fixed initial state value."]],"modal","error"); + ok = false; + } + } + if (ok) { + if (this.funam=="") { + messagebox("The filename is not defined!","modal","error"); + ok = false; + } + } + if (ok) { + [dirF,nameF,extF] = fileparts(this.funam); + if ((extF!=""&&extF!=".mo")||(dirF!=""&&extF!=".mo")) { + messagebox("Filename extention should be \'.mo \' !","modal","error"); + ok = false; + } + } + if (ok) { + intypex = find(this.intype=="I"); + outtypex = find(this.outtype=="I"); + [model,graphics,ok] = set_io(model,graphics,list([ones(this.in1),ones(this.in1)],ones(this.in1)),list([ones(this.out),ones(this.out)],ones(this.out)),[],[],intypex,outtypex); + } + if (ok) { + Tparam_lab = evstr(Tparam); + Tparam_sz = size(Tparam_lab,"*"); + if (Tparam_sz>lstsize(lab_2)) { + for (i=1;i<=(Tparam_sz-lstsize(lab_2));i+=1) { + lab_2[$+1-1] = "0"; + } + } else if (Tparam_sz0) { + mo.parameters = list(transpose(param),paramv,transpose(pprop)); + } else { + mo.parameters = list(transpose(param),paramv); + } + model.equations = mo; + model.rpar = []; + for (i=1;i<=lstsize(paramv);i+=1) { + model.rpar = [[model.rpar],[paramv[i-1].slice()]]; + } + model.sim[1-1] = this.funam; + exprs.in1 = lab_1[1-1]; + exprs.intype = lab_1[2-1]; + exprs.out = lab_1[3-1]; + exprs.outtype = lab_1[4-1]; + exprs.param = lab_1[5-1]; + exprs.paramv = list(); + if (Tparam_sz!=0) { + if (this.type[lab_2-1]==15) { + for (i=1;i<=lstsize(lab_2);i+=1) { + exprs.paramv[i-1] = lab_2[i-1]; + } + } else { + for (i=1;i<=size(lab_2,"*");i+=1) { + exprs.paramv[i-1] = lab_2[i-1]; + } + } + } + exprs.pprop = lab_1[6-1]; + exprs.nameF = lab_1[7-1]; + exprs.funtxt = tt; + this.x.model = model; + graphics.gr_i[1-1][1-1] = "txt=[\'Modelica\';\' "+nameF+" \'];"; + graphics.in_implicit = this.intype; + graphics.out_implicit = this.outtype; + graphics.exprs = exprs; + this.x.graphics = graphics; + break; + } + } } } diff --git a/js/Misc/MBLOCK.pickle b/js/Misc/MBLOCK.pickle index 6ed6ac8b..ca02cacd 100644 --- a/js/Misc/MBLOCK.pickle +++ b/js/Misc/MBLOCK.pickle @@ -10,10 +10,12 @@ aS'outtype' p4 aS'funam' p5 -aS'type' +aS'x' p6 -aS'out' +aS'type' p7 -atp8 -Rp9 +aS'out' +p8 +atp9 +Rp10 . \ No newline at end of file diff --git a/js/Misc/MEMORY_f.js b/js/Misc/MEMORY_f.js index 70c670db..cb8c1333 100644 --- a/js/Misc/MEMORY_f.js +++ b/js/Misc/MEMORY_f.js @@ -14,43 +14,44 @@ function MEMORY_f() { model.blocktype = "m"; model.dep_ut = [false,false]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } MEMORY_f.prototype.details = function MEMORY_f() { + return this.x; } MEMORY_f.prototype.get = function MEMORY_f() { } MEMORY_f.prototype.set = function MEMORY_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,a,inh,exprs] = scicos_getvalue("Set memory block parameters",[["initial condition"],["Inherit (1: no, 0: yes)"]],list("vec",-1,"vec",1),exprs); - if (!ok) { -break; -} - if (inh==0) { - inh = []; - } else { - inh = 1; -} - [model,graphics,ok] = check_io(model,graphics,-1,-1,inh,[]); - out = size(a,"*"); - if (out==0) { - ok = false; -messagebox("Initial condition empty","modal","error"); -} - in1 = out; - if (ok) { - graphics.exprs = exprs; - model.rpar = a; - model.in1 = in1; - model.out = out; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,a,inh,exprs] = scicos_getvalue("Set memory block parameters",[["initial condition"],["Inherit (1: no, 0: yes)"]],list("vec",-1,"vec",1),exprs); + if (!ok) { + break; + } + if (inh==0) { + inh = []; + } else { + inh = 1; + } + [model,graphics,ok] = check_io(model,graphics,-1,-1,inh,[]); + out = size(a,"*"); + if (out==0) { + ok = false; + messagebox("Initial condition empty","modal","error"); + } + in1 = out; + if (ok) { + graphics.exprs = exprs; + model.rpar = a; + model.in1 = in1; + model.out = out; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Misc/MEMORY_f.pickle b/js/Misc/MEMORY_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/MEMORY_f.pickle +++ b/js/Misc/MEMORY_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/MPBLOCK.js b/js/Misc/MPBLOCK.js index ff8df8e0..f13fed08 100644 --- a/js/Misc/MPBLOCK.js +++ b/js/Misc/MPBLOCK.js @@ -14,9 +14,9 @@ function MPBLOCK() { model.blocktype = "c"; model.dep_ut = [true,true]; model.rpar = []; -for (i=1;i<=lstsize(paramv);i+=1) { - model.rpar = [[model.rpar],[paramv[i-1].slice()]]; -} + for (i=1;i<=lstsize(paramv);i+=1) { + model.rpar = [[model.rpar],[paramv[i-1].slice()]]; + } mo = modelica(); mo.model = nameF; mo.parameters = list(param,paramv); @@ -27,239 +27,240 @@ for (i=1;i<=lstsize(paramv);i+=1) { model.out = ones(size(mo.outputs,"r"),1); model.equations = mo; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); - x.graphics.in_implicit = this.intype; - x.graphics.out_implicit = this.outtype; + this.x = standard_define([3,2],model,exprs,gr_i); + this.x.graphics.in_implicit = this.intype; + this.x.graphics.out_implicit = this.outtype; } MPBLOCK.prototype.details = function MPBLOCK() { + return this.x; } MPBLOCK.prototype.get = function MPBLOCK() { } MPBLOCK.prototype.set = function MPBLOCK() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; exprs = graphics.exprs; if (this.type[exprs-1]==15) { - paramv = list(); - pprop = []; -for (i=1;i<=size(model.rpar,"*");i+=1) { - paramv[$+1-1] = string(model.rpar[i-1]); - pprop[$+1-1] = 0; -} - exprs = tlist(["MPBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],exprs[1-1][1-1],exprs[1-1][2-1],exprs[1-1][3-1],exprs[1-1][4-1],exprs[1-1][5-1],paramv,sci2exp(pprop.slice()),exprs[1-1][7-1],exprs[2-1]); -} + paramv = list(); + pprop = []; + for (i=1;i<=size(model.rpar,"*");i+=1) { + paramv[$+1-1] = string(model.rpar[i-1]); + pprop[$+1-1] = 0; + } + exprs = tlist(["MPBLOCK","in","intype","out","outtype","param","paramv","pprop","nameF","funtxt"],exprs[1-1][1-1],exprs[1-1][2-1],exprs[1-1][3-1],exprs[1-1][4-1],exprs[1-1][5-1],paramv,sci2exp(pprop.slice()),exprs[1-1][7-1],exprs[2-1]); + } lab_1 = list(exprs.in1,exprs.intype,exprs.out,exprs.outtype,exprs.param,exprs.pprop,exprs.nameF); lab_2 = exprs.paramv; while (true) { - [ok,Tin,Tintype,Tout,Touttype,Tparam,pprop,Tfunam,lab_1] = getvalue("Set Modelica generic block parameters",[["Input variables: "],["Input variables types: "],["Output variables: "],["Output variables types:"],["Parameters in Modelica:"],["Parameters properties: "],["Model name in packages:"]],list("str",-1,"str",-1,"str",-1,"str",-1,"str",-1,"vec",-1,"str",-1),lab_1); - if (!ok) { -break; -} - ierr = execstr("in=stripblanks(evstr(Tin)); intype=stripblanks(evstr(Tintype)); out=stripblanks(evstr(Tout)); outtype=stripblanks(evstr(Touttype)); param=stripblanks(evstr(Tparam)); funam=stripblanks(Tfunam)","errcatch"); - if (ierr!=0) { -x_message("Error in evaluation of variables."); - ok = false; -} - if (ok) { -for (i=1;i<=size(this.in1,"*");i+=1) { - r = false; - ierr = execstr("r=validvar(in(i))","errcatch"); - if (!r) { - ok = false; -break; -} -} - if (!ok) { -x_message([["Invalid variable name for the input "+string(i)+"."],["\""+this.in1[i-1]+"\""],["Please choose another variable name."]]); -} -} - if (ok) { -for (i=1;i<=size(this.out,"*");i+=1) { - r = false; - ierr = execstr("r=validvar(out(i))","errcatch"); - if (!r) { - ok = false; -break; -} -} - if (!ok) { -x_message([["Invalid variable name for the output "+string(i)+"."],["\""+this.out[i-1]+"\""],["Please choose another variable name."]]); -} -} - if (ok) { - param = param.slice(); -for (i=1;i<=size(param,"*");i+=1) { - r = false; - ierr = execstr("r=validvar(param(i))","errcatch"); - if (!r) { - ok = false; -break; -} -} - if (!ok) { -x_message([["Invalid variable name for the parameter "+string(i)+"."],["\""+param[i-1]+"\""],["Please choose another variable name."]]); -} -} - if (ok) { -for (i=1;i<=size(this.intype,"*");i+=1) { - if (this.intype[i-1]!="E"&&this.intype[i-1]!="I") { -x_message("Input type should be \'E\' or \'I\'!"); - ok = false; -break; -} -} -} - if (ok) { -for (i=1;i<=size(this.outtype,"*");i+=1) { - if (this.outtype[i-1]!="E"&&this.outtype[i-1]!="I") { -x_message("Output type should be \'E\' or \'I\'!"); - ok = false; -break; -} -} -} - if (ok) { - if (or(size(this.intype)!=size(this.in1))) { -x_message("Input variables are not well defined!"); - ok = false; -} -} - if (ok) { - if (or(size(this.outtype)!=size(this.out))) { -x_message("Output variables are not well defined!"); - ok = false; -} -} - if (ok) { - pprop = pprop.slice(); - if ((size(param,"*")!=size(pprop,"*"))) { -x_message([["There is differences in"],["size of param and size "],["of param properties."]]); - ok = false; -} -} - if (ok) { - if (max(pprop)>2||min(pprop)<0) { -x_message([["Parameters properties must be :"],["0 : if it is a paramaters"],["1 : if it is an initial value of state,"],["2 : it it is a fixed initial state value."]]); - ok = false; -} -} - if (ok) { - if (this.funam=="") { -x_message("The model name is not defined!"); - ok = false; -} -} - if (ok) { - [dirF,nameF,extF] = fileparts(this.funam); - if ((extF!="")||(dirF!="")) { -x_message("Invalid model name!"); - ok = false; -} -} - if (ok) { - intypex = find(this.intype=="I"); - outtypex = find(this.outtype=="I"); - [model,graphics,ok] = set_io(model,graphics,list([ones(this.in1),ones(this.in1)],ones(this.in1)),list([ones(this.out),ones(this.out)],ones(this.out)),[],[],intypex,outtypex); -} - if (ok) { - Tparam_lab = evstr(Tparam); - Tparam_sz = size(Tparam_lab,"*"); - if (Tparam_sz>lstsize(lab_2)) { -for (i=1;i<=(Tparam_sz-lstsize(lab_2));i+=1) { - lab_2[$+1-1] = "0"; -} - } else if (Tparam_sz0) { - mo.parameters = list(transpose(param),paramv,transpose(pprop)); - } else { - mo.parameters = list(transpose(param),paramv); -} -} - model.equations = mo; - model.rpar = []; -for (i=1;i<=lstsize(paramv);i+=1) { - model.rpar = [[model.rpar],[double(paramv[i-1].slice())]]; -} - model.sim[1-1] = this.funam; - exprs.in1 = lab_1[1-1]; - exprs.intype = lab_1[2-1]; - exprs.out = lab_1[3-1]; - exprs.outtype = lab_1[4-1]; - exprs.param = lab_1[5-1]; - exprs.paramv = list(); - if (Tparam_sz!=0) { - if (this.type[lab_2-1]==15) { -for (i=1;i<=lstsize(lab_2);i+=1) { - exprs.paramv[i-1] = lab_2[i-1]; -} - } else { -for (i=1;i<=size(lab_2,"*");i+=1) { - exprs.paramv[i-1] = lab_2[i-1]; -} -} -} - exprs.pprop = lab_1[6-1]; - exprs.nameF = lab_1[7-1]; - exprs.funtxt = ""; - x.model = model; - graphics.gr_i[1-1][1-1] = "txt=[\' "+nameF+" \'];"; - graphics.in_implicit = this.intype; - graphics.out_implicit = this.outtype; - graphics.exprs = exprs; - x.graphics = graphics; -break; -} -} + [ok,Tin,Tintype,Tout,Touttype,Tparam,pprop,Tfunam,lab_1] = getvalue("Set Modelica generic block parameters",[["Input variables: "],["Input variables types: "],["Output variables: "],["Output variables types:"],["Parameters in Modelica:"],["Parameters properties: "],["Model name in packages:"]],list("str",-1,"str",-1,"str",-1,"str",-1,"str",-1,"vec",-1,"str",-1),lab_1); + if (!ok) { + break; + } + ierr = execstr("in=stripblanks(evstr(Tin)); intype=stripblanks(evstr(Tintype)); out=stripblanks(evstr(Tout)); outtype=stripblanks(evstr(Touttype)); param=stripblanks(evstr(Tparam)); funam=stripblanks(Tfunam)","errcatch"); + if (ierr!=0) { + x_message("Error in evaluation of variables."); + ok = false; + } + if (ok) { + for (i=1;i<=size(this.in1,"*");i+=1) { + r = false; + ierr = execstr("r=validvar(in(i))","errcatch"); + if (!r) { + ok = false; + break; + } + } + if (!ok) { + x_message([["Invalid variable name for the input "+string(i)+"."],["\""+this.in1[i-1]+"\""],["Please choose another variable name."]]); + } + } + if (ok) { + for (i=1;i<=size(this.out,"*");i+=1) { + r = false; + ierr = execstr("r=validvar(out(i))","errcatch"); + if (!r) { + ok = false; + break; + } + } + if (!ok) { + x_message([["Invalid variable name for the output "+string(i)+"."],["\""+this.out[i-1]+"\""],["Please choose another variable name."]]); + } + } + if (ok) { + param = param.slice(); + for (i=1;i<=size(param,"*");i+=1) { + r = false; + ierr = execstr("r=validvar(param(i))","errcatch"); + if (!r) { + ok = false; + break; + } + } + if (!ok) { + x_message([["Invalid variable name for the parameter "+string(i)+"."],["\""+param[i-1]+"\""],["Please choose another variable name."]]); + } + } + if (ok) { + for (i=1;i<=size(this.intype,"*");i+=1) { + if (this.intype[i-1]!="E"&&this.intype[i-1]!="I") { + x_message("Input type should be \'E\' or \'I\'!"); + ok = false; + break; + } + } + } + if (ok) { + for (i=1;i<=size(this.outtype,"*");i+=1) { + if (this.outtype[i-1]!="E"&&this.outtype[i-1]!="I") { + x_message("Output type should be \'E\' or \'I\'!"); + ok = false; + break; + } + } + } + if (ok) { + if (or(size(this.intype)!=size(this.in1))) { + x_message("Input variables are not well defined!"); + ok = false; + } + } + if (ok) { + if (or(size(this.outtype)!=size(this.out))) { + x_message("Output variables are not well defined!"); + ok = false; + } + } + if (ok) { + pprop = pprop.slice(); + if ((size(param,"*")!=size(pprop,"*"))) { + x_message([["There is differences in"],["size of param and size "],["of param properties."]]); + ok = false; + } + } + if (ok) { + if (max(pprop)>2||min(pprop)<0) { + x_message([["Parameters properties must be :"],["0 : if it is a paramaters"],["1 : if it is an initial value of state,"],["2 : it it is a fixed initial state value."]]); + ok = false; + } + } + if (ok) { + if (this.funam=="") { + x_message("The model name is not defined!"); + ok = false; + } + } + if (ok) { + [dirF,nameF,extF] = fileparts(this.funam); + if ((extF!="")||(dirF!="")) { + x_message("Invalid model name!"); + ok = false; + } + } + if (ok) { + intypex = find(this.intype=="I"); + outtypex = find(this.outtype=="I"); + [model,graphics,ok] = set_io(model,graphics,list([ones(this.in1),ones(this.in1)],ones(this.in1)),list([ones(this.out),ones(this.out)],ones(this.out)),[],[],intypex,outtypex); + } + if (ok) { + Tparam_lab = evstr(Tparam); + Tparam_sz = size(Tparam_lab,"*"); + if (Tparam_sz>lstsize(lab_2)) { + for (i=1;i<=(Tparam_sz-lstsize(lab_2));i+=1) { + lab_2[$+1-1] = "0"; + } + } else if (Tparam_sz0) { + mo.parameters = list(transpose(param),paramv,transpose(pprop)); + } else { + mo.parameters = list(transpose(param),paramv); + } + } + model.equations = mo; + model.rpar = []; + for (i=1;i<=lstsize(paramv);i+=1) { + model.rpar = [[model.rpar],[double(paramv[i-1].slice())]]; + } + model.sim[1-1] = this.funam; + exprs.in1 = lab_1[1-1]; + exprs.intype = lab_1[2-1]; + exprs.out = lab_1[3-1]; + exprs.outtype = lab_1[4-1]; + exprs.param = lab_1[5-1]; + exprs.paramv = list(); + if (Tparam_sz!=0) { + if (this.type[lab_2-1]==15) { + for (i=1;i<=lstsize(lab_2);i+=1) { + exprs.paramv[i-1] = lab_2[i-1]; + } + } else { + for (i=1;i<=size(lab_2,"*");i+=1) { + exprs.paramv[i-1] = lab_2[i-1]; + } + } + } + exprs.pprop = lab_1[6-1]; + exprs.nameF = lab_1[7-1]; + exprs.funtxt = ""; + this.x.model = model; + graphics.gr_i[1-1][1-1] = "txt=[\' "+nameF+" \'];"; + graphics.in_implicit = this.intype; + graphics.out_implicit = this.outtype; + graphics.exprs = exprs; + this.x.graphics = graphics; + break; + } + } } } diff --git a/js/Misc/MPBLOCK.pickle b/js/Misc/MPBLOCK.pickle index 6ed6ac8b..ca02cacd 100644 --- a/js/Misc/MPBLOCK.pickle +++ b/js/Misc/MPBLOCK.pickle @@ -10,10 +10,12 @@ aS'outtype' p4 aS'funam' p5 -aS'type' +aS'x' p6 -aS'out' +aS'type' p7 -atp8 -Rp9 +aS'out' +p8 +atp9 +Rp10 . \ No newline at end of file diff --git a/js/Misc/PAL_f.js b/js/Misc/PAL_f.js index 3550fbc4..05c7ef2f 100644 --- a/js/Misc/PAL_f.js +++ b/js/Misc/PAL_f.js @@ -11,20 +11,21 @@ function PAL_f() { model.blocktype = "h"; model.dep_ut = [false,false]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); - x.graphics.id = scs.props.title[1-1]; + this.x = standard_define([2,2],model,[],gr_i); + this.x.graphics.id = scs.props.title[1-1]; } PAL_f.prototype.details = function PAL_f() { + return this.x; } PAL_f.prototype.get = function PAL_f() { } PAL_f.prototype.set = function PAL_f() { - [x,newparameters,needcompile,edited] = scicos(arg1.model.rpar); - arg1.graphics.id = x.props.title[1-1]; - arg1.model.rpar = x; - x = arg1; + [this.x,newparameters,needcompile,edited] = scicos(arg1.model.rpar); + arg1.graphics.id = this.x.props.title[1-1]; + arg1.model.rpar = this.x; + this.x = arg1; y = []; typ = []; -%exit=resume(false) + %exit=resume(false) } } diff --git a/js/Misc/PAL_f.pickle b/js/Misc/PAL_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/PAL_f.pickle +++ b/js/Misc/PAL_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/PENDULUM_ANIM.js b/js/Misc/PENDULUM_ANIM.js index 79896033..cebe2d42 100644 --- a/js/Misc/PENDULUM_ANIM.js +++ b/js/Misc/PENDULUM_ANIM.js @@ -18,46 +18,47 @@ function PENDULUM_ANIM() { model.dep_ut = [false,false]; exprs = string(model.rpar); gr_i = []; - x = standard_define([3,3],model,exprs,gr_i); + this.x = standard_define([3,3],model,exprs,gr_i); } PENDULUM_ANIM.prototype.details = function PENDULUM_ANIM() { + return this.x; } PENDULUM_ANIM.prototype.get = function PENDULUM_ANIM() { } PENDULUM_ANIM.prototype.set = function PENDULUM_ANIM() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; dstate = model.dstate; while (true) { - [ok,plen,csiz,phi,xmin,xmax,ymin,ymax,exprs] = scicos_getvalue("Set Scope parameters",[["pendulum length"],["cart size (square side)"],["slope"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (plen<=0||csiz<=0) { - mess = [[mess],["Pendulum length and cart size must be positive."],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (xmin>=xmax) { - mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - rpar = [[plen],[csiz],[phi],[xmin],[xmax],[ymin],[ymax]]; - model.rpar = rpar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,plen,csiz,phi,xmin,xmax,ymin,ymax,exprs] = scicos_getvalue("Set Scope parameters",[["pendulum length"],["cart size (square side)"],["slope"],["Xmin"],["Xmax"],["Ymin"],["Ymax"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (plen<=0||csiz<=0) { + mess = [[mess],["Pendulum length and cart size must be positive."],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (xmin>=xmax) { + mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + rpar = [[plen],[csiz],[phi],[xmin],[xmax],[ymin],[ymax]]; + model.rpar = rpar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Misc/PENDULUM_ANIM.pickle b/js/Misc/PENDULUM_ANIM.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/PENDULUM_ANIM.pickle +++ b/js/Misc/PENDULUM_ANIM.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/RATELIMITER.js b/js/Misc/RATELIMITER.js index 15037528..4a516d69 100644 --- a/js/Misc/RATELIMITER.js +++ b/js/Misc/RATELIMITER.js @@ -13,32 +13,33 @@ function RATELIMITER() { model.dep_ut = [true,false]; exprs = [[string(maxp)],[string(minp)]]; gr_i = []; - x = standard_define([3.5,2],model,exprs,gr_i); + this.x = standard_define([3.5,2],model,exprs,gr_i); } RATELIMITER.prototype.details = function RATELIMITER() { + return this.x; } RATELIMITER.prototype.get = function RATELIMITER() { } RATELIMITER.prototype.set = function RATELIMITER() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,maxp,minp,exprs] = scicos_getvalue("Set rate limiter parameters",[["max slope"],["min slope"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (maxp<=minp||maxp<=0||minp>=0) { -message("We must have max_slope> 0 > min_slope."); - } else { - rpar = [[maxp],[minp]]; - model.rpar = rpar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,maxp,minp,exprs] = scicos_getvalue("Set rate limiter parameters",[["max slope"],["min slope"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (maxp<=minp||maxp<=0||minp>=0) { + message("We must have max_slope> 0 > min_slope."); + } else { + rpar = [[maxp],[minp]]; + model.rpar = rpar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Misc/RATELIMITER.pickle b/js/Misc/RATELIMITER.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/RATELIMITER.pickle +++ b/js/Misc/RATELIMITER.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/RELATIONALOP.js b/js/Misc/RELATIONALOP.js index 7eb02adc..b78bd2a7 100644 --- a/js/Misc/RELATIONALOP.js +++ b/js/Misc/RELATIONALOP.js @@ -12,82 +12,83 @@ function RELATIONALOP() { model.dep_ut = [true,false]; exprs = [[string(ipar)],[string(0)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); - x.graphics.style = ["fontSize=13;fontStyle=1;displayedLabel="+label]; + this.x = standard_define([2,2],model,exprs,gr_i); + this.x.graphics.style = ["fontSize=13;fontStyle=1;displayedLabel="+label]; } RELATIONALOP.prototype.details = function RELATIONALOP() { + return this.x; } RELATIONALOP.prototype.get = function RELATIONALOP() { } RELATIONALOP.prototype.set = function RELATIONALOP() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,1)==2) { - exprs = [[exprs],[sci2exp(1)]]; -} + exprs = [[exprs],[sci2exp(1)]]; + } while (true) { - [ok,rule,zcr,Datatype,exprs] = scicos_getvalue("Set parameters",[["Operator: == (0), ~= (1), < (2), <= (3), > (4), >= (5)"],["Use zero crossing (no: 0), (yes: 1)","Datatype (1=double 3=int32 ...)"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - rule = int(rule); - if (zcr!=0) { - zcr = 1; -} - if ((rule<0)||(rule>5)) { -message("Incorrect operator "+string(rule)+" ; must be 0 to 5."); - ok = false; -} - if ((Datatype==1)) { - model.sim = list("relational_op",4); - } else if ((Datatype==3||Datatype==9)) { - model.sim = list("relational_op_i32",4); - } else if ((Datatype==4)) { - model.sim = list("relational_op_i16",4); - } else if ((Datatype==5)) { - model.sim = list("relational_op_i8",4); - } else if ((Datatype==6)) { - model.sim = list("relational_op_ui32",4); - } else if ((Datatype==7)) { - model.sim = list("relational_op_ui16",4); - } else if ((Datatype==8)) { - model.sim = list("relational_op_ui8",4); - } else { -message("Datatype is not supported"); - ok = false; -} - if (ok) { - it = Datatype*ones(1,2); - ot = Datatype; - in1 = [[-1,-2],[-1,-2]]; - out = [-1,-2]; - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); -} - if (ok) { - if (rule==0) { - label = "=="; - } else if (rule==1) { - label = "~="; - } else if (rule==2) { - label = "<"; - } else if (rule==3) { - label = "≤"; - } else if (rule==4) { - label = ">"; - } else if (rule==5) { - label = "≥"; -} - graphics.exprs = exprs; - graphics.style = ["fontSize=13;fontStyle=1;displayedLabel="+label]; - model.ipar = [rule]; - model.nzcross = zcr; - model.nmode = zcr; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,rule,zcr,Datatype,exprs] = scicos_getvalue("Set parameters",[["Operator: == (0), ~= (1), < (2), <= (3), > (4), >= (5)"],["Use zero crossing (no: 0), (yes: 1)","Datatype (1=double 3=int32 ...)"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + rule = int(rule); + if (zcr!=0) { + zcr = 1; + } + if ((rule<0)||(rule>5)) { + message("Incorrect operator "+string(rule)+" ; must be 0 to 5."); + ok = false; + } + if ((Datatype==1)) { + model.sim = list("relational_op",4); + } else if ((Datatype==3||Datatype==9)) { + model.sim = list("relational_op_i32",4); + } else if ((Datatype==4)) { + model.sim = list("relational_op_i16",4); + } else if ((Datatype==5)) { + model.sim = list("relational_op_i8",4); + } else if ((Datatype==6)) { + model.sim = list("relational_op_ui32",4); + } else if ((Datatype==7)) { + model.sim = list("relational_op_ui16",4); + } else if ((Datatype==8)) { + model.sim = list("relational_op_ui8",4); + } else { + message("Datatype is not supported"); + ok = false; + } + if (ok) { + it = Datatype*ones(1,2); + ot = Datatype; + in1 = [[-1,-2],[-1,-2]]; + out = [-1,-2]; + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); + } + if (ok) { + if (rule==0) { + label = "=="; + } else if (rule==1) { + label = "~="; + } else if (rule==2) { + label = "<"; + } else if (rule==3) { + label = "≤"; + } else if (rule==4) { + label = ">"; + } else if (rule==5) { + label = "≥"; + } + graphics.exprs = exprs; + graphics.style = ["fontSize=13;fontStyle=1;displayedLabel="+label]; + model.ipar = [rule]; + model.nzcross = zcr; + model.nmode = zcr; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Misc/RELATIONALOP.pickle b/js/Misc/RELATIONALOP.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/RELATIONALOP.pickle +++ b/js/Misc/RELATIONALOP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/SPLIT_f.js b/js/Misc/SPLIT_f.js index 0a6da420..da1266e6 100644 --- a/js/Misc/SPLIT_f.js +++ b/js/Misc/SPLIT_f.js @@ -7,13 +7,14 @@ function SPLIT_f() { model.out = [[-1],[-1],[-1]]; model.blocktype = "c"; model.dep_ut = [true,false]; - x = standard_define([1,1]/3,model,[],[]); + this.x = standard_define([1,1]/3,model,[],[]); } SPLIT_f.prototype.details = function SPLIT_f() { + return this.x; } SPLIT_f.prototype.get = function SPLIT_f() { } SPLIT_f.prototype.set = function SPLIT_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Misc/SPLIT_f.pickle b/js/Misc/SPLIT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/SPLIT_f.pickle +++ b/js/Misc/SPLIT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/SUPER_f.js b/js/Misc/SUPER_f.js index 2d42dcb2..38122ec1 100644 --- a/js/Misc/SUPER_f.js +++ b/js/Misc/SUPER_f.js @@ -19,13 +19,14 @@ function SUPER_f() { model.blocktype = "h"; model.dep_ut = [false,false]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } SUPER_f.prototype.details = function SUPER_f() { + return this.x; } SUPER_f.prototype.get = function SUPER_f() { } SUPER_f.prototype.set = function SUPER_f() { -xcos(arg1.model.rpar); + xcos(arg1.model.rpar); } } diff --git a/js/Misc/SUPER_f.pickle b/js/Misc/SUPER_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/SUPER_f.pickle +++ b/js/Misc/SUPER_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/TEXT_f.js b/js/Misc/TEXT_f.js index 6e3dfeed..ed29625a 100644 --- a/js/Misc/TEXT_f.js +++ b/js/Misc/TEXT_f.js @@ -12,55 +12,56 @@ function TEXT_f() { graphics.orig = [0,0]; graphics.sz = [2,1]; graphics.exprs = exprs; - x = mlist(["Text","graphics","model","void","gui"],graphics,model," ","TEXT_f"); + this.x = mlist(["Text","graphics","model","void","gui"],graphics,model," ","TEXT_f"); } TEXT_f.prototype.details = function TEXT_f() { + return this.x; } TEXT_f.prototype.get = function TEXT_f() { } TEXT_f.prototype.set = function TEXT_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; orig = graphics.orig; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==1) { - exprs = [[exprs],["3"],["1"]]; -} + exprs = [[exprs],["3"],["1"]]; + } while (true) { - [ok,txt,font,siz,exprs] = scicos_getvalue("Set Text block parameters",[["Text"],["Font number"],["Font size"]],list("str",-1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (font<=0||font>6) { -message("Font number must be greater than 0 and less than 7"); - ok = false; -} - if (siz<0) { -message("Font size must be positive"); - ok = false; -} - if (ok) { - graphics.exprs = exprs; - gh_winpal = gca(); - default_font_style = gh_winpal.font_style; - default_font_size = gh_winpal.font_size; - default_font_color = gh_winpal.font_color; - gh_winpal.font_style = font; - gh_winpal.font_size = siz; - r = xstringl(0,0,exprs[1-1],evstr(exprs[2-1]),evstr(exprs[3-1])); - gh_winpal.font_style = default_font_style; - gh_winpal.font_size = default_font_size; - gh_winpal.font_color = default_font_color; - sz = r.slice(3-1,4); - graphics.sz = sz; - x.graphics = graphics; - ipar = [[font],[siz]]; - model.rpar = txt; - model.ipar = ipar; - x.model = model; -break; -} -} + [ok,txt,font,siz,exprs] = scicos_getvalue("Set Text block parameters",[["Text"],["Font number"],["Font size"]],list("str",-1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (font<=0||font>6) { + message("Font number must be greater than 0 and less than 7"); + ok = false; + } + if (siz<0) { + message("Font size must be positive"); + ok = false; + } + if (ok) { + graphics.exprs = exprs; + gh_winpal = gca(); + default_font_style = gh_winpal.font_style; + default_font_size = gh_winpal.font_size; + default_font_color = gh_winpal.font_color; + gh_winpal.font_style = font; + gh_winpal.font_size = siz; + r = xstringl(0,0,exprs[1-1],evstr(exprs[2-1]),evstr(exprs[3-1])); + gh_winpal.font_style = default_font_style; + gh_winpal.font_size = default_font_size; + gh_winpal.font_color = default_font_color; + sz = r.slice(3-1,4); + graphics.sz = sz; + this.x.graphics = graphics; + ipar = [[font],[siz]]; + model.rpar = txt; + model.ipar = ipar; + this.x.model = model; + break; + } + } } } diff --git a/js/Misc/TEXT_f.pickle b/js/Misc/TEXT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/TEXT_f.pickle +++ b/js/Misc/TEXT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/c_block.js b/js/Misc/c_block.js index fa1655c1..2748ac98 100644 --- a/js/Misc/c_block.js +++ b/js/Misc/c_block.js @@ -26,49 +26,50 @@ function c_block() { model.dep_ut = [true,false]; label = list([[sci2exp(in1)],[sci2exp(out)],[strcat(sci2exp(rpar))],[funam]],list([])); gr_i = []; - x = standard_define([3,2],model,label,gr_i); + this.x = standard_define([3,2],model,label,gr_i); } c_block.prototype.details = function c_block() { + return this.x; } c_block.prototype.get = function c_block() { } c_block.prototype.set = function c_block() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; while (true) { - [ok,i,o,rpar,funam,lab] = scicos_getvalue("Set C_block parameters",[["input ports sizes"],["output port sizes"],["System parameters vector"],["function name"]],list("vec",-1,"vec",-1,"vec",-1,"str",-1),label[1-1]); - if (!ok) { -break; -} - if (funam==" ") { -break; -} - label[1-1] = lab; - rpar = rpar.slice(); - i = int(i.slice()); - ni = size(i,1); - o = int(o.slice()); - no = size(o,1); - tt = label[2-1]; - if (model.sim[1-1]!=funam||size(model.in1,"*")!=size(i,"*")||size(model.out,"*")!=size(o,"*")) { - tt = []; -} - [ok,tt] = CFORTR(funam,tt,i,o); - if (!ok) { -break; -} - [model,graphics,ok] = check_io(model,graphics,i,o,[],[]); - if (ok) { - model.sim[1-1] = funam; - model.rpar = rpar; - label[2-1] = tt; - x.model = model; - graphics.exprs = label; - x.graphics = graphics; -break; -} -} + [ok,i,o,rpar,funam,lab] = scicos_getvalue("Set C_block parameters",[["input ports sizes"],["output port sizes"],["System parameters vector"],["function name"]],list("vec",-1,"vec",-1,"vec",-1,"str",-1),label[1-1]); + if (!ok) { + break; + } + if (funam==" ") { + break; + } + label[1-1] = lab; + rpar = rpar.slice(); + i = int(i.slice()); + ni = size(i,1); + o = int(o.slice()); + no = size(o,1); + tt = label[2-1]; + if (model.sim[1-1]!=funam||size(model.in1,"*")!=size(i,"*")||size(model.out,"*")!=size(o,"*")) { + tt = []; + } + [ok,tt] = CFORTR(funam,tt,i,o); + if (!ok) { + break; + } + [model,graphics,ok] = check_io(model,graphics,i,o,[],[]); + if (ok) { + model.sim[1-1] = funam; + model.rpar = rpar; + label[2-1] = tt; + this.x.model = model; + graphics.exprs = label; + this.x.graphics = graphics; + break; + } + } } } diff --git a/js/Misc/c_block.pickle b/js/Misc/c_block.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/c_block.pickle +++ b/js/Misc/c_block.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/fortran_block.js b/js/Misc/fortran_block.js index d974716f..b403b16e 100644 --- a/js/Misc/fortran_block.js +++ b/js/Misc/fortran_block.js @@ -17,49 +17,50 @@ function fortran_block() { funam = "forty"; label = list([[sci2exp(model.in1)],[sci2exp(model.out)],[strcat(sci2exp(model.rpar))],[funam]],list([])); gr_i = []; - x = standard_define([4,2],model,label,gr_i); + this.x = standard_define([4,2],model,label,gr_i); } fortran_block.prototype.details = function fortran_block() { + return this.x; } fortran_block.prototype.get = function fortran_block() { } fortran_block.prototype.set = function fortran_block() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; while (true) { - [ok,i,o,rpar,funam,lab] = scicos_getvalue("Set fortran_block parameters",[["input ports sizes"],["output port sizes"],["System parameters vector"],["function name"]],list("vec",-1,"vec",-1,"vec",-1,"str",-1),label[1-1]); - if (!ok) { -break; -} - if (funam==" ") { -break; -} - label[1-1] = lab; - rpar = rpar.slice(); - i = int(i.slice()); - ni = size(i,1); - o = int(o.slice()); - no = size(o,1); - tt = label[2-1]; - if (model.sim[1-1]!=funam||size(model.in1,"*")!=size(i,"*")||size(model.out,"*")!=size(o,"*")) { - tt = []; -} - [ok,tt] = FORTR(funam,tt,i,o); - if (!ok) { -break; -} - [model,graphics,ok] = check_io(model,graphics,i,o,[],[]); - if (ok) { - model.sim[1-1] = funam; - model.rpar = rpar; - label[2-1] = tt; - x.model = model; - graphics.exprs = label; - x.graphics = graphics; -break; -} -} + [ok,i,o,rpar,funam,lab] = scicos_getvalue("Set fortran_block parameters",[["input ports sizes"],["output port sizes"],["System parameters vector"],["function name"]],list("vec",-1,"vec",-1,"vec",-1,"str",-1),label[1-1]); + if (!ok) { + break; + } + if (funam==" ") { + break; + } + label[1-1] = lab; + rpar = rpar.slice(); + i = int(i.slice()); + ni = size(i,1); + o = int(o.slice()); + no = size(o,1); + tt = label[2-1]; + if (model.sim[1-1]!=funam||size(model.in1,"*")!=size(i,"*")||size(model.out,"*")!=size(o,"*")) { + tt = []; + } + [ok,tt] = FORTR(funam,tt,i,o); + if (!ok) { + break; + } + [model,graphics,ok] = check_io(model,graphics,i,o,[],[]); + if (ok) { + model.sim[1-1] = funam; + model.rpar = rpar; + label[2-1] = tt; + this.x.model = model; + graphics.exprs = label; + this.x.graphics = graphics; + break; + } + } } } diff --git a/js/Misc/fortran_block.pickle b/js/Misc/fortran_block.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/fortran_block.pickle +++ b/js/Misc/fortran_block.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/func_block.js b/js/Misc/func_block.js index 42332455..d8083f99 100644 --- a/js/Misc/func_block.js +++ b/js/Misc/func_block.js @@ -9,9 +9,10 @@ function func_block() { model.dep_ut = [true,false]; exprs = "v=sin(u);y=u*v"; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } func_block.prototype.details = function func_block() { + return this.x; } func_block.prototype.get = function func_block() { } @@ -19,14 +20,14 @@ function func_block() { model = arg1.model; graphics = arg1.graphics; exprs = graphics.exprs; - x = arg1; - model = x.model; + this.x = arg1; + model = this.x.model; [ok,mac,exprs] = this.genfunc[exprs-1]; if (ok) { - model.sim = mac; - graphics.exprs = exprs; - x.model = model; - x.graphics = graphics; -} + model.sim = mac; + graphics.exprs = exprs; + this.x.model = model; + this.x.graphics = graphics; + } } } diff --git a/js/Misc/func_block.pickle b/js/Misc/func_block.pickle index 492b549b..d11f3bee 100644 --- a/js/Misc/func_block.pickle +++ b/js/Misc/func_block.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'genfunc' +S'x' p2 -atp3 -Rp4 +aS'genfunc' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Misc/generic_block.js b/js/Misc/generic_block.js index 1d319a0c..4b0fea72 100644 --- a/js/Misc/generic_block.js +++ b/js/Misc/generic_block.js @@ -18,80 +18,81 @@ function generic_block() { model.dep_ut = [true,false]; label = [[function_name],[sci2exp(funtyp)],[sci2exp(model.in1)],[sci2exp(model.out)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.firing)],["y"],["n"]]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } generic_block.prototype.details = function generic_block() { + return this.x; } generic_block.prototype.get = function generic_block() { } generic_block.prototype.set = function generic_block() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,function_name,funtyp,i,o,ci,co,xx,z,rpar,ipar,auto0,depu,dept,lab] = scicos_getvalue("Set GENERIC block parameters",[["simulation function"],["function type (0,1,2,..)"],["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%6)","str",1,"str",1),label); - if (!ok) { -break; -} - label = lab; - function_name = stripblanks(function_name); - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - ipar = int(ipar.slice()); - i = int(i.slice()); - o = int(o.slice()); - ci = int(ci.slice()); - co = int(co.slice()); - funtyp = int(funtyp); - if (funtyp<0) { -message("function type cannot be negative"); - ok = false; -} - if ([[ci],[co]]!=[]) { - if (max([[ci],[co]])>1) { -message("vector event links not supported"); - ok = false; -} -} - depu = stripblanks(depu); - if (part(depu,1)=="y") { - depu = true; - } else { - depu = false; -} - dept = stripblanks(dept); - if (part(dept,1)=="y") { - dept = true; - } else { - dept = false; -} - dep_ut = [depu,dept]; - if (ok) { - [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); -} - if (ok) { - if (funtyp==3) { - needcompile = 4; -} - model.sim = list(function_name,funtyp); - model.state = xx; - model.dstate = z; - model.rpar = rpar; - model.ipar = ipar; - model.firing = auto0; - model.dep_ut = dep_ut; - arg1.model = model; - graphics.exprs = label; - arg1.graphics = graphics; - x = arg1; -break; -} -} -needcompile=resume(needcompile) + [ok,function_name,funtyp,i,o,ci,co,xx,z,rpar,ipar,auto0,depu,dept,lab] = scicos_getvalue("Set GENERIC block parameters",[["simulation function"],["function type (0,1,2,..)"],["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%6)","str",1,"str",1),label); + if (!ok) { + break; + } + label = lab; + function_name = stripblanks(function_name); + xx = xx.slice(); + z = z.slice(); + rpar = rpar.slice(); + ipar = int(ipar.slice()); + i = int(i.slice()); + o = int(o.slice()); + ci = int(ci.slice()); + co = int(co.slice()); + funtyp = int(funtyp); + if (funtyp<0) { + message("function type cannot be negative"); + ok = false; + } + if ([[ci],[co]]!=[]) { + if (max([[ci],[co]])>1) { + message("vector event links not supported"); + ok = false; + } + } + depu = stripblanks(depu); + if (part(depu,1)=="y") { + depu = true; + } else { + depu = false; + } + dept = stripblanks(dept); + if (part(dept,1)=="y") { + dept = true; + } else { + dept = false; + } + dep_ut = [depu,dept]; + if (ok) { + [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); + } + if (ok) { + if (funtyp==3) { + needcompile = 4; + } + model.sim = list(function_name,funtyp); + model.state = xx; + model.dstate = z; + model.rpar = rpar; + model.ipar = ipar; + model.firing = auto0; + model.dep_ut = dep_ut; + arg1.model = model; + graphics.exprs = label; + arg1.graphics = graphics; + this.x = arg1; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Misc/generic_block.pickle b/js/Misc/generic_block.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/generic_block.pickle +++ b/js/Misc/generic_block.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/generic_block2.js b/js/Misc/generic_block2.js index 19b3a7e6..c42f797b 100644 --- a/js/Misc/generic_block2.js +++ b/js/Misc/generic_block2.js @@ -18,82 +18,83 @@ function generic_block2() { model.dep_ut = [true,false]; label = [[function_name],[sci2exp(funtyp)],[sci2exp(model.in1)],[sci2exp(model.out)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.nmode)],[sci2exp(model.nzcross)],[sci2exp(model.firing)],["y"],["n"]]; gr_i = []; - x = standard_define([2,2],model,label,gr_i); + this.x = standard_define([2,2],model,label,gr_i); } generic_block2.prototype.details = function generic_block2() { + return this.x; } generic_block2.prototype.get = function generic_block2() { } generic_block2.prototype.set = function generic_block2() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,function_name,funtyp,i,o,ci,co,xx,z,rpar,ipar,nmode,nzcr,auto0,depu,dept,lab] = scicos_getvalue("Set GENERIC block parameters",[["simulation function"],["function type (0,1,2,..)"],["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["number of modes"],["number of zero_crossings"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec","sum(%6)","str",1,"str",1),label); - if (!ok) { -break; -} - label = lab; - function_name = stripblanks(function_name); - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - ipar = int(ipar.slice()); - i = int(i.slice()); - o = int(o.slice()); - ci = int(ci.slice()); - co = int(co.slice()); - funtyp = int(funtyp); - if (funtyp<0) { -message("function type cannot be negative"); - ok = false; -} - if ([[ci],[co]]!=[]) { - if (max([[ci],[co]])>1) { -message("vector event links not supported"); - ok = false; -} -} - depu = stripblanks(depu); - if (part(depu,1)=="y") { - depu = true; - } else { - depu = false; -} - dept = stripblanks(dept); - if (part(dept,1)=="y") { - dept = true; - } else { - dept = false; -} - dep_ut = [depu,dept]; - if (ok) { - [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); -} - if (ok) { - if (funtyp==3) { - needcompile = 4; -} - model.sim = list(function_name,funtyp); - model.state = xx; - model.dstate = z; - model.rpar = rpar; - model.ipar = ipar; - model.firing = auto0; - model.nzcross = nzcr; - model.nmode = nmode; - model.dep_ut = dep_ut; - arg1.model = model; - graphics.exprs = label; - arg1.graphics = graphics; - x = arg1; -break; -} -} -needcompile=resume(needcompile) + [ok,function_name,funtyp,i,o,ci,co,xx,z,rpar,ipar,nmode,nzcr,auto0,depu,dept,lab] = scicos_getvalue("Set GENERIC block parameters",[["simulation function"],["function type (0,1,2,..)"],["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["number of modes"],["number of zero_crossings"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec","sum(%6)","str",1,"str",1),label); + if (!ok) { + break; + } + label = lab; + function_name = stripblanks(function_name); + xx = xx.slice(); + z = z.slice(); + rpar = rpar.slice(); + ipar = int(ipar.slice()); + i = int(i.slice()); + o = int(o.slice()); + ci = int(ci.slice()); + co = int(co.slice()); + funtyp = int(funtyp); + if (funtyp<0) { + message("function type cannot be negative"); + ok = false; + } + if ([[ci],[co]]!=[]) { + if (max([[ci],[co]])>1) { + message("vector event links not supported"); + ok = false; + } + } + depu = stripblanks(depu); + if (part(depu,1)=="y") { + depu = true; + } else { + depu = false; + } + dept = stripblanks(dept); + if (part(dept,1)=="y") { + dept = true; + } else { + dept = false; + } + dep_ut = [depu,dept]; + if (ok) { + [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); + } + if (ok) { + if (funtyp==3) { + needcompile = 4; + } + model.sim = list(function_name,funtyp); + model.state = xx; + model.dstate = z; + model.rpar = rpar; + model.ipar = ipar; + model.firing = auto0; + model.nzcross = nzcr; + model.nmode = nmode; + model.dep_ut = dep_ut; + arg1.model = model; + graphics.exprs = label; + arg1.graphics = graphics; + this.x = arg1; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Misc/generic_block2.pickle b/js/Misc/generic_block2.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/generic_block2.pickle +++ b/js/Misc/generic_block2.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/generic_block3.js b/js/Misc/generic_block3.js index 6e4c62dc..179c1613 100644 --- a/js/Misc/generic_block3.js +++ b/js/Misc/generic_block3.js @@ -14,90 +14,91 @@ function generic_block3() { model.dep_ut = [true,false]; label = [[function_name],[sci2exp(funtyp)],[sci2exp([model.in1,model.in2])],[sci2exp(model.intyp)],[sci2exp([model.out,model.out2]),sci2exp(model.outtyp)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.odstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.opar)],[sci2exp(model.nmode)],[sci2exp(model.nzcross)],[sci2exp(model.firing)],["y"],["n"]]; gr_i = []; - x = standard_define([4,2],model,label,gr_i); + this.x = standard_define([4,2],model,label,gr_i); } generic_block3.prototype.details = function generic_block3() { + return this.x; } generic_block3.prototype.get = function generic_block3() { } generic_block3.prototype.set = function generic_block3() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; label = graphics.exprs; if (size(label,"*")==14) { - label[9-1] = []; -} + label[9-1] = []; + } while (true) { - [ok,function_name,funtyp,in1,it,out,ot,ci,co,xx,z,oz,rpar,ipar,opar,nmode,nzcr,auto0,depu,dept,lab] = scicos_getvalue("Set GENERIC block parameters",[["Simulation function"],["Function type (0,1,2,..)"],["Input ports sizes"],["Input ports type"],["Output port sizes"],["Output ports type"],["Input event ports sizes"],["Output events ports sizes"],["Initial continuous state"],["Initial discrete state"],["Initial object state"],["Real parameters vector"],["Integer parameters vector"],["Object parameters list"],["Number of modes"],["Number of zero crossings"],["Initial firing vector (<0 for no firing)"],["Direct feedthrough (y or n)"],["Time dependence (y or n)"]],list("str",1,"vec",1,"mat",[-1,2],"vec",-1,"mat",[-1,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"lis",-1,"vec",-1,"vec",-1,"lis",-1,"vec",1,"vec",1,"vec","sum(%8)","str",1,"str",1),label); - if (!ok) { -break; -} - label = lab; - function_name = stripblanks(function_name); - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - ipar = int(ipar.slice()); - ci = int(ci.slice()); - co = int(co.slice()); - funtyp = funtyp; - if (funtyp<0) { -message("function type cannot be negative"); - ok = false; -} - if ([[ci],[co]]!=[]) { - if (max([[ci],[co]])>1) { -message("vector event links not supported"); - ok = false; -} -} - if (this.type[opar-1]!=15) { -message("object parameter must be a list"); - ok = false; -} - if (this.type[oz-1]!=15) { -message("discrete object state must be a list"); - ok = false; -} - depu = stripblanks(depu); - if (part(depu,1)=="y") { - depu = true; - } else { - depu = false; -} - dept = stripblanks(dept); - if (part(dept,1)=="y") { - dept = true; - } else { - dept = false; -} - dep_ut = [depu,dept]; - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ci,co); -} - if (ok) { - if (funtyp==3) { - needcompile = 4; -} - model.sim = list(function_name,funtyp); - model.state = xx; - model.dstate = z; - model.odstate = oz; - model.rpar = rpar; - model.ipar = ipar; - model.opar = opar; - model.firing = auto0; - model.nzcross = nzcr; - model.nmode = nmode; - model.dep_ut = dep_ut; - arg1.model = model; - graphics.exprs = label; - arg1.graphics = graphics; - x = arg1; -break; -} -} -needcompile=resume(needcompile) + [ok,function_name,funtyp,in1,it,out,ot,ci,co,xx,z,oz,rpar,ipar,opar,nmode,nzcr,auto0,depu,dept,lab] = scicos_getvalue("Set GENERIC block parameters",[["Simulation function"],["Function type (0,1,2,..)"],["Input ports sizes"],["Input ports type"],["Output port sizes"],["Output ports type"],["Input event ports sizes"],["Output events ports sizes"],["Initial continuous state"],["Initial discrete state"],["Initial object state"],["Real parameters vector"],["Integer parameters vector"],["Object parameters list"],["Number of modes"],["Number of zero crossings"],["Initial firing vector (<0 for no firing)"],["Direct feedthrough (y or n)"],["Time dependence (y or n)"]],list("str",1,"vec",1,"mat",[-1,2],"vec",-1,"mat",[-1,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"lis",-1,"vec",-1,"vec",-1,"lis",-1,"vec",1,"vec",1,"vec","sum(%8)","str",1,"str",1),label); + if (!ok) { + break; + } + label = lab; + function_name = stripblanks(function_name); + xx = xx.slice(); + z = z.slice(); + rpar = rpar.slice(); + ipar = int(ipar.slice()); + ci = int(ci.slice()); + co = int(co.slice()); + funtyp = funtyp; + if (funtyp<0) { + message("function type cannot be negative"); + ok = false; + } + if ([[ci],[co]]!=[]) { + if (max([[ci],[co]])>1) { + message("vector event links not supported"); + ok = false; + } + } + if (this.type[opar-1]!=15) { + message("object parameter must be a list"); + ok = false; + } + if (this.type[oz-1]!=15) { + message("discrete object state must be a list"); + ok = false; + } + depu = stripblanks(depu); + if (part(depu,1)=="y") { + depu = true; + } else { + depu = false; + } + dept = stripblanks(dept); + if (part(dept,1)=="y") { + dept = true; + } else { + dept = false; + } + dep_ut = [depu,dept]; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),ci,co); + } + if (ok) { + if (funtyp==3) { + needcompile = 4; + } + model.sim = list(function_name,funtyp); + model.state = xx; + model.dstate = z; + model.odstate = oz; + model.rpar = rpar; + model.ipar = ipar; + model.opar = opar; + model.firing = auto0; + model.nzcross = nzcr; + model.nmode = nmode; + model.dep_ut = dep_ut; + arg1.model = model; + graphics.exprs = label; + arg1.graphics = graphics; + this.x = arg1; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Misc/generic_block3.pickle b/js/Misc/generic_block3.pickle index 0ac03d7f..54a16ece 100644 --- a/js/Misc/generic_block3.pickle +++ b/js/Misc/generic_block3.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'type' +S'x' p2 -atp3 -Rp4 +aS'type' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Misc/scifunc_block.js b/js/Misc/scifunc_block.js index 9e45f43e..c491639d 100644 --- a/js/Misc/scifunc_block.js +++ b/js/Misc/scifunc_block.js @@ -26,67 +26,68 @@ function scifunc_block() { model.dep_ut = [true,false]; exprs = list([[sci2exp(in1)],[sci2exp(out)],[sci2exp(clkin)],[sci2exp(clkout)],[strcat(sci2exp(x0))],[strcat(sci2exp(z0))],[strcat(sci2exp(rpar))],[sci2exp(auto)]],list("y1=sin(u1)"," "," ","y1=sin(u1)"," "," "," ")); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } scifunc_block.prototype.details = function scifunc_block() { + return this.x; } scifunc_block.prototype.get = function scifunc_block() { } scifunc_block.prototype.set = function scifunc_block() { needcompile = 0; - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; exprs = graphics.exprs; if (size(exprs[1-1],"*")==8) { - exprs[1-1][9-1] = "0"; -} + exprs[1-1][9-1] = "0"; + } while (true) { - [ok,i,o,ci,co,xx,z,rpar,auto0,deptime,lab] = scicos_getvalue([["Set scifunc_block parameters"],["only regular blocks supported"]],[["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["System parameters vector"],["initial firing vector (<0 for no firing)"],["is block always active (0:no, 1:yes)"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%4)","vec",1),exprs[1-1]); - if (!ok) { -break; -} - exprs[1-1] = lab; - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - nrp = prod(size(rpar)); - i = int(i.slice()); - ni = size(i,1); - o = int(o.slice()); - no = size(o,1); - ci = int(ci.slice()); - nci = size(ci,1); - co = int(co.slice()); - nco = size(co,1); - [ok,tt,dep_ut] = genfunc1(exprs[2-1],i,o,nci,nco,size(xx,1),size(z,1),nrp,"c"); - dep_ut[2-1] = (1==deptime); - if (!ok) { -break; -} - [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); - if (ok) { - auto = auto0; - model.state = xx; - model.dstate = z; - model.rpar = rpar; - if (model.ipar!=0) { - model.opar = model.ipar; - model.ipar = 0; -} - if (or(model.opar!=tt)) { - needcompile = 4; -} - model.opar = tt; - model.firing = auto; - model.dep_ut = dep_ut; - x.model = model; - exprs[2-1] = tt; - graphics.exprs = exprs; - x.graphics = graphics; -break; -} -} -needcompile=resume(needcompile) + [ok,i,o,ci,co,xx,z,rpar,auto0,deptime,lab] = scicos_getvalue([["Set scifunc_block parameters"],["only regular blocks supported"]],[["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["System parameters vector"],["initial firing vector (<0 for no firing)"],["is block always active (0:no, 1:yes)"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%4)","vec",1),exprs[1-1]); + if (!ok) { + break; + } + exprs[1-1] = lab; + xx = xx.slice(); + z = z.slice(); + rpar = rpar.slice(); + nrp = prod(size(rpar)); + i = int(i.slice()); + ni = size(i,1); + o = int(o.slice()); + no = size(o,1); + ci = int(ci.slice()); + nci = size(ci,1); + co = int(co.slice()); + nco = size(co,1); + [ok,tt,dep_ut] = genfunc1(exprs[2-1],i,o,nci,nco,size(xx,1),size(z,1),nrp,"c"); + dep_ut[2-1] = (1==deptime); + if (!ok) { + break; + } + [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); + if (ok) { + auto = auto0; + model.state = xx; + model.dstate = z; + model.rpar = rpar; + if (model.ipar!=0) { + model.opar = model.ipar; + model.ipar = 0; + } + if (or(model.opar!=tt)) { + needcompile = 4; + } + model.opar = tt; + model.firing = auto; + model.dep_ut = dep_ut; + this.x.model = model; + exprs[2-1] = tt; + graphics.exprs = exprs; + this.x.graphics = graphics; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Misc/scifunc_block.pickle b/js/Misc/scifunc_block.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/scifunc_block.pickle +++ b/js/Misc/scifunc_block.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Misc/scifunc_block_m.js b/js/Misc/scifunc_block_m.js index 1a181dc5..7571eac0 100644 --- a/js/Misc/scifunc_block_m.js +++ b/js/Misc/scifunc_block_m.js @@ -31,64 +31,65 @@ function scifunc_block_m() { model.dep_ut = [true,false]; exprs = list([[sci2exp([in1,in1])],[sci2exp([out,out])],[sci2exp(clkin)],[sci2exp(clkout)],[strcat(sci2exp(x0))],[strcat(sci2exp(z0))],[strcat(sci2exp(rpar))],[sci2exp(auto)],[sci2exp(0)]],list("y1=sin(u1)"," "," ","y1=sin(u1)"," "," "," ")); gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } scifunc_block_m.prototype.details = function scifunc_block_m() { + return this.x; } scifunc_block_m.prototype.get = function scifunc_block_m() { } scifunc_block_m.prototype.set = function scifunc_block_m() { needcompile = 0; - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; exprs = graphics.exprs; while (true) { - [ok,i,o,ci,co,xx,z,rpar,auto0,deptime,lab] = scicos_getvalue([["Set scifunc_block parameters"],["only regular blocks supported"]],[["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["System parameters vector"],["initial firing vector (<0 for no firing)"],["is block always active (0:no, 1:yes)"]],list("mat",[-1,2],"mat",[-2,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1),exprs[1-1]); - if (!ok) { -break; -} - exprs[1-1] = lab; - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - it = ones(1,size(i,1)); - ot = ones(1,size(o,1)); - nrp = prod(size(rpar)); - ni = size(i,1); - no = size(o,1); - ci = int(ci.slice()); - nci = size(ci,1); - co = int(co.slice()); - nco = size(co,1); - [ok,tt,dep_ut] = genfunc2(exprs[2-1],i,o,nci,nco,size(xx,1),size(z,1),nrp,"c"); - dep_ut[2-1] = (1==deptime); - if (!ok) { -break; -} - [model,graphics,ok] = set_io(model,graphics,list(i,it),list(o,ot),ci,co); - if (ok) { - auto = auto0; - model.state = xx; - model.dstate = z; - model.rpar = rpar; - if (model.ipar!=0) { - model.opar = model.ipar; - model.ipar = 0; -} - if (or(model.opar!=tt)) { - needcompile = 4; -} - model.opar = tt; - model.firing = auto; - model.dep_ut = dep_ut; - x.model = model; - exprs[2-1] = tt; - graphics.exprs = exprs; - x.graphics = graphics; -break; -} -} -needcompile=resume(needcompile) + [ok,i,o,ci,co,xx,z,rpar,auto0,deptime,lab] = scicos_getvalue([["Set scifunc_block parameters"],["only regular blocks supported"]],[["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["System parameters vector"],["initial firing vector (<0 for no firing)"],["is block always active (0:no, 1:yes)"]],list("mat",[-1,2],"mat",[-2,2],"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1),exprs[1-1]); + if (!ok) { + break; + } + exprs[1-1] = lab; + xx = xx.slice(); + z = z.slice(); + rpar = rpar.slice(); + it = ones(1,size(i,1)); + ot = ones(1,size(o,1)); + nrp = prod(size(rpar)); + ni = size(i,1); + no = size(o,1); + ci = int(ci.slice()); + nci = size(ci,1); + co = int(co.slice()); + nco = size(co,1); + [ok,tt,dep_ut] = genfunc2(exprs[2-1],i,o,nci,nco,size(xx,1),size(z,1),nrp,"c"); + dep_ut[2-1] = (1==deptime); + if (!ok) { + break; + } + [model,graphics,ok] = set_io(model,graphics,list(i,it),list(o,ot),ci,co); + if (ok) { + auto = auto0; + model.state = xx; + model.dstate = z; + model.rpar = rpar; + if (model.ipar!=0) { + model.opar = model.ipar; + model.ipar = 0; + } + if (or(model.opar!=tt)) { + needcompile = 4; + } + model.opar = tt; + model.firing = auto; + model.dep_ut = dep_ut; + this.x.model = model; + exprs[2-1] = tt; + graphics.exprs = exprs; + this.x.graphics = graphics; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Misc/scifunc_block_m.pickle b/js/Misc/scifunc_block_m.pickle index 154645d8..0d1dde24 100644 --- a/js/Misc/scifunc_block_m.pickle +++ b/js/Misc/scifunc_block_m.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/ABSBLK_f.js b/js/NonLinear/ABSBLK_f.js index a5cacb5f..7ab1aff9 100644 --- a/js/NonLinear/ABSBLK_f.js +++ b/js/NonLinear/ABSBLK_f.js @@ -8,13 +8,14 @@ function ABSBLK_f() { model.blocktype = "c"; model.dep_ut = [true,false]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } ABSBLK_f.prototype.details = function ABSBLK_f() { + return this.x; } ABSBLK_f.prototype.get = function ABSBLK_f() { } ABSBLK_f.prototype.set = function ABSBLK_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/NonLinear/ABSBLK_f.pickle b/js/NonLinear/ABSBLK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/ABSBLK_f.pickle +++ b/js/NonLinear/ABSBLK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/ABS_VALUE.js b/js/NonLinear/ABS_VALUE.js index 6d946c72..9d5074eb 100644 --- a/js/NonLinear/ABS_VALUE.js +++ b/js/NonLinear/ABS_VALUE.js @@ -12,35 +12,36 @@ function ABS_VALUE() { model.dep_ut = [true,false]; exprs = [string([1])]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } ABS_VALUE.prototype.details = function ABS_VALUE() { + return this.x; } ABS_VALUE.prototype.get = function ABS_VALUE() { } ABS_VALUE.prototype.set = function ABS_VALUE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,zcr,exprs] = scicos_getvalue("Set block parameters",["use zero_crossing (1: yes) (0:no)"],list("vec",1),exprs); - if (!ok) { -break; -} - graphics.exprs = exprs; - if (ok) { - if (zcr!=0) { - model.nmode = -1; - model.nzcross = -1; - } else { - model.nmode = 0; - model.nzcross = 0; -} - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,zcr,exprs] = scicos_getvalue("Set block parameters",["use zero_crossing (1: yes) (0:no)"],list("vec",1),exprs); + if (!ok) { + break; + } + graphics.exprs = exprs; + if (ok) { + if (zcr!=0) { + model.nmode = -1; + model.nzcross = -1; + } else { + model.nmode = 0; + model.nzcross = 0; + } + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/ABS_VALUE.pickle b/js/NonLinear/ABS_VALUE.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/ABS_VALUE.pickle +++ b/js/NonLinear/ABS_VALUE.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/COSBLK_f.js b/js/NonLinear/COSBLK_f.js index 2710f73f..5420afd1 100644 --- a/js/NonLinear/COSBLK_f.js +++ b/js/NonLinear/COSBLK_f.js @@ -9,13 +9,14 @@ function COSBLK_f() { model.blocktype = "c"; model.dep_ut = [true,false]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } COSBLK_f.prototype.details = function COSBLK_f() { + return this.x; } COSBLK_f.prototype.get = function COSBLK_f() { } COSBLK_f.prototype.set = function COSBLK_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/NonLinear/COSBLK_f.pickle b/js/NonLinear/COSBLK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/COSBLK_f.pickle +++ b/js/NonLinear/COSBLK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/DLRADAPT_f.js b/js/NonLinear/DLRADAPT_f.js index 2a151d95..e985a696 100644 --- a/js/NonLinear/DLRADAPT_f.js +++ b/js/NonLinear/DLRADAPT_f.js @@ -20,39 +20,40 @@ function DLRADAPT_f() { model.dep_ut = [true,false]; exprs = [[sci2exp(p)],[sci2exp(rn)],[sci2exp(rd,0)],[sci2exp(g)],[sci2exp(last_u)],[sci2exp(last_y)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } DLRADAPT_f.prototype.details = function DLRADAPT_f() { + return this.x; } DLRADAPT_f.prototype.get = function DLRADAPT_f() { } DLRADAPT_f.prototype.set = function DLRADAPT_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,p,rn,rd,g,last_u,last_y,exprs] = scicos_getvalue("Set block parameters",[["Vector of p mesh points"],["Numerator roots (one line for each mesh)"],["Denominator roots (one line for each mesh)"],["Vector of gain at mesh points"],["past inputs (Num degree values)"],["past outputs (Den degree values)"]],list("vec",-1,"mat",[-1,-1],"mat",["size(%1,\'*\')","-1"],"vec","size(%1,\'*\')","vec","size(%2,2)","vec","size(%3,2)"),exprs); - if (!ok) { -break; -} - m = size(rn,2); - [npt,n] = size(rd); - if (m>=n) { -message("Transfer must be strictly proper"); - } else if (size(rn,1)!=0&&size(rn,1)!=size(p,"*")) { -message("Numerator roots matrix row size\'s is incorrect"); - } else { - rpar = [[p.slice()],[real(rn.slice())],[imag(rn.slice())],[real(rd.slice())],[imag(rd.slice())],[g.slice()]]; - ipar = [[m],[n],[npt]]; - model.dstate = [[last_u.slice()],[last_y.slice()]]; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,p,rn,rd,g,last_u,last_y,exprs] = scicos_getvalue("Set block parameters",[["Vector of p mesh points"],["Numerator roots (one line for each mesh)"],["Denominator roots (one line for each mesh)"],["Vector of gain at mesh points"],["past inputs (Num degree values)"],["past outputs (Den degree values)"]],list("vec",-1,"mat",[-1,-1],"mat",["size(%1,\'*\')","-1"],"vec","size(%1,\'*\')","vec","size(%2,2)","vec","size(%3,2)"),exprs); + if (!ok) { + break; + } + m = size(rn,2); + [npt,n] = size(rd); + if (m>=n) { + message("Transfer must be strictly proper"); + } else if (size(rn,1)!=0&&size(rn,1)!=size(p,"*")) { + message("Numerator roots matrix row size\'s is incorrect"); + } else { + rpar = [[p.slice()],[real(rn.slice())],[imag(rn.slice())],[real(rd.slice())],[imag(rd.slice())],[g.slice()]]; + ipar = [[m],[n],[npt]]; + model.dstate = [[last_u.slice()],[last_y.slice()]]; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/DLRADAPT_f.pickle b/js/NonLinear/DLRADAPT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/DLRADAPT_f.pickle +++ b/js/NonLinear/DLRADAPT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/EXPBLK_f.js b/js/NonLinear/EXPBLK_f.js index e3b39f45..05b21300 100644 --- a/js/NonLinear/EXPBLK_f.js +++ b/js/NonLinear/EXPBLK_f.js @@ -12,34 +12,35 @@ function EXPBLK_f() { model.dep_ut = [true,false]; exprs = ["%e"]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } EXPBLK_f.prototype.details = function EXPBLK_f() { + return this.x; } EXPBLK_f.prototype.get = function EXPBLK_f() { } EXPBLK_f.prototype.set = function EXPBLK_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==2) { - exprs = exprs[2-1]; -} + exprs = exprs[2-1]; + } while (true) { - [ok,a,exprs] = scicos_getvalue("Set a^u block parameters","a (>0)",list("vec",1),exprs); - if (!ok) { -break; -} - if (or(a<=0)) { -message("a^u : a must be positive"); - } else { - graphics.exprs = exprs; - model.rpar = a; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,a,exprs] = scicos_getvalue("Set a^u block parameters","a (>0)",list("vec",1),exprs); + if (!ok) { + break; + } + if (or(a<=0)) { + message("a^u : a must be positive"); + } else { + graphics.exprs = exprs; + model.rpar = a; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/EXPBLK_f.pickle b/js/NonLinear/EXPBLK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/EXPBLK_f.pickle +++ b/js/NonLinear/EXPBLK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/EXPBLK_m.js b/js/NonLinear/EXPBLK_m.js index 0c162d3d..1731a333 100644 --- a/js/NonLinear/EXPBLK_m.js +++ b/js/NonLinear/EXPBLK_m.js @@ -16,34 +16,35 @@ function EXPBLK_m() { model.dep_ut = [true,false]; exprs = ["%e"]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } EXPBLK_m.prototype.details = function EXPBLK_m() { + return this.x; } EXPBLK_m.prototype.get = function EXPBLK_m() { } EXPBLK_m.prototype.set = function EXPBLK_m() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==2) { - exprs = exprs[2-1]; -} + exprs = exprs[2-1]; + } while (true) { - [ok,a,exprs] = scicos_getvalue("Set a^u block parameters","a (>0)",list("vec",1),exprs); - if (!ok) { -break; -} - if (or(a<=0)) { -message("a^u : a must be positive"); - } else { - graphics.exprs = exprs; - model.rpar = a; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,a,exprs] = scicos_getvalue("Set a^u block parameters","a (>0)",list("vec",1),exprs); + if (!ok) { + break; + } + if (or(a<=0)) { + message("a^u : a must be positive"); + } else { + graphics.exprs = exprs; + model.rpar = a; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/EXPBLK_m.pickle b/js/NonLinear/EXPBLK_m.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/EXPBLK_m.pickle +++ b/js/NonLinear/EXPBLK_m.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/FSV_f.js b/js/NonLinear/FSV_f.js index 8820fd33..eedc7cf2 100644 --- a/js/NonLinear/FSV_f.js +++ b/js/NonLinear/FSV_f.js @@ -10,13 +10,14 @@ function FSV_f() { model.dep_ut = [true,false]; exprs = " "; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } FSV_f.prototype.details = function FSV_f() { + return this.x; } FSV_f.prototype.get = function FSV_f() { } FSV_f.prototype.set = function FSV_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/NonLinear/FSV_f.pickle b/js/NonLinear/FSV_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/FSV_f.pickle +++ b/js/NonLinear/FSV_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/INTRP2BLK_f.js b/js/NonLinear/INTRP2BLK_f.js index 479b0919..34a642be 100644 --- a/js/NonLinear/INTRP2BLK_f.js +++ b/js/NonLinear/INTRP2BLK_f.js @@ -14,36 +14,37 @@ function INTRP2BLK_f() { model.dep_ut = [true,false]; exprs = [[strcat(sci2exp(a))],[strcat(sci2exp(b))],[strcat(sci2exp(c,0))]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } INTRP2BLK_f.prototype.details = function INTRP2BLK_f() { + return this.x; } INTRP2BLK_f.prototype.get = function INTRP2BLK_f() { } INTRP2BLK_f.prototype.set = function INTRP2BLK_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,a,b,c,exprs] = scicos_getvalue("Set Interpolation block parameters",[["X coord."],["Y coord."],["Z values"]],list("vec",-1,"vec",-1,"mat",[-1,-1]),exprs); - if (!ok) { -break; -} - if (size(a,"*")!=size(c,"c")||size(b,"*")!=size(c,"r")) { -message("incompatible dimension"); - } else if (min(a.slice(2-1,$)-a.slice(1-1,$-1))<=0||min(b.slice(2-1,$)-b.slice(1-1,$-1))<=0) { -message("X and Y must be strictly increasing"); - } else { - if (ok) { - graphics.exprs = exprs; - model.rpar = [[a.slice()],[b.slice()],[c.slice()]]; - model.ipar = [[size(a,"*")],[size(b,"*")]]; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,a,b,c,exprs] = scicos_getvalue("Set Interpolation block parameters",[["X coord."],["Y coord."],["Z values"]],list("vec",-1,"vec",-1,"mat",[-1,-1]),exprs); + if (!ok) { + break; + } + if (size(a,"*")!=size(c,"c")||size(b,"*")!=size(c,"r")) { + message("incompatible dimension"); + } else if (min(a.slice(2-1,$)-a.slice(1-1,$-1))<=0||min(b.slice(2-1,$)-b.slice(1-1,$-1))<=0) { + message("X and Y must be strictly increasing"); + } else { + if (ok) { + graphics.exprs = exprs; + model.rpar = [[a.slice()],[b.slice()],[c.slice()]]; + model.ipar = [[size(a,"*")],[size(b,"*")]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/NonLinear/INTRP2BLK_f.pickle b/js/NonLinear/INTRP2BLK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/INTRP2BLK_f.pickle +++ b/js/NonLinear/INTRP2BLK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/INTRPLBLK_f.js b/js/NonLinear/INTRPLBLK_f.js index 0baee92b..6ff946f6 100644 --- a/js/NonLinear/INTRPLBLK_f.js +++ b/js/NonLinear/INTRPLBLK_f.js @@ -12,35 +12,36 @@ function INTRPLBLK_f() { model.dep_ut = [true,false]; exprs = [[strcat(sci2exp(a))],[strcat(sci2exp(b))]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } INTRPLBLK_f.prototype.details = function INTRPLBLK_f() { + return this.x; } INTRPLBLK_f.prototype.get = function INTRPLBLK_f() { } INTRPLBLK_f.prototype.set = function INTRPLBLK_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,a,b,exprs] = scicos_getvalue("Set Interpolation block parameters",[["X coord."],["Y coord."]],list("vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - if (size(a,"*")!=size(b,"*")) { -message("X and Y must have the same size"); - } else if (min(a.slice(2-1,$)-a.slice(1-1,$-1))<=0) { -message("X must be strictly increasing"); - } else { - if (ok) { - graphics.exprs = exprs; - model.rpar = [[a.slice()],[b.slice()]]; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,a,b,exprs] = scicos_getvalue("Set Interpolation block parameters",[["X coord."],["Y coord."]],list("vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + if (size(a,"*")!=size(b,"*")) { + message("X and Y must have the same size"); + } else if (min(a.slice(2-1,$)-a.slice(1-1,$-1))<=0) { + message("X must be strictly increasing"); + } else { + if (ok) { + graphics.exprs = exprs; + model.rpar = [[a.slice()],[b.slice()]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/NonLinear/INTRPLBLK_f.pickle b/js/NonLinear/INTRPLBLK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/INTRPLBLK_f.pickle +++ b/js/NonLinear/INTRPLBLK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/INVBLK.js b/js/NonLinear/INVBLK.js index d5d559f3..2d359c7b 100644 --- a/js/NonLinear/INVBLK.js +++ b/js/NonLinear/INVBLK.js @@ -10,13 +10,14 @@ function INVBLK() { model.dep_ut = [true,false]; exprs = " "; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } INVBLK.prototype.details = function INVBLK() { + return this.x; } INVBLK.prototype.get = function INVBLK() { } INVBLK.prototype.set = function INVBLK() { - x = arg1; + this.x = arg1; } } diff --git a/js/NonLinear/INVBLK.pickle b/js/NonLinear/INVBLK.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/INVBLK.pickle +++ b/js/NonLinear/INVBLK.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/INVBLK_f.js b/js/NonLinear/INVBLK_f.js index bca99397..db0136bf 100644 --- a/js/NonLinear/INVBLK_f.js +++ b/js/NonLinear/INVBLK_f.js @@ -10,13 +10,14 @@ function INVBLK_f() { model.dep_ut = [true,false]; exprs = " "; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } INVBLK_f.prototype.details = function INVBLK_f() { + return this.x; } INVBLK_f.prototype.get = function INVBLK_f() { } INVBLK_f.prototype.set = function INVBLK_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/NonLinear/INVBLK_f.pickle b/js/NonLinear/INVBLK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/INVBLK_f.pickle +++ b/js/NonLinear/INVBLK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/LOGBLK_f.js b/js/NonLinear/LOGBLK_f.js index d57bfed7..00f01aa1 100644 --- a/js/NonLinear/LOGBLK_f.js +++ b/js/NonLinear/LOGBLK_f.js @@ -12,36 +12,37 @@ function LOGBLK_f() { model.dep_ut = [true,false]; exprs = "%e"; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } LOGBLK_f.prototype.details = function LOGBLK_f() { + return this.x; } LOGBLK_f.prototype.get = function LOGBLK_f() { } LOGBLK_f.prototype.set = function LOGBLK_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==2) { - exprs = exprs[2-1]; -} + exprs = exprs[2-1]; + } while (true) { - [ok,a,exprs] = scicos_getvalue("Set log block parameters","Basis (>1)",list("vec",1),exprs); - if (!ok) { -break; -} - if (a<=1) { -message("Basis must be larger than 1"); - } else { - if (ok) { - graphics.exprs = exprs; - model.rpar = a; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,a,exprs] = scicos_getvalue("Set log block parameters","Basis (>1)",list("vec",1),exprs); + if (!ok) { + break; + } + if (a<=1) { + message("Basis must be larger than 1"); + } else { + if (ok) { + graphics.exprs = exprs; + model.rpar = a; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/NonLinear/LOGBLK_f.pickle b/js/NonLinear/LOGBLK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/LOGBLK_f.pickle +++ b/js/NonLinear/LOGBLK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/LOOKUP2D.js b/js/NonLinear/LOOKUP2D.js index 355a3523..1c70c61a 100644 --- a/js/NonLinear/LOOKUP2D.js +++ b/js/NonLinear/LOOKUP2D.js @@ -18,81 +18,82 @@ function LOOKUP2D() { model.dep_ut = [true,false]; exprs = list(strcat(sci2exp(xx)),strcat(sci2exp(yy)),strcat(sci2exp(zz)),sci2exp(Method),Graf); gr_i = []; - x = standard_define([2.5,2],model,exprs,gr_i); + this.x = standard_define([2.5,2],model,exprs,gr_i); } LOOKUP2D.prototype.details = function LOOKUP2D() { + return this.x; } LOOKUP2D.prototype.get = function LOOKUP2D() { } LOOKUP2D.prototype.set = function LOOKUP2D() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; exprs = graphics.exprs; ok = false; SaveExit = false; while (true) { - Ask_again = false; - [ok,xx,yy,zz,Method,graf,exprs] = scicos_getvalue("2D Lookup table parameters",[["Row index input values"],["Column index input values"],["Table data"],["Lookup method(1..5)"],["Launch graphic window(y/n)?"]],list("vec",-1,"vec",-1,"mat",[-1,-1],"vec",1,"str",1),exprs); - if (!ok) { -break; -} - mtd = int(Method); - if (mtd<1) { - mtd = 1; -} - if (mtd>6) { - mtd = 6; -} - if (graf!="y"&&graf!="Y") { - graf = "n"; -} - exprs[5-1] = "n"; - exprs[4-1] = sci2exp(mtd); - METHOD = getmethod(mtd); - if (!Ask_again) { - xx = xx.slice(); - yy = yy.slice(); - [nx,mx] = size(xx); - [ny,my] = size(yy); - [nz,mz] = size(zz); - if (((nx<=1)||(ny<=1))) { -x_message("input row/column data size should be greater than one"); - Ask_again = true; -} - if (!((nx==nz)&&(ny==mz))) { -x_message("incompatible size of x and y"); - Ask_again = true; -} - [ok] = test_increasing(xx); - if ((!ok)) { -x_message("Row input values must be monotonically increasing"); - Ask_again = true; -} - [ok] = test_increasing(yy); - if ((!ok)) { -x_message("Column input values must be monotonically increasing"); - Ask_again = true; -} -} - if (!Ask_again) { - if ((graf=="Y"||graf=="y")) { - gh = gcf(); - curwin = gh.figure_id; - save_curwin = curwin; - gh2 = scf(); - curwin = max(winsid())+1; -plot3d(xx,yy,zz,35,45,"X@Y@Z",[5,2,4]); - curwin = save_curwin; - gh.figure_id = curwin; -} - model.rpar = [[xx.slice()],[yy.slice()],[zz.slice()]]; - model.ipar = [[nx],[ny],[mtd]]; - graphics.exprs = exprs; - x.model = model; - x.graphics = graphics; -break; -} -} + Ask_again = false; + [ok,xx,yy,zz,Method,graf,exprs] = scicos_getvalue("2D Lookup table parameters",[["Row index input values"],["Column index input values"],["Table data"],["Lookup method(1..5)"],["Launch graphic window(y/n)?"]],list("vec",-1,"vec",-1,"mat",[-1,-1],"vec",1,"str",1),exprs); + if (!ok) { + break; + } + mtd = int(Method); + if (mtd<1) { + mtd = 1; + } + if (mtd>6) { + mtd = 6; + } + if (graf!="y"&&graf!="Y") { + graf = "n"; + } + exprs[5-1] = "n"; + exprs[4-1] = sci2exp(mtd); + METHOD = getmethod(mtd); + if (!Ask_again) { + xx = xx.slice(); + yy = yy.slice(); + [nx,mx] = size(xx); + [ny,my] = size(yy); + [nz,mz] = size(zz); + if (((nx<=1)||(ny<=1))) { + x_message("input row/column data size should be greater than one"); + Ask_again = true; + } + if (!((nx==nz)&&(ny==mz))) { + x_message("incompatible size of x and y"); + Ask_again = true; + } + [ok] = test_increasing(xx); + if ((!ok)) { + x_message("Row input values must be monotonically increasing"); + Ask_again = true; + } + [ok] = test_increasing(yy); + if ((!ok)) { + x_message("Column input values must be monotonically increasing"); + Ask_again = true; + } + } + if (!Ask_again) { + if ((graf=="Y"||graf=="y")) { + gh = gcf(); + curwin = gh.figure_id; + save_curwin = curwin; + gh2 = scf(); + curwin = max(winsid())+1; + plot3d(xx,yy,zz,35,45,"X@Y@Z",[5,2,4]); + curwin = save_curwin; + gh.figure_id = curwin; + } + model.rpar = [[xx.slice()],[yy.slice()],[zz.slice()]]; + model.ipar = [[nx],[ny],[mtd]]; + graphics.exprs = exprs; + this.x.model = model; + this.x.graphics = graphics; + break; + } + } } } diff --git a/js/NonLinear/LOOKUP2D.pickle b/js/NonLinear/LOOKUP2D.pickle index e8e2a47d..a808c055 100644 --- a/js/NonLinear/LOOKUP2D.pickle +++ b/js/NonLinear/LOOKUP2D.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'order' +S'x' p2 -atp3 -Rp4 +aS'order' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/NonLinear/LOOKUP_c.pickle b/js/NonLinear/LOOKUP_c.pickle index 8cef5b52..b1c7cff9 100644 --- a/js/NonLinear/LOOKUP_c.pickle +++ b/js/NonLinear/LOOKUP_c.pickle @@ -12,8 +12,10 @@ aS'argn' p5 aS'xy' p6 -aS'curwin' +aS'x' p7 -atp8 -Rp9 +aS'curwin' +p8 +atp9 +Rp10 . \ No newline at end of file diff --git a/js/NonLinear/LOOKUP_f.js b/js/NonLinear/LOOKUP_f.js index 89ff8713..335d06fc 100644 --- a/js/NonLinear/LOOKUP_f.js +++ b/js/NonLinear/LOOKUP_f.js @@ -9,14 +9,15 @@ function LOOKUP_f() { model.blocktype = "c"; model.dep_ut = [true,false]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } LOOKUP_f.prototype.details = function LOOKUP_f() { + return this.x; } LOOKUP_f.prototype.get = function LOOKUP_f() { } LOOKUP_f.prototype.set = function LOOKUP_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -25,26 +26,26 @@ function LOOKUP_f() { xx = rpar.slice(1-1,n); yy = rpar.slice(n+1-1,2*n); while (true) { -[ln,fun]=where() - if (!or(fun=="do_eval")) { - [xx,yy,ok,gc] = edit_curv(xx,yy,"axy"); - } else { - ok = true; -} - if (!ok) { -break; -} - n = size(xx,"*"); - if (or(xx.slice(2-1,n)-xx.slice(1-1,n-1)<=0)) { -message("You have not defined a function"); - ok = false; -} - if (ok) { - model.rpar = [[xx.slice()],[yy.slice()]]; - x.graphics = graphics; - x.model = model; -break; -} -} + [ln,fun]=where() + if (!or(fun=="do_eval")) { + [xx,yy,ok,gc] = edit_curv(xx,yy,"axy"); + } else { + ok = true; + } + if (!ok) { + break; + } + n = size(xx,"*"); + if (or(xx.slice(2-1,n)-xx.slice(1-1,n-1)<=0)) { + message("You have not defined a function"); + ok = false; + } + if (ok) { + model.rpar = [[xx.slice()],[yy.slice()]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/LOOKUP_f.pickle b/js/NonLinear/LOOKUP_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/LOOKUP_f.pickle +++ b/js/NonLinear/LOOKUP_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/MAXMIN.js b/js/NonLinear/MAXMIN.js index c85734cb..b6726e22 100644 --- a/js/NonLinear/MAXMIN.js +++ b/js/NonLinear/MAXMIN.js @@ -10,59 +10,60 @@ function MAXMIN() { model.ipar = 0; exprs = [string(transpose([2,1,1]))]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); - x.graphics.style = "MAXMIN;displayedLabel=MAX"; + this.x = standard_define([2,2],model,exprs,gr_i); + this.x.graphics.style = "MAXMIN;displayedLabel=MAX"; } MAXMIN.prototype.details = function MAXMIN() { + return this.x; } MAXMIN.prototype.get = function MAXMIN() { } MAXMIN.prototype.set = function MAXMIN() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,mm,nin,zcr,exprs] = scicos_getvalue("Set Max/Min block parameters",[["Min (1) or Max (2) "],["Number of input vectors (1 or 2)"],["zero-crossing (1: yes, 0;no)"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (zcr!=0) { - zcr = -1; -} - if (mm!=1) { - mm = 2; -} - if (nin!=1&&nin!=2) { -message("Wrong number of inputs, only 1 and 2 allowed"); - ok = false; -} - if (ok) { - if (nin==1) { - [model,graphics,ok] = check_io(model,graphics,-1,1,[],[]); - } else { - [model,graphics,ok] = check_io(model,graphics,[-1,-1],-1,[],[]); -} -} - if (ok) { - model.nzcross = zcr; - if (nin==1) { - model.nmode = abs(zcr); - } else { - model.nmode = zcr; -} - model.ipar = mm; - if (mm==1) { - label = "MIN"; - } else { - label = "MAX"; -} - graphics.style = "MAXMIN;displayedLabel="+label; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,mm,nin,zcr,exprs] = scicos_getvalue("Set Max/Min block parameters",[["Min (1) or Max (2) "],["Number of input vectors (1 or 2)"],["zero-crossing (1: yes, 0;no)"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (zcr!=0) { + zcr = -1; + } + if (mm!=1) { + mm = 2; + } + if (nin!=1&&nin!=2) { + message("Wrong number of inputs, only 1 and 2 allowed"); + ok = false; + } + if (ok) { + if (nin==1) { + [model,graphics,ok] = check_io(model,graphics,-1,1,[],[]); + } else { + [model,graphics,ok] = check_io(model,graphics,[-1,-1],-1,[],[]); + } + } + if (ok) { + model.nzcross = zcr; + if (nin==1) { + model.nmode = abs(zcr); + } else { + model.nmode = zcr; + } + model.ipar = mm; + if (mm==1) { + label = "MIN"; + } else { + label = "MAX"; + } + graphics.style = "MAXMIN;displayedLabel="+label; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/MAXMIN.pickle b/js/NonLinear/MAXMIN.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/MAXMIN.pickle +++ b/js/NonLinear/MAXMIN.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/MAX_f.js b/js/NonLinear/MAX_f.js index 8367bd9d..e3640328 100644 --- a/js/NonLinear/MAX_f.js +++ b/js/NonLinear/MAX_f.js @@ -11,13 +11,14 @@ function MAX_f() { model.dep_ut = [true,false]; exprs = " "; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } MAX_f.prototype.details = function MAX_f() { + return this.x; } MAX_f.prototype.get = function MAX_f() { } MAX_f.prototype.set = function MAX_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/NonLinear/MAX_f.pickle b/js/NonLinear/MAX_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/MAX_f.pickle +++ b/js/NonLinear/MAX_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/MIN_f.js b/js/NonLinear/MIN_f.js index b38c5eef..18f5d484 100644 --- a/js/NonLinear/MIN_f.js +++ b/js/NonLinear/MIN_f.js @@ -11,13 +11,14 @@ function MIN_f() { model.dep_ut = [true,false]; exprs = sci2exp(in1); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } MIN_f.prototype.details = function MIN_f() { + return this.x; } MIN_f.prototype.get = function MIN_f() { } MIN_f.prototype.set = function MIN_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/NonLinear/MIN_f.pickle b/js/NonLinear/MIN_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/MIN_f.pickle +++ b/js/NonLinear/MIN_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/POWBLK_f.js b/js/NonLinear/POWBLK_f.js index b74479bd..1714dfa1 100644 --- a/js/NonLinear/POWBLK_f.js +++ b/js/NonLinear/POWBLK_f.js @@ -12,37 +12,38 @@ function POWBLK_f() { model.dep_ut = [true,false]; exprs = string(a); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } POWBLK_f.prototype.details = function POWBLK_f() { + return this.x; } POWBLK_f.prototype.get = function POWBLK_f() { } POWBLK_f.prototype.set = function POWBLK_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==2) { - exprs = exprs[2-1]; -} + exprs = exprs[2-1]; + } while (true) { - [ok,a,exprs] = scicos_getvalue("Set u^a block parameters","to the power of",list("vec",1),exprs); - if (!ok) { -break; -} - graphics.exprs = exprs; - if (a==int(a)) { - model.ipar = a; - model.rpar = []; - } else { - model.rpar = a; - model.ipar = []; -} - model.firing = []; - x.graphics = graphics; - x.model = model; -break; -} + [ok,a,exprs] = scicos_getvalue("Set u^a block parameters","to the power of",list("vec",1),exprs); + if (!ok) { + break; + } + graphics.exprs = exprs; + if (a==int(a)) { + model.ipar = a; + model.rpar = []; + } else { + model.rpar = a; + model.ipar = []; + } + model.firing = []; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/NonLinear/POWBLK_f.pickle b/js/NonLinear/POWBLK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/POWBLK_f.pickle +++ b/js/NonLinear/POWBLK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/PRODUCT.js b/js/NonLinear/PRODUCT.js index 03fbc655..e6449743 100644 --- a/js/NonLinear/PRODUCT.js +++ b/js/NonLinear/PRODUCT.js @@ -11,55 +11,56 @@ function PRODUCT() { model.dep_ut = [true,false]; exprs = sci2exp(sgn); gr_i = []; - x = standard_define([2,3],model,exprs,gr_i); + this.x = standard_define([2,3],model,exprs,gr_i); } PRODUCT.prototype.details = function PRODUCT() { + return this.x; } PRODUCT.prototype.get = function PRODUCT() { } PRODUCT.prototype.set = function PRODUCT() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,sgn,exprs] = scicos_getvalue([[" Set multiplication block parameters"],["(multiplication is set with + 1, division with -1)"],[""]],"Number of inputs or sign vector",list("vec",-1),exprs); - if (!ok) { -break; -} - sgn = sgn.slice(); - if (size(sgn,1)==1) { - if (sgn<1) { -message("Number of inputs must be > 0"); - ok = false; - } else if (sgn==1) { - in1 = -1; - sgn = []; - nout = 1; - } else { - in1 = -ones(sgn,1); - sgn = ones(sgn,1); - nout = -1; -} - } else { - if (!and(abs(sgn)==1)) { -message("Signs can only be +1 or -1"); - ok = false; - } else { - in1 = -ones(size(sgn,1),1); - nout = -1; -} -} - if (ok) { - [model,graphics,ok] = check_io(model,graphics,in1,nout,[],[]); -} - if (ok) { - model.ipar = sgn; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,sgn,exprs] = scicos_getvalue([[" Set multiplication block parameters"],["(multiplication is set with + 1, division with -1)"],[""]],"Number of inputs or sign vector",list("vec",-1),exprs); + if (!ok) { + break; + } + sgn = sgn.slice(); + if (size(sgn,1)==1) { + if (sgn<1) { + message("Number of inputs must be > 0"); + ok = false; + } else if (sgn==1) { + in1 = -1; + sgn = []; + nout = 1; + } else { + in1 = -ones(sgn,1); + sgn = ones(sgn,1); + nout = -1; + } + } else { + if (!and(abs(sgn)==1)) { + message("Signs can only be +1 or -1"); + ok = false; + } else { + in1 = -ones(size(sgn,1),1); + nout = -1; + } + } + if (ok) { + [model,graphics,ok] = check_io(model,graphics,in1,nout,[],[]); + } + if (ok) { + model.ipar = sgn; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/PRODUCT.pickle b/js/NonLinear/PRODUCT.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/PRODUCT.pickle +++ b/js/NonLinear/PRODUCT.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/PROD_f.js b/js/NonLinear/PROD_f.js index 039a765b..af76e144 100644 --- a/js/NonLinear/PROD_f.js +++ b/js/NonLinear/PROD_f.js @@ -7,13 +7,14 @@ function PROD_f() { model.out = -1; model.blocktype = "c"; model.dep_ut = [true,false]; - x = standard_define([1,1],model,[],[]); + this.x = standard_define([1,1],model,[],[]); } PROD_f.prototype.details = function PROD_f() { + return this.x; } PROD_f.prototype.get = function PROD_f() { } PROD_f.prototype.set = function PROD_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/NonLinear/PROD_f.pickle b/js/NonLinear/PROD_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/PROD_f.pickle +++ b/js/NonLinear/PROD_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/QUANT_f.js b/js/NonLinear/QUANT_f.js index a21c671c..d54077a6 100644 --- a/js/NonLinear/QUANT_f.js +++ b/js/NonLinear/QUANT_f.js @@ -13,43 +13,44 @@ function QUANT_f() { model.dep_ut = [true,false]; exprs = [[string(pas)],[string(meth)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } QUANT_f.prototype.details = function QUANT_f() { + return this.x; } QUANT_f.prototype.get = function QUANT_f() { } QUANT_f.prototype.set = function QUANT_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,pas,meth,exprs] = scicos_getvalue("Set parameters",[["Step"],["Quantization Type (1-4)"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (meth<1||meth>4) { -message("Quantization Type must be from 1 to 4"); - } else { - rpar = pas; - model.rpar = rpar; - model.ipar = meth; - switch (meth) { - case 1: - model.sim = "qzrnd"; - case 2: - model.sim = "qztrn"; - case 3: - model.sim = "qzflr"; - case 4: - model.sim = "qzcel"; -} - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,pas,meth,exprs] = scicos_getvalue("Set parameters",[["Step"],["Quantization Type (1-4)"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (meth<1||meth>4) { + message("Quantization Type must be from 1 to 4"); + } else { + rpar = pas; + model.rpar = rpar; + model.ipar = meth; + switch (meth) { + case 1: + model.sim = "qzrnd"; + case 2: + model.sim = "qztrn"; + case 3: + model.sim = "qzflr"; + case 4: + model.sim = "qzcel"; + } + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/QUANT_f.pickle b/js/NonLinear/QUANT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/QUANT_f.pickle +++ b/js/NonLinear/QUANT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/SATURATION.js b/js/NonLinear/SATURATION.js index 9d4ee666..d435baa6 100644 --- a/js/NonLinear/SATURATION.js +++ b/js/NonLinear/SATURATION.js @@ -15,39 +15,40 @@ function SATURATION() { model.dep_ut = [true,false]; exprs = [[string(maxp)],[string(minp)],[string(model.nmode)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } SATURATION.prototype.details = function SATURATION() { + return this.x; } SATURATION.prototype.get = function SATURATION() { } SATURATION.prototype.set = function SATURATION() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,maxp,minp,zeroc,exprs] = scicos_getvalue("Set Saturation parameters",[["Upper limit"],["Lower limit"],["zero crossing (0:no, 1:yes)"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (maxp<=minp) { -message("Upper limit must be > Lower limit"); - } else { - rpar = [[maxp],[minp]]; - model.rpar = rpar; - if (zeroc!=0) { - model.nzcross = 2; - model.nmode = 1; - } else { - model.nzcross = 0; - model.nmode = 0; -} - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,maxp,minp,zeroc,exprs] = scicos_getvalue("Set Saturation parameters",[["Upper limit"],["Lower limit"],["zero crossing (0:no, 1:yes)"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (maxp<=minp) { + message("Upper limit must be > Lower limit"); + } else { + rpar = [[maxp],[minp]]; + model.rpar = rpar; + if (zeroc!=0) { + model.nzcross = 2; + model.nmode = 1; + } else { + model.nzcross = 0; + model.nmode = 0; + } + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/SATURATION.pickle b/js/NonLinear/SATURATION.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/SATURATION.pickle +++ b/js/NonLinear/SATURATION.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/SAT_f.js b/js/NonLinear/SAT_f.js index dec7d1c5..6686e659 100644 --- a/js/NonLinear/SAT_f.js +++ b/js/NonLinear/SAT_f.js @@ -15,35 +15,36 @@ function SAT_f() { model.dep_ut = [true,false]; exprs = [[string(minp)],[string(maxp)],[string(slope)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } SAT_f.prototype.details = function SAT_f() { + return this.x; } SAT_f.prototype.get = function SAT_f() { } SAT_f.prototype.set = function SAT_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,minp,maxp,pente,exprs] = scicos_getvalue("Set Saturation parameters",[["Min"],["Max"],["Slope"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (maxp<=0) { -message("Max must be strictly positive"); - } else if (pente<=0) { -message("Slope must be strictly positive"); - } else { - rpar = [[minp/pente],[maxp/pente],[pente]]; - model.rpar = rpar; - model.firing = []; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,minp,maxp,pente,exprs] = scicos_getvalue("Set Saturation parameters",[["Min"],["Max"],["Slope"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (maxp<=0) { + message("Max must be strictly positive"); + } else if (pente<=0) { + message("Slope must be strictly positive"); + } else { + rpar = [[minp/pente],[maxp/pente],[pente]]; + model.rpar = rpar; + model.firing = []; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/SAT_f.pickle b/js/NonLinear/SAT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/SAT_f.pickle +++ b/js/NonLinear/SAT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/SIGNUM.js b/js/NonLinear/SIGNUM.js index eac404cd..e5cf8b00 100644 --- a/js/NonLinear/SIGNUM.js +++ b/js/NonLinear/SIGNUM.js @@ -12,35 +12,36 @@ function SIGNUM() { model.dep_ut = [true,false]; exprs = [string([1])]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } SIGNUM.prototype.details = function SIGNUM() { + return this.x; } SIGNUM.prototype.get = function SIGNUM() { } SIGNUM.prototype.set = function SIGNUM() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,zcr,exprs] = scicos_getvalue("Set block parameters",["use zero_crossing (1: yes) (0:no)"],list("vec",1),exprs); - if (!ok) { -break; -} - graphics.exprs = exprs; - if (ok) { - if (zcr!=0) { - model.nmode = -1; - model.nzcross = -1; - } else { - model.nmode = 0; - model.nzcross = 0; -} - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,zcr,exprs] = scicos_getvalue("Set block parameters",["use zero_crossing (1: yes) (0:no)"],list("vec",1),exprs); + if (!ok) { + break; + } + graphics.exprs = exprs; + if (ok) { + if (zcr!=0) { + model.nmode = -1; + model.nzcross = -1; + } else { + model.nmode = 0; + model.nzcross = 0; + } + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/SIGNUM.pickle b/js/NonLinear/SIGNUM.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/SIGNUM.pickle +++ b/js/NonLinear/SIGNUM.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/SINBLK_f.js b/js/NonLinear/SINBLK_f.js index 16a79b3e..f71f9ab2 100644 --- a/js/NonLinear/SINBLK_f.js +++ b/js/NonLinear/SINBLK_f.js @@ -9,13 +9,14 @@ function SINBLK_f() { model.dep_ut = [true,false]; exprs = " "; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } SINBLK_f.prototype.details = function SINBLK_f() { + return this.x; } SINBLK_f.prototype.get = function SINBLK_f() { } SINBLK_f.prototype.set = function SINBLK_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/NonLinear/SINBLK_f.pickle b/js/NonLinear/SINBLK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/SINBLK_f.pickle +++ b/js/NonLinear/SINBLK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/TANBLK_f.js b/js/NonLinear/TANBLK_f.js index a0e07ae7..c92309d8 100644 --- a/js/NonLinear/TANBLK_f.js +++ b/js/NonLinear/TANBLK_f.js @@ -10,14 +10,15 @@ function TANBLK_f() { model.dep_ut = [true,false]; exprs = sci2exp(in1); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } TANBLK_f.prototype.details = function TANBLK_f() { + return this.x; } TANBLK_f.prototype.get = function TANBLK_f() { } TANBLK_f.prototype.set = function TANBLK_f() { - x = arg1; - x.model.firing = []; + this.x = arg1; + this.x.model.firing = []; } } diff --git a/js/NonLinear/TANBLK_f.pickle b/js/NonLinear/TANBLK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/TANBLK_f.pickle +++ b/js/NonLinear/TANBLK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/NonLinear/TrigFun.js b/js/NonLinear/TrigFun.js index e1aaf7bf..ef058d3e 100644 --- a/js/NonLinear/TrigFun.js +++ b/js/NonLinear/TrigFun.js @@ -9,33 +9,34 @@ function TrigFun() { model.dep_ut = [true,false]; exprs = "sin"; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } TrigFun.prototype.details = function TrigFun() { + return this.x; } TrigFun.prototype.get = function TrigFun() { } TrigFun.prototype.set = function TrigFun() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; PREVAR_FF = [["sin"],["cos"],["tan"],["asin"],["acos"],["atan"],["sinh"],["cosh"],["tanh"],["asinh"],["acosh"],["atanh"]]; PREVAR_GG = [["Choose among "+strcat(PREVAR_FF.slice(1-1,4),", ")],[strcat(PREVAR_FF.slice(5-1,$),", ")]]; while (true) { - [ok,fun,exprs] = scicos_getvalue(PREVAR_GG,"Function",list("str",1),exprs); - if (!ok) { -break; -} - if (find(PREVAR_FF==fun)==[]) { -message("Sorry but "+fun+" is not in the list!"); - } else { - graphics.exprs = exprs; -execstr("model.sim=list(\'"+fun+"_blk\',4)"); - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,fun,exprs] = scicos_getvalue(PREVAR_GG,"Function",list("str",1),exprs); + if (!ok) { + break; + } + if (find(PREVAR_FF==fun)==[]) { + message("Sorry but "+fun+" is not in the list!"); + } else { + graphics.exprs = exprs; + execstr("model.sim=list(\'"+fun+"_blk\',4)"); + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/NonLinear/TrigFun.pickle b/js/NonLinear/TrigFun.pickle index 154645d8..0d1dde24 100644 --- a/js/NonLinear/TrigFun.pickle +++ b/js/NonLinear/TrigFun.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/PDE/PDE.js b/js/PDE/PDE.js index 9676eab6..0f1dd160 100644 --- a/js/PDE/PDE.js +++ b/js/PDE/PDE.js @@ -11,122 +11,123 @@ function PDE() { params_pde = tlist([["paramspde"],["a"],["b"],["txt_exp"],["check_op1"],["a1"],["b1"],["check_op2"],["a2"],["b2"],["check_op3"],["a3"],["b3"],["check_op4"],["a4"],["b4"],["check_op5"],["a5"],["b5"],["check_op6"],["a6"],["b6"],["check_op7"],["a7"],["b7"],["discr_cst"],["discr_non_cst"],["signe"],["rad_automatique"],["rad_manuel"],["methode"],["ord1"],["ord2"],["ord3"],["degre"],["nnode"],["txt_pas"],["CI"],["dCI"],["CLa"],["CLa_exp"],["CLb"],["CLb_exp"],["points"]],"","","","0","","IN_EDP1(t)","0","","IN_EDP2(t)","0","","IN_EDP3(t)","0","","IN_EDP4(t)","0","","IN_EDP5(t)","0","","IN_EDP6(t)","0","","IN_EDP7(t)","0","0","0","0","0","0","","","","","","","","","0","IN_CL1(t)","0","IN_CL2(t)",""); label = list(params_pde,[],""); gr_i = []; - x = standard_define([3,3],model,label,gr_i); + this.x = standard_define([3,3],model,label,gr_i); } PDE.prototype.details = function PDE() { + return this.x; } PDE.prototype.get = function PDE() { } PDE.prototype.set = function PDE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; label = graphics.exprs; model = arg1.model; params_pde = label[1-1]; while (true) { -[ln,fun]=where() - if (!or(fun=="do_eval")) { - [ok,a_domaine,b_domaine,discr,signe,choix,type_meth,degre,Nbr_maillage,CI,CI1,CLa_type,CLa_exp,CLb_type,CLb_exp,oper,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,k,mesures,params_pde] = IHM_EDP(params_pde); - if (ok) { -return; -} - } else { - if (exists("%scicos_context")) { - [ok,a_domaine,b_domaine,discr,signe,choix,type_meth,degre,Nbr_maillage,CI,CI1,CLa_type,CLa_exp,CLb_type,CLb_exp,oper,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,k,mesures,params_pde] = setvalue_IHM_EDP(params_pde); -} -} - okk = false; - rdnom = "PDE"; - ok1 = true; - while (true) { - [okk,rdnom,lab] = scicos_getvalue("PLEASE, GIVE US THE BLOCK\'s NAME. ","New block\'s name :",list("str",1),label[3-1]); - if (okk==false) { - ok1 = false; -return; -} - label[3-1] = lab; - rdnom = stripblanks(rdnom); - if (rdnom==emptystr()) { - ok1 = false; -x_message("sorry C file name not defined"); -} - if (ok1) { -break; -} -} - if ((choix==0)) { - ind4 = strindex(a4,"x"); - ind1 = strindex(a1,"x"); - ind2 = strindex(a2,"x"); - if ((ind4!=[]||ind1!=[]||ind2!=[])) { - if ((signe==1)) { - delta = 1; - } else if ((signe==2)) { - delta = -1; - } else if ((signe==0)) { - delta = 0; - } else { -x_message([["le discriminant n\'est pas constant,"],["Vous devez choisir son signe dans l\'IHM"]]); -return; -} - } else { - delta = evstr(a4)^2-4*evstr(a1)*evstr(a2); -} - if ((delta==[])) { - delta = 0; -} - type_meth = this.arbre_decision[delta-1]; -} - [flag_type,rdnom,DF_type,tt] = translate(CI,CI1,CLa_type,CLa_exp,CLb_type,CLb_exp,oper,type_meth,degre,a_domaine,b_domaine,Nbr_maillage,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,rdnom,mesures); - Nbr = Nbr_maillage; - if (((CLa_type==1)&&(DF_type==0||DF_type==1))||((CLb_type==1)&&(DF_type==0||DF_type==2))) { - Nbr = Nbr+1; -} - if ((mesures==[])) { - out = Nbr_maillage; - } else { - out = [[Nbr_maillage],[size(mesures,"*")]]; -} - if ((flag_type==1)) { - model.sim = list(rdnom,2004); - if ((find(oper==1)!=[])) { - model.state = zeros(2*Nbr_maillage,1); - } else { - model.state = zeros(Nbr_maillage,1); -} - } else if ((flag_type==2)) { - model.sim = list(rdnom,12004); - if ((find(oper==1)!=[])) { - if ((type_meth==3&&(find(oper==2)!=[]||find(oper==4)!=[]))) { - model.state = zeros(6*Nbr_maillage,1); - } else if ((type_meth==1)) { - model.state = zeros(4*Nbr,1); - } else { - model.state = zeros(4*Nbr_maillage,1); -} - } else { - if ((type_meth==3&&(find(oper==2)!=[]||find(oper==4)!=[]))) { - model.state = zeros(4*Nbr_maillage,1); - } else if ((type_meth==1)) { - model.state = zeros(2*Nbr,1); - } else { - model.state = zeros(2*Nbr_maillage,1); -} -} -} - [ok1] = CFORTREDP(rdnom,tt); - if (!ok1) { -break; -} - if (!ok) { - [model,graphics,ok] = check_io(model,graphics,ones(k,1),out.slice(),[],[]); -} - label[1-1] = params_pde; - label[2-1] = tt; - graphics.exprs = label; - x.graphics = graphics; - x.model = model; -break; -} + [ln,fun]=where() + if (!or(fun=="do_eval")) { + [ok,a_domaine,b_domaine,discr,signe,choix,type_meth,degre,Nbr_maillage,CI,CI1,CLa_type,CLa_exp,CLb_type,CLb_exp,oper,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,k,mesures,params_pde] = IHM_EDP(params_pde); + if (ok) { + return; + } + } else { + if (exists("%scicos_context")) { + [ok,a_domaine,b_domaine,discr,signe,choix,type_meth,degre,Nbr_maillage,CI,CI1,CLa_type,CLa_exp,CLb_type,CLb_exp,oper,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,k,mesures,params_pde] = setvalue_IHM_EDP(params_pde); + } + } + okk = false; + rdnom = "PDE"; + ok1 = true; + while (true) { + [okk,rdnom,lab] = scicos_getvalue("PLEASE, GIVE US THE BLOCK\'s NAME. ","New block\'s name :",list("str",1),label[3-1]); + if (okk==false) { + ok1 = false; + return; + } + label[3-1] = lab; + rdnom = stripblanks(rdnom); + if (rdnom==emptystr()) { + ok1 = false; + x_message("sorry C file name not defined"); + } + if (ok1) { + break; + } + } + if ((choix==0)) { + ind4 = strindex(a4,"x"); + ind1 = strindex(a1,"x"); + ind2 = strindex(a2,"x"); + if ((ind4!=[]||ind1!=[]||ind2!=[])) { + if ((signe==1)) { + delta = 1; + } else if ((signe==2)) { + delta = -1; + } else if ((signe==0)) { + delta = 0; + } else { + x_message([["le discriminant n\'est pas constant,"],["Vous devez choisir son signe dans l\'IHM"]]); + return; + } + } else { + delta = evstr(a4)^2-4*evstr(a1)*evstr(a2); + } + if ((delta==[])) { + delta = 0; + } + type_meth = this.arbre_decision[delta-1]; + } + [flag_type,rdnom,DF_type,tt] = translate(CI,CI1,CLa_type,CLa_exp,CLb_type,CLb_exp,oper,type_meth,degre,a_domaine,b_domaine,Nbr_maillage,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,rdnom,mesures); + Nbr = Nbr_maillage; + if (((CLa_type==1)&&(DF_type==0||DF_type==1))||((CLb_type==1)&&(DF_type==0||DF_type==2))) { + Nbr = Nbr+1; + } + if ((mesures==[])) { + out = Nbr_maillage; + } else { + out = [[Nbr_maillage],[size(mesures,"*")]]; + } + if ((flag_type==1)) { + model.sim = list(rdnom,2004); + if ((find(oper==1)!=[])) { + model.state = zeros(2*Nbr_maillage,1); + } else { + model.state = zeros(Nbr_maillage,1); + } + } else if ((flag_type==2)) { + model.sim = list(rdnom,12004); + if ((find(oper==1)!=[])) { + if ((type_meth==3&&(find(oper==2)!=[]||find(oper==4)!=[]))) { + model.state = zeros(6*Nbr_maillage,1); + } else if ((type_meth==1)) { + model.state = zeros(4*Nbr,1); + } else { + model.state = zeros(4*Nbr_maillage,1); + } + } else { + if ((type_meth==3&&(find(oper==2)!=[]||find(oper==4)!=[]))) { + model.state = zeros(4*Nbr_maillage,1); + } else if ((type_meth==1)) { + model.state = zeros(2*Nbr,1); + } else { + model.state = zeros(2*Nbr_maillage,1); + } + } + } + [ok1] = CFORTREDP(rdnom,tt); + if (!ok1) { + break; + } + if (!ok) { + [model,graphics,ok] = check_io(model,graphics,ones(k,1),out.slice(),[],[]); + } + label[1-1] = params_pde; + label[2-1] = tt; + graphics.exprs = label; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/PDE/PDE.pickle b/js/PDE/PDE.pickle index fb271fe8..4ca94fdd 100644 --- a/js/PDE/PDE.pickle +++ b/js/PDE/PDE.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'arbre_decision' +S'x' p2 -atp3 -Rp4 +aS'arbre_decision' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Sinks/AFFICH_m.js b/js/Sinks/AFFICH_m.js index b55ea10a..ac794b2f 100644 --- a/js/Sinks/AFFICH_m.js +++ b/js/Sinks/AFFICH_m.js @@ -20,61 +20,62 @@ function AFFICH_m() { model.label = ""; exprs = [[sci2exp([model.in1,model.in2])],[string(font)],[string(fontsize)],[string(colr)],[string(nt)],[string(nd)],[string(0)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } AFFICH_m.prototype.details = function AFFICH_m() { + return this.x; } AFFICH_m.prototype.get = function AFFICH_m() { } AFFICH_m.prototype.set = function AFFICH_m() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,in1,font,fontsize,colr,nt,nd,herit,exprs] = scicos_getvalue("Set parameters",[["Input Size","Font number"],["Font size"],["Color"],["Total number of digits"],["Number of rational part digits"],["Block inherits (1) or not (0)"]],list("mat",[1,2],"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (font<=0) { - mess = [[mess],["Font number must be positive"],[" "]]; - ok = false; -} - if (fontsize<=0) { - mess = [[mess],["Font size must be positive"],[" "]]; - ok = false; -} - if (nt<=3) { - mess = [[mess],["Total number of digits must be greater than 3"],[" "]]; - ok = false; -} - if (nd<0) { - mess = [[mess],["Number of rational part digits must be ","greater or equal 0"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (!or(herit==[0,1])) { - mess = [[mess],["Accept inherited values are 0 and 1"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,1),list(),ones(1-herit,1),[]); -} - if (ok) { - model.ipar = [[font],[fontsize],[colr],[nt],[nd],[in1[1-1][1-1]]]; - model.dstate = [[-1],[0],[0],[1],[1],[0],[zeros(in1[1-1][1-1]*in1[1-1][2-1],1)]]; - model.evtin = ones(1-herit,1); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,in1,font,fontsize,colr,nt,nd,herit,exprs] = scicos_getvalue("Set parameters",[["Input Size","Font number"],["Font size"],["Color"],["Total number of digits"],["Number of rational part digits"],["Block inherits (1) or not (0)"]],list("mat",[1,2],"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (font<=0) { + mess = [[mess],["Font number must be positive"],[" "]]; + ok = false; + } + if (fontsize<=0) { + mess = [[mess],["Font size must be positive"],[" "]]; + ok = false; + } + if (nt<=3) { + mess = [[mess],["Total number of digits must be greater than 3"],[" "]]; + ok = false; + } + if (nd<0) { + mess = [[mess],["Number of rational part digits must be ","greater or equal 0"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (!or(herit==[0,1])) { + mess = [[mess],["Accept inherited values are 0 and 1"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,1),list(),ones(1-herit,1),[]); + } + if (ok) { + model.ipar = [[font],[fontsize],[colr],[nt],[nd],[in1[1-1][1-1]]]; + model.dstate = [[-1],[0],[0],[1],[1],[0],[zeros(in1[1-1][1-1]*in1[1-1][2-1],1)]]; + model.evtin = ones(1-herit,1); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/AFFICH_m.pickle b/js/Sinks/AFFICH_m.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/AFFICH_m.pickle +++ b/js/Sinks/AFFICH_m.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/BARXY.js b/js/Sinks/BARXY.js index 3cdddd4d..e1845489 100644 --- a/js/Sinks/BARXY.js +++ b/js/Sinks/BARXY.js @@ -15,48 +15,49 @@ function BARXY() { model.evtin = [1]; model.rpar = [[xmin],[xmax],[ymin],[ymax]]; model.ipar = 1; - x = standard_define([2,2],model,[],[]); - x.graphics.in_implicit = ["E","E"]; - x.graphics.out_implicit = []; - x.graphics.exprs = [["-15"],["15"],["-15"],["15"],["1"]]; + this.x = standard_define([2,2],model,[],[]); + this.x.graphics.in_implicit = ["E","E"]; + this.x.graphics.out_implicit = []; + this.x.graphics.exprs = [["-15"],["15"],["-15"],["15"],["1"]]; } BARXY.prototype.details = function BARXY() { + return this.x; } BARXY.prototype.get = function BARXY() { } BARXY.prototype.set = function BARXY() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,xmin,xmax,ymin,ymax,thickness,exprs] = scicos_getvalue("Set Scope parameters",[["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Segs Thickness"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (xmin>=xmax) { - mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; - ok = false; -} - if (thickness<=0) { - mess = [[mess],["Thickness must be strictly positive."]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - model.rpar = [[xmin],[xmax],[ymin],[ymax]]; - model.ipar = thickness; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,xmin,xmax,ymin,ymax,thickness,exprs] = scicos_getvalue("Set Scope parameters",[["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Segs Thickness"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (xmin>=xmax) { + mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; + ok = false; + } + if (thickness<=0) { + mess = [[mess],["Thickness must be strictly positive."]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + model.rpar = [[xmin],[xmax],[ymin],[ymax]]; + model.ipar = thickness; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/BARXY.pickle b/js/Sinks/BARXY.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/BARXY.pickle +++ b/js/Sinks/BARXY.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/CANIMXY.js b/js/Sinks/CANIMXY.js index 4fe1aa55..7f58c8a9 100644 --- a/js/Sinks/CANIMXY.js +++ b/js/Sinks/CANIMXY.js @@ -25,76 +25,77 @@ function CANIMXY() { model.dep_ut = [false,false]; exprs = [[string(nbr_curves)],[string(clrs)],[string(siz)],[string(win)],["[]"],["[]"],[string(xmin)],[string(xmax)],[string(ymin)],[string(ymax)],[string(N)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CANIMXY.prototype.details = function CANIMXY() { + return this.x; } CANIMXY.prototype.get = function CANIMXY() { } CANIMXY.prototype.set = function CANIMXY() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nbr_curves,clrs,siz,win,wpos,wdim,xmin,xmax,ymin,ymax,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of Curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Buffer size"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (nbr_curves<=0) { - mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; - ok = false; -} - if (N<1) { - mess = [[mess],["Buffer size must be at least 1"],[" "]]; - ok = false; -} - if (N==1&&clrs>0) { - mess = [[mess],["Buffer size must be at least 2"],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (xmin>=xmax) { - mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - in1 = nbr_curves*ones(2,1); - in2 = ones(2,1); - [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(2,1)),list(),ones(1,1),[]); - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[xmin],[xmax],[ymin],[ymax]]; - ipar = [[win],[1],[N],[clrs],[siz],[0],[wpos.slice()],[wdim.slice()],[nbr_curves]]; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nbr_curves,clrs,siz,win,wpos,wdim,xmin,xmax,ymin,ymax,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of Curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Buffer size"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (nbr_curves<=0) { + mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; + ok = false; + } + if (N<1) { + mess = [[mess],["Buffer size must be at least 1"],[" "]]; + ok = false; + } + if (N==1&&clrs>0) { + mess = [[mess],["Buffer size must be at least 2"],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (xmin>=xmax) { + mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + in1 = nbr_curves*ones(2,1); + in2 = ones(2,1); + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(2,1)),list(),ones(1,1),[]); + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[xmin],[xmax],[ymin],[ymax]]; + ipar = [[win],[1],[N],[clrs],[siz],[0],[wpos.slice()],[wdim.slice()],[nbr_curves]]; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CANIMXY.pickle b/js/Sinks/CANIMXY.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CANIMXY.pickle +++ b/js/Sinks/CANIMXY.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/CANIMXY3D.js b/js/Sinks/CANIMXY3D.js index 8d86f3b9..7b70e142 100644 --- a/js/Sinks/CANIMXY3D.js +++ b/js/Sinks/CANIMXY3D.js @@ -25,93 +25,94 @@ function CANIMXY3D() { model.dep_ut = [false,false]; exprs = [[string(nbr_curves)],[strcat(string(clrs)," ")],[strcat(string(siz)," ")],[string(win)],["[]"],["[]"],[strcat(string(vec_x)," ")],[strcat(string(vec_y)," ")],[strcat(string(vec_z)," ")],[strcat(string(param3ds)," ")],[string(N)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CANIMXY3D.prototype.details = function CANIMXY3D() { + return this.x; } CANIMXY3D.prototype.get = function CANIMXY3D() { } CANIMXY3D.prototype.set = function CANIMXY3D() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nbr_curves,clrs,siz,win,wpos,wdim,vec_x,vec_y,vec_z,param3ds,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin and Xmax"],["Ymin and Ymax"],["Zmin and Zmax"],["Alpha and Theta"],["Buffer size"]],list("vec",1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (size(clrs,"*")!=size(siz,"*")) { - mess = [[mess],["Colors and Size must have same size"],[" "]]; - ok = false; -} - if (nbr_curves<=0) { - mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; - ok = false; -} - if (size(clrs,"*")0) { - mess = [[mess],["Buffer size must be at least 2 or Change a color (must be <0)"],[" "]]; - ok = false; -} -} -} - if (vec_y[1-1]>=vec_y[2-1]) { - mess = [[mess],["Ymax must be higher than Ymin"],[" "]]; - ok = false; -} - if (vec_x[1-1]>=vec_x[2-1]) { - mess = [[mess],["Xmax must be higher than Xmin"],[" "]]; - ok = false; -} - if (vec_z[1-1]>=vec_z[2-1]) { - mess = [[mess],["Zmax must be higher than Zmin"],[" "]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - in1 = nbr_curves*ones(3,1); - in2 = ones(3,1); - [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(3,1)),list(),ones(1,1),[]); - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[vec_x.slice()],[vec_y.slice()],[vec_z.slice()],[param3ds.slice()]]; - size_siz = size(siz,"*"); - ipar = [[win],[size_siz],[N],[clrs.slice()],[siz.slice()],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nbr_curves,clrs,siz,win,wpos,wdim,vec_x,vec_y,vec_z,param3ds,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin and Xmax"],["Ymin and Ymax"],["Zmin and Zmax"],["Alpha and Theta"],["Buffer size"]],list("vec",1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (size(clrs,"*")!=size(siz,"*")) { + mess = [[mess],["Colors and Size must have same size"],[" "]]; + ok = false; + } + if (nbr_curves<=0) { + mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; + ok = false; + } + if (size(clrs,"*")0) { + mess = [[mess],["Buffer size must be at least 2 or Change a color (must be <0)"],[" "]]; + ok = false; + } + } + } + if (vec_y[1-1]>=vec_y[2-1]) { + mess = [[mess],["Ymax must be higher than Ymin"],[" "]]; + ok = false; + } + if (vec_x[1-1]>=vec_x[2-1]) { + mess = [[mess],["Xmax must be higher than Xmin"],[" "]]; + ok = false; + } + if (vec_z[1-1]>=vec_z[2-1]) { + mess = [[mess],["Zmax must be higher than Zmin"],[" "]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + in1 = nbr_curves*ones(3,1); + in2 = ones(3,1); + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(3,1)),list(),ones(1,1),[]); + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[vec_x.slice()],[vec_y.slice()],[vec_z.slice()],[param3ds.slice()]]; + size_siz = size(siz,"*"); + ipar = [[win],[size_siz],[N],[clrs.slice()],[siz.slice()],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CANIMXY3D.pickle b/js/Sinks/CANIMXY3D.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CANIMXY3D.pickle +++ b/js/Sinks/CANIMXY3D.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/CEVENTSCOPE.js b/js/Sinks/CEVENTSCOPE.js index 23559306..712c76aa 100644 --- a/js/Sinks/CEVENTSCOPE.js +++ b/js/Sinks/CEVENTSCOPE.js @@ -16,71 +16,72 @@ function CEVENTSCOPE() { model.dep_ut = [false,false]; exprs = [[sci2exp(nclock)],[strcat(sci2exp(clrs[nclock-1])," ")],[string(win)],[sci2exp([])],[sci2exp(wdim)],[string(per)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CEVENTSCOPE.prototype.details = function CEVENTSCOPE() { + return this.x; } CEVENTSCOPE.prototype.get = function CEVENTSCOPE() { } CEVENTSCOPE.prototype.set = function CEVENTSCOPE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nclock,clrs,win,wpos,wdim,per,exprs] = scicos_getvalue("Set Scope parameters",[["Number of event inputs"],["colors c (>0) or mark (<0)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Refresh period"]],list("vec",1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",1),exprs); - nclock = int(nclock); - clrs = int(clrs); - win = int(win); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (nclock<=0) { - mess = [[mess],["Block must have at least one input event"],[" "]]; - ok = false; -} - if (size(clrs,"*")!=nclock) { - mess = [[mess],["Inputs color c size must be equal to Number of inputs"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (per<=0) { - mess = [[mess],["Refresh period must be positive"],[" "]]; - ok = false; -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(),list(),ones(nclock,1),[]); - } else { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = per; - ipar = [[win],[1],[clrs.slice()],[wpos.slice()],[wdim.slice()]]; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nclock,clrs,win,wpos,wdim,per,exprs] = scicos_getvalue("Set Scope parameters",[["Number of event inputs"],["colors c (>0) or mark (<0)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Refresh period"]],list("vec",1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",1),exprs); + nclock = int(nclock); + clrs = int(clrs); + win = int(win); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (nclock<=0) { + mess = [[mess],["Block must have at least one input event"],[" "]]; + ok = false; + } + if (size(clrs,"*")!=nclock) { + mess = [[mess],["Inputs color c size must be equal to Number of inputs"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (per<=0) { + mess = [[mess],["Refresh period must be positive"],[" "]]; + ok = false; + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(),list(),ones(nclock,1),[]); + } else { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = per; + ipar = [[win],[1],[clrs.slice()],[wpos.slice()],[wdim.slice()]]; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CEVENTSCOPE.pickle b/js/Sinks/CEVENTSCOPE.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CEVENTSCOPE.pickle +++ b/js/Sinks/CEVENTSCOPE.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/CFSCOPE.js b/js/Sinks/CFSCOPE.js index e2cf054d..4d000c69 100644 --- a/js/Sinks/CFSCOPE.js +++ b/js/Sinks/CFSCOPE.js @@ -18,78 +18,79 @@ function CFSCOPE() { model.dep_ut = [true,false]; exprs = [[strcat(string(clrs)," ")],[string(win)],[sci2exp([])],[sci2exp(wdim)],[string(ymin)],[string(ymax)],[string(per)],[string(N)],[string([1])]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CFSCOPE.prototype.details = function CFSCOPE() { + return this.x; } CFSCOPE.prototype.get = function CFSCOPE() { } CFSCOPE.prototype.set = function CFSCOPE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,clrs,win,wpos,wdim,ymin,ymax,per,N,wu,exprs] = scicos_getvalue("Set Scope parameters",[["Color (>0) or mark (<0) vector (8 entries)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin"],["Ymax"],["Refresh period"],["Buffer size","Links to view"]],list("vec",8,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",-1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (per<=0) { - mess = [[mess],["Refresh period must be positive"],[" "]]; - ok = false; -} - if (N<2) { - mess = [[mess],["Buffer size must be at least 2"],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (wu<0) { - mess = [[mess],["Link to view must be positive"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[0],[ymin],[ymax],[per]]; - if (size(clrs,"*")>8) { - clrs = clrs.slice(1-1,8); -} - if (size(clrs,"*")<8) { - clrs[8-1] = 0; -} - ipar = [[win],[1],[N],[clrs.slice()],[wpos.slice()],[wdim.slice()],[size(wu,"*")],[wu.slice()]]; - model.rpar = rpar; - model.ipar = ipar; - model.firing = []; - model.dep_ut = [true,false]; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,clrs,win,wpos,wdim,ymin,ymax,per,N,wu,exprs] = scicos_getvalue("Set Scope parameters",[["Color (>0) or mark (<0) vector (8 entries)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin"],["Ymax"],["Refresh period"],["Buffer size","Links to view"]],list("vec",8,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",-1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (per<=0) { + mess = [[mess],["Refresh period must be positive"],[" "]]; + ok = false; + } + if (N<2) { + mess = [[mess],["Buffer size must be at least 2"],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (wu<0) { + mess = [[mess],["Link to view must be positive"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[0],[ymin],[ymax],[per]]; + if (size(clrs,"*")>8) { + clrs = clrs.slice(1-1,8); + } + if (size(clrs,"*")<8) { + clrs[8-1] = 0; + } + ipar = [[win],[1],[N],[clrs.slice()],[wpos.slice()],[wdim.slice()],[size(wu,"*")],[wu.slice()]]; + model.rpar = rpar; + model.ipar = ipar; + model.firing = []; + model.dep_ut = [true,false]; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CFSCOPE.pickle b/js/Sinks/CFSCOPE.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CFSCOPE.pickle +++ b/js/Sinks/CFSCOPE.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/CLKOUTV_f.js b/js/Sinks/CLKOUTV_f.js index 0c98a1b9..c53d274d 100644 --- a/js/Sinks/CLKOUTV_f.js +++ b/js/Sinks/CLKOUTV_f.js @@ -10,33 +10,34 @@ function CLKOUTV_f() { model.firing = []; model.dep_ut = [false,false]; exprs = string(prt); - x = standard_define([1,1],model,exprs," "); + this.x = standard_define([1,1],model,exprs," "); } CLKOUTV_f.prototype.details = function CLKOUTV_f() { + return this.x; } CLKOUTV_f.prototype.get = function CLKOUTV_f() { } CLKOUTV_f.prototype.set = function CLKOUTV_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLKOUTV_f")],[" "],[gettext("Event output port")]],gettext("Port number"),list("vec",1),exprs); - if (!ok) { -break; -} - prt = int(prt); - if (prt<=0) { -block_parameter_error(msprintf(gettext("Wrong value for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); - } else { - model.ipar = prt; - model.evtin = 1; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLKOUTV_f")],[" "],[gettext("Event output port")]],gettext("Port number"),list("vec",1),exprs); + if (!ok) { + break; + } + prt = int(prt); + if (prt<=0) { + block_parameter_error(msprintf(gettext("Wrong value for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); + } else { + model.ipar = prt; + model.evtin = 1; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CLKOUTV_f.pickle b/js/Sinks/CLKOUTV_f.pickle index b563ade6..658c6188 100644 --- a/js/Sinks/CLKOUTV_f.pickle +++ b/js/Sinks/CLKOUTV_f.pickle @@ -2,16 +2,18 @@ c__builtin__ set p0 ((lp1 -S'diag' +S'standard_origin' p2 -aS'type' +aS'diag' p3 -aS'options' -p4 aS'default_color' +p4 +aS'x' p5 -aS'standard_origin' +aS'type' p6 -atp7 -Rp8 +aS'options' +p7 +atp8 +Rp9 . \ No newline at end of file diff --git a/js/Sinks/CLKOUT_f.js b/js/Sinks/CLKOUT_f.js index d9f5d2a9..5ff1d994 100644 --- a/js/Sinks/CLKOUT_f.js +++ b/js/Sinks/CLKOUT_f.js @@ -10,35 +10,36 @@ function CLKOUT_f() { model.firing = []; model.dep_ut = [false,false]; exprs = string(prt); - x = standard_define([1,1],model,exprs," "); + this.x = standard_define([1,1],model,exprs," "); } CLKOUT_f.prototype.details = function CLKOUT_f() { + return this.x; } CLKOUT_f.prototype.get = function CLKOUT_f() { } CLKOUT_f.prototype.set = function CLKOUT_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; exprs = exprs[1-1]; while (true) { - [ok,prt,exprs] = scicos_getvalue("Set Event Output block parameters","Port number",list("vec",1),exprs); - if (!ok) { -break; -} - prt = int(prt); - if (prt<=0) { -message("Port number must be a positive integer"); - } else { - model.ipar = prt; - model.evtin = 1; - model.firing = []; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,prt,exprs] = scicos_getvalue("Set Event Output block parameters","Port number",list("vec",1),exprs); + if (!ok) { + break; + } + prt = int(prt); + if (prt<=0) { + message("Port number must be a positive integer"); + } else { + model.ipar = prt; + model.evtin = 1; + model.firing = []; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CLKOUT_f.pickle b/js/Sinks/CLKOUT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CLKOUT_f.pickle +++ b/js/Sinks/CLKOUT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/CMAT3D.js b/js/Sinks/CMAT3D.js index 44dcfcb4..a29a7e7a 100644 --- a/js/Sinks/CMAT3D.js +++ b/js/Sinks/CMAT3D.js @@ -5,7 +5,7 @@ function CMAT3D() { cmax = 100; colormap = this.jetcolormap[25-1]; size_c = 25; - x = -1; + this.x = -1; y = -1; size_x = 1; size_y = 1; @@ -16,51 +16,52 @@ function CMAT3D() { model.intyp = 1; model.evtin = 1; model.ipar = [[cmin],[cmax],[size_c],[size_x],[size_y]]; - model.rpar = [[colormap.slice()],[x],[y]]; + model.rpar = [[colormap.slice()],[this.x],[y]]; model.blocktype = "c"; model.dep_ut = [true,false]; - exprs = [[strcat(string(x)," ")],[strcat(string(y)," ")],[string("jetcolormap(25)")],[string(cmin)],[string(cmax)]]; + exprs = [[strcat(string(this.x)," ")],[strcat(string(y)," ")],[string("jetcolormap(25)")],[string(cmin)],[string(cmax)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CMAT3D.prototype.details = function CMAT3D() { + return this.x; } CMAT3D.prototype.get = function CMAT3D() { } CMAT3D.prototype.set = function CMAT3D() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,vec_x,vec_y,colormap,cmin,cmax,exprs] = scicos_getvalue("Set Scope parameters",[["Bounds Vector X (-1 for standard)"],["Bounds Vector Y (-1 for standard)"],["ColorMap"],["Zmin"],["Zmax"]],list("vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(vec_x,"*")!=size(vec_y,"*")) { - mess = [[mess],["Vector X and Vector Y must have the same size"],[" "]]; - ok = false; -} - if (cmax<=cmin) { - mess = [[mess],["Error with minimum and maximum value"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - size_x = size(vec_x,"*"); - size_c = size(colormap.slice(),1); - ipar = [[cmin],[cmax],[size_c],[size_x]]; - rpar = [[colormap.slice()],[vec_x.slice()],[vec_y.slice()]]; - model.ipar = ipar; - model.rpar = rpar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,vec_x,vec_y,colormap,cmin,cmax,exprs] = scicos_getvalue("Set Scope parameters",[["Bounds Vector X (-1 for standard)"],["Bounds Vector Y (-1 for standard)"],["ColorMap"],["Zmin"],["Zmax"]],list("vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(vec_x,"*")!=size(vec_y,"*")) { + mess = [[mess],["Vector X and Vector Y must have the same size"],[" "]]; + ok = false; + } + if (cmax<=cmin) { + mess = [[mess],["Error with minimum and maximum value"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + size_x = size(vec_x,"*"); + size_c = size(colormap.slice(),1); + ipar = [[cmin],[cmax],[size_c],[size_x]]; + rpar = [[colormap.slice()],[vec_x.slice()],[vec_y.slice()]]; + model.ipar = ipar; + model.rpar = rpar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CMAT3D.pickle b/js/Sinks/CMAT3D.pickle index 80ec981b..3467fd44 100644 --- a/js/Sinks/CMAT3D.pickle +++ b/js/Sinks/CMAT3D.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'jetcolormap' +S'x' p2 -atp3 -Rp4 +aS'jetcolormap' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Sinks/CMATVIEW.js b/js/Sinks/CMATVIEW.js index f92782e5..d472334e 100644 --- a/js/Sinks/CMATVIEW.js +++ b/js/Sinks/CMATVIEW.js @@ -19,44 +19,45 @@ function CMATVIEW() { model.dep_ut = [true,false]; exprs = [[string("jetcolormap(25)")],[string(cmin)],[string(cmax)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CMATVIEW.prototype.details = function CMATVIEW() { + return this.x; } CMATVIEW.prototype.get = function CMATVIEW() { } CMATVIEW.prototype.set = function CMATVIEW() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,colormap,cmin,cmax,exprs] = scicos_getvalue("Set Scope parameters",[["ColorMap"],["Minimum level range"],["Maximum level range"]],list("vec",-1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (cmax<=cmin) { - mess = [[mess],["Error with minimum and maximum value"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - size_c = size(colormap.slice(),1); - sol = inv([[cmin,1],[cmax,1]])*[[1],[size_c/3]]; - alpha_c = sol[1-1]; - beta_c = sol[2-1]; - ipar = [[cmin],[cmax],[size_c]]; - rpar = [[alpha_c],[beta_c],[colormap.slice()]]; - model.ipar = ipar; - model.rpar = rpar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,colormap,cmin,cmax,exprs] = scicos_getvalue("Set Scope parameters",[["ColorMap"],["Minimum level range"],["Maximum level range"]],list("vec",-1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (cmax<=cmin) { + mess = [[mess],["Error with minimum and maximum value"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + size_c = size(colormap.slice(),1); + sol = inv([[cmin,1],[cmax,1]])*[[1],[size_c/3]]; + alpha_c = sol[1-1]; + beta_c = sol[2-1]; + ipar = [[cmin],[cmax],[size_c]]; + rpar = [[alpha_c],[beta_c],[colormap.slice()]]; + model.ipar = ipar; + model.rpar = rpar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CMATVIEW.pickle b/js/Sinks/CMATVIEW.pickle index 80ec981b..3467fd44 100644 --- a/js/Sinks/CMATVIEW.pickle +++ b/js/Sinks/CMATVIEW.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'jetcolormap' +S'x' p2 -atp3 -Rp4 +aS'jetcolormap' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Sinks/CMSCOPE.js b/js/Sinks/CMSCOPE.js index cfef200f..f8b69469 100644 --- a/js/Sinks/CMSCOPE.js +++ b/js/Sinks/CMSCOPE.js @@ -24,103 +24,104 @@ function CMSCOPE() { model.dep_ut = [true,false]; exprs = [[strcat(string(in1)," ")],[strcat(string(clrs)," ")],[string(win)],[sci2exp([])],[sci2exp([])],[strcat(string(ymin)," ")],[strcat(string(ymax)," ")],[strcat(string(per)," ")],[string(N)],[string(0)],[emptystr()]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CMSCOPE.prototype.details = function CMSCOPE() { + return this.x; } CMSCOPE.prototype.get = function CMSCOPE() { } CMSCOPE.prototype.set = function CMSCOPE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,in1,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,exprs] = scicos_getvalue("Set Scope parameters",[["Input ports sizes"],["Drawing colors (>0) or mark (<0)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin vector"],["Ymax vector"],["Refresh period"],["Buffer size"],["Accept herited events 0/1","Name of Scope (label&Id)"]],list("vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec","size(%1,\'*\')","vec","size(%1,\'*\')","vec","size(%1,\'*\')","vec",1,"vec",1,"str",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(in1,"*")<=0) { - mess = [[mess],["Block must have at least one input port"],[" "]]; - ok = false; -} - if (min(in1)<=0) { - mess = [[mess],["Port sizes must be positive"],[" "]]; - ok = false; -} - if (size(clrs,"*")=ymax)) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (!or(heritance==[0,1])) { - mess = [[mess],["Accept herited events must be 0 or 1"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - in1 = in1.slice(); - a = size(in1,1); - in2 = ones(a,1); - [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(a,1)),list(),ones(1-heritance,1),[]); -} - if (ok) { - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - if (ok) { - period = transpose(per.slice()); - yy = [[transpose(ymin.slice())],[transpose(ymax.slice())]]; - rpar = [[0],[period.slice()],[yy.slice()]]; - clrs = clrs.slice(1-1,sum(in1)); - ipar = [[win],[size(in1,"*")],[N],[wpos.slice()],[wdim.slice()],[in1.slice()],[clrs.slice()],[heritance]]; - model.evtin = ones(1-heritance,1); - model.dstate = []; - model.rpar = rpar; - model.ipar = ipar; - model.label = nom; - graphics.id = nom; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,in1,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,exprs] = scicos_getvalue("Set Scope parameters",[["Input ports sizes"],["Drawing colors (>0) or mark (<0)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin vector"],["Ymax vector"],["Refresh period"],["Buffer size"],["Accept herited events 0/1","Name of Scope (label&Id)"]],list("vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec","size(%1,\'*\')","vec","size(%1,\'*\')","vec","size(%1,\'*\')","vec",1,"vec",1,"str",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(in1,"*")<=0) { + mess = [[mess],["Block must have at least one input port"],[" "]]; + ok = false; + } + if (min(in1)<=0) { + mess = [[mess],["Port sizes must be positive"],[" "]]; + ok = false; + } + if (size(clrs,"*")=ymax)) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (!or(heritance==[0,1])) { + mess = [[mess],["Accept herited events must be 0 or 1"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + in1 = in1.slice(); + a = size(in1,1); + in2 = ones(a,1); + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(a,1)),list(),ones(1-heritance,1),[]); + } + if (ok) { + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + if (ok) { + period = transpose(per.slice()); + yy = [[transpose(ymin.slice())],[transpose(ymax.slice())]]; + rpar = [[0],[period.slice()],[yy.slice()]]; + clrs = clrs.slice(1-1,sum(in1)); + ipar = [[win],[size(in1,"*")],[N],[wpos.slice()],[wdim.slice()],[in1.slice()],[clrs.slice()],[heritance]]; + model.evtin = ones(1-heritance,1); + model.dstate = []; + model.rpar = rpar; + model.ipar = ipar; + model.label = nom; + graphics.id = nom; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sinks/CMSCOPE.pickle b/js/Sinks/CMSCOPE.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CMSCOPE.pickle +++ b/js/Sinks/CMSCOPE.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/CSCOPE.js b/js/Sinks/CSCOPE.js index 7b82402f..666b07a6 100644 --- a/js/Sinks/CSCOPE.js +++ b/js/Sinks/CSCOPE.js @@ -20,76 +20,77 @@ function CSCOPE() { model.dep_ut = [true,false]; exprs = [[strcat(string(clrs)," ")],[string(win)],[sci2exp([])],[sci2exp(wdim)],[string(ymin)],[string(ymax)],[string(per)],[string(N)],[transpose(string(0))],[emptystr()]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CSCOPE.prototype.details = function CSCOPE() { + return this.x; } CSCOPE.prototype.get = function CSCOPE() { } CSCOPE.prototype.set = function CSCOPE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,exprs] = scicos_getvalue("Set Scope parameters",[["Color (>0) or mark (<0) vector (8 entries)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin"],["Ymax"],["Refresh period"],["Buffer size","Accept herited events 0/1","Name of Scope (label&Id)"]],list("vec",8,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"str",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number can\'t be < -1"],[" "]]; - ok = false; -} - if (per<=0) { - mess = [[mess],["Refresh period must be positive"],[" "]]; - ok = false; -} - if (N<2) { - mess = [[mess],["Buffer size must be at least 2"],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (!or(heritance==[0,1])) { - mess = [[mess],["Accept herited events must be 0 or 1"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list([-1,1],1),list(),ones(1-heritance,1),[]); -} - if (ok) { - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[0],[ymin],[ymax],[per]]; - ipar = [[win],[1],[N],[clrs.slice()],[wpos.slice()],[wdim.slice()]]; - model.rpar = rpar; - model.ipar = ipar; - model.evtin = ones(1-heritance,1); - model.label = nom; - graphics.id = nom; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,exprs] = scicos_getvalue("Set Scope parameters",[["Color (>0) or mark (<0) vector (8 entries)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin"],["Ymax"],["Refresh period"],["Buffer size","Accept herited events 0/1","Name of Scope (label&Id)"]],list("vec",8,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"str",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number can\'t be < -1"],[" "]]; + ok = false; + } + if (per<=0) { + mess = [[mess],["Refresh period must be positive"],[" "]]; + ok = false; + } + if (N<2) { + mess = [[mess],["Buffer size must be at least 2"],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (!or(heritance==[0,1])) { + mess = [[mess],["Accept herited events must be 0 or 1"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([-1,1],1),list(),ones(1-heritance,1),[]); + } + if (ok) { + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[0],[ymin],[ymax],[per]]; + ipar = [[win],[1],[N],[clrs.slice()],[wpos.slice()],[wdim.slice()]]; + model.rpar = rpar; + model.ipar = ipar; + model.evtin = ones(1-heritance,1); + model.label = nom; + graphics.id = nom; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CSCOPE.pickle b/js/Sinks/CSCOPE.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CSCOPE.pickle +++ b/js/Sinks/CSCOPE.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/CSCOPXY.js b/js/Sinks/CSCOPXY.js index 2802f5a4..f06a4980 100644 --- a/js/Sinks/CSCOPXY.js +++ b/js/Sinks/CSCOPXY.js @@ -24,76 +24,77 @@ function CSCOPXY() { model.dep_ut = [false,false]; exprs = [[string(nbr_curves)],[sci2exp(clrs)],[sci2exp(siz)],[string(win)],[sci2exp([])],[sci2exp(wdim)],[string(xmin)],[string(xmax)],[string(ymin)],[string(ymax)],[string(N)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CSCOPXY.prototype.details = function CSCOPXY() { + return this.x; } CSCOPXY.prototype.get = function CSCOPXY() { } CSCOPXY.prototype.set = function CSCOPXY() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nbr_curves,clrs,siz,win,wpos,wdim,xmin,xmax,ymin,ymax,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of Curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Buffer size"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (nbr_curves<=0) { - mess = [[mess],["Number of Curves cannot be negative or null"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (N<1) { - mess = [[mess],["Buffer size must be at least 1"],[" "]]; - ok = false; -} - if (N==1&&clrs>0) { - mess = [[mess],["Buffer size must be at least 2"],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (xmin>=xmax) { - mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - in1 = nbr_curves*ones(2,1); - in2 = ones(2,1); - [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(2,1)),list(),ones(1,1),[]); - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[xmin],[xmax],[ymin],[ymax]]; - ipar = [[win],[1],[N],[clrs],[siz],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nbr_curves,clrs,siz,win,wpos,wdim,xmin,xmax,ymin,ymax,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of Curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Buffer size"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (nbr_curves<=0) { + mess = [[mess],["Number of Curves cannot be negative or null"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (N<1) { + mess = [[mess],["Buffer size must be at least 1"],[" "]]; + ok = false; + } + if (N==1&&clrs>0) { + mess = [[mess],["Buffer size must be at least 2"],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (xmin>=xmax) { + mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + in1 = nbr_curves*ones(2,1); + in2 = ones(2,1); + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(2,1)),list(),ones(1,1),[]); + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[xmin],[xmax],[ymin],[ymax]]; + ipar = [[win],[1],[N],[clrs],[siz],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CSCOPXY.pickle b/js/Sinks/CSCOPXY.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CSCOPXY.pickle +++ b/js/Sinks/CSCOPXY.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/CSCOPXY3D.js b/js/Sinks/CSCOPXY3D.js index 79af931a..b2751f5c 100644 --- a/js/Sinks/CSCOPXY3D.js +++ b/js/Sinks/CSCOPXY3D.js @@ -24,89 +24,90 @@ function CSCOPXY3D() { model.dep_ut = [false,false]; exprs = [[string(nbr_curves)],[strcat(string(clrs)," ")],[strcat(string(siz)," ")],[string(win)],[sci2exp([])],[sci2exp(wdim)],[strcat(string(vec_x)," ")],[strcat(string(vec_y)," ")],[strcat(string(vec_z)," ")],[strcat(string(param3ds)," ")],[string(N)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CSCOPXY3D.prototype.details = function CSCOPXY3D() { + return this.x; } CSCOPXY3D.prototype.get = function CSCOPXY3D() { } CSCOPXY3D.prototype.set = function CSCOPXY3D() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nbr_curves,clrs,siz,win,wpos,wdim,vec_x,vec_y,vec_z,param3ds,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of curves"],["color (>0) or mark (<0)"],["Line or Mark Size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin and Xmax"],["Ymin and Ymax"],["Zmin and Zmax"],["Alpha and Theta"],["Buffer size"]],list("vec",1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",2,"vec",2,"vec",2,"vec",2,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(clrs,"*")!=size(siz,"*")) { - mess = [[mess],["Colors and Size must have same size"],[" "]]; - ok = false; -} - if (nbr_curves<=0) { - mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (N<1) { - mess = [[mess],["Buffer size must be at least 1"],[" "]]; - ok = false; -} - if (N<2) { -for (i=1;i<=size(clrs,"*");i+=1) { - if (clrs[i-1]>0) { - mess = [[mess],["Buffer size must be at least 2 or Change a color (must be >0)"],[" "]]; - ok = false; -} -} -} - if (vec_y[1-1]>=vec_y[2-1]) { - mess = [[mess],["Ymax must be higher than Ymin"],[" "]]; - ok = false; -} - if (vec_x[1-1]>=vec_x[2-1]) { - mess = [[mess],["Xmax must be higher than Xmin"],[" "]]; - ok = false; -} - if (vec_z[1-1]>=vec_z[2-1]) { - mess = [[mess],["Zmax must be higher than Zmin"],[" "]]; - ok = false; -} - if (ok) { - in1 = nbr_curves*ones(3,1); - in2 = ones(3,1); - [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(3,1)),list(),ones(1,1),[]); - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[vec_x.slice()],[vec_y.slice()],[vec_z.slice()],[param3ds.slice()]]; - size_siz = size(siz,"*"); - ipar = [[win],[size_siz],[N],[clrs.slice()],[siz.slice()],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; - } else { -message(mess); -} -} + [ok,nbr_curves,clrs,siz,win,wpos,wdim,vec_x,vec_y,vec_z,param3ds,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of curves"],["color (>0) or mark (<0)"],["Line or Mark Size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin and Xmax"],["Ymin and Ymax"],["Zmin and Zmax"],["Alpha and Theta"],["Buffer size"]],list("vec",1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",2,"vec",2,"vec",2,"vec",2,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(clrs,"*")!=size(siz,"*")) { + mess = [[mess],["Colors and Size must have same size"],[" "]]; + ok = false; + } + if (nbr_curves<=0) { + mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (N<1) { + mess = [[mess],["Buffer size must be at least 1"],[" "]]; + ok = false; + } + if (N<2) { + for (i=1;i<=size(clrs,"*");i+=1) { + if (clrs[i-1]>0) { + mess = [[mess],["Buffer size must be at least 2 or Change a color (must be >0)"],[" "]]; + ok = false; + } + } + } + if (vec_y[1-1]>=vec_y[2-1]) { + mess = [[mess],["Ymax must be higher than Ymin"],[" "]]; + ok = false; + } + if (vec_x[1-1]>=vec_x[2-1]) { + mess = [[mess],["Xmax must be higher than Xmin"],[" "]]; + ok = false; + } + if (vec_z[1-1]>=vec_z[2-1]) { + mess = [[mess],["Zmax must be higher than Zmin"],[" "]]; + ok = false; + } + if (ok) { + in1 = nbr_curves*ones(3,1); + in2 = ones(3,1); + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(3,1)),list(),ones(1,1),[]); + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[vec_x.slice()],[vec_y.slice()],[vec_z.slice()],[param3ds.slice()]]; + size_siz = size(siz,"*"); + ipar = [[win],[size_siz],[N],[clrs.slice()],[siz.slice()],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } else { + message(mess); + } + } } } diff --git a/js/Sinks/CSCOPXY3D.pickle b/js/Sinks/CSCOPXY3D.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CSCOPXY3D.pickle +++ b/js/Sinks/CSCOPXY3D.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/OUTIMPL_f.js b/js/Sinks/OUTIMPL_f.js index 7bc12dad..c77851b6 100644 --- a/js/Sinks/OUTIMPL_f.js +++ b/js/Sinks/OUTIMPL_f.js @@ -15,40 +15,41 @@ function OUTIMPL_f() { model.equations = mo; exprs = "1"; gr_i = []; - x = standard_define([1,1],model,exprs,gr_i); - x.graphics.in_implicit = ["I"]; + this.x = standard_define([1,1],model,exprs,gr_i); + this.x.graphics.in_implicit = ["I"]; } OUTIMPL_f.prototype.details = function OUTIMPL_f() { + return this.x; } OUTIMPL_f.prototype.get = function OUTIMPL_f() { } OUTIMPL_f.prototype.set = function OUTIMPL_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==2) { - exprs = exprs[1-1]; -} + exprs = exprs[1-1]; + } while (true) { - [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"OUTIMPL_f")],[" "],[gettext("Implicit output port")]],gettext("Port number"),list("vec",1),exprs); - if (!ok) { -break; -} - prt = int(prt); - if (prt<=0) { -block_parameter_error(msprintf(gettext("Wrong value for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); - } else { - if (model.ipar!=prt) { - needcompile = 4; - y = needcompile; -} - model.ipar = prt; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"OUTIMPL_f")],[" "],[gettext("Implicit output port")]],gettext("Port number"),list("vec",1),exprs); + if (!ok) { + break; + } + prt = int(prt); + if (prt<=0) { + block_parameter_error(msprintf(gettext("Wrong value for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); + } else { + if (model.ipar!=prt) { + needcompile = 4; + y = needcompile; + } + model.ipar = prt; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/OUTIMPL_f.pickle b/js/Sinks/OUTIMPL_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/OUTIMPL_f.pickle +++ b/js/Sinks/OUTIMPL_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/OUT_f.js b/js/Sinks/OUT_f.js index b2ff10e3..e339d285 100644 --- a/js/Sinks/OUT_f.js +++ b/js/Sinks/OUT_f.js @@ -13,35 +13,36 @@ function OUT_f() { model.dep_ut = [false,false]; exprs = string(prt); gr_i = []; - x = standard_define([1,1],model,exprs,gr_i); + this.x = standard_define([1,1],model,exprs,gr_i); } OUT_f.prototype.details = function OUT_f() { + return this.x; } OUT_f.prototype.get = function OUT_f() { } OUT_f.prototype.set = function OUT_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; if (size(exprs,"*")==2) { - exprs = exprs[1-1]; -} + exprs = exprs[1-1]; + } while (true) { - [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"OUT_f")],[" "],[gettext("Regular output port")]],gettext("Port number"),list("vec",1),exprs); - if (!ok) { -break; -} - prt = int(prt); - if (prt<=0) { -block_parameter_error(msprintf(gettext("Wrong value for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); - } else { - model.ipar = prt; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"OUT_f")],[" "],[gettext("Regular output port")]],gettext("Port number"),list("vec",1),exprs); + if (!ok) { + break; + } + prt = int(prt); + if (prt<=0) { + block_parameter_error(msprintf(gettext("Wrong value for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); + } else { + model.ipar = prt; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/OUT_f.pickle b/js/Sinks/OUT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/OUT_f.pickle +++ b/js/Sinks/OUT_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/TOWS_c.js b/js/Sinks/TOWS_c.js index d69b9110..feaf8354 100644 --- a/js/Sinks/TOWS_c.js +++ b/js/Sinks/TOWS_c.js @@ -20,46 +20,47 @@ function TOWS_c() { model.dep_ut = [false,false]; gr_i = []; exprs = [[string(nz)],[string(varnam)],[string(herit)]]; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } TOWS_c.prototype.details = function TOWS_c() { + return this.x; } TOWS_c.prototype.get = function TOWS_c() { } TOWS_c.prototype.set = function TOWS_c() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,nz,varnam,herit,exprs] = scicos_getvalue("Set Xcos buffer block",[["Size of buffer"],["Scilab variable name"],["Inherit (no:0, yes:1)"]],list("vec",1,"str",1,"vec",1),exprs); - if (!ok) { -break; -} - if ((nz<=0)) { -message("Size of buffer must be positive"); - ok = false; -} - r = false; - ierr = execstr("r = validvar(varnam)","errcatch"); - if (!r||ierr!=0||length(varnam)>19) { -message([["Invalid variable name."],["Please choose another variable name."]]); - ok = false; -} -execstr("if type("+varnam+") <> 17 | or(fieldnames("+varnam+") <> [\"values\"; \"time\"]) then"+" message([\"Protected variable name.\"; \"Please choose another variable name.\"]);"+" ok = %f;"+" end","errcatch"); - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list([-1,-2],-1),list(),ones(1-herit,1),[]); - if (herit==1) { - model.blocktype = "x"; - } else { - model.blocktype = "d"; -} - model.ipar = [[nz],[length(varnam)],[transpose(this.ascii[varnam-1])]]; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nz,varnam,herit,exprs] = scicos_getvalue("Set Xcos buffer block",[["Size of buffer"],["Scilab variable name"],["Inherit (no:0, yes:1)"]],list("vec",1,"str",1,"vec",1),exprs); + if (!ok) { + break; + } + if ((nz<=0)) { + message("Size of buffer must be positive"); + ok = false; + } + r = false; + ierr = execstr("r = validvar(varnam)","errcatch"); + if (!r||ierr!=0||length(varnam)>19) { + message([["Invalid variable name."],["Please choose another variable name."]]); + ok = false; + } + execstr("if type("+varnam+") <> 17 | or(fieldnames("+varnam+") <> [\"values\"; \"time\"]) then"+" message([\"Protected variable name.\"; \"Please choose another variable name.\"]);"+" ok = %f;"+" end","errcatch"); + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([-1,-2],-1),list(),ones(1-herit,1),[]); + if (herit==1) { + model.blocktype = "x"; + } else { + model.blocktype = "d"; + } + model.ipar = [[nz],[length(varnam)],[transpose(this.ascii[varnam-1])]]; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/TOWS_c.pickle b/js/Sinks/TOWS_c.pickle index 78d6aa96..62d608a3 100644 --- a/js/Sinks/TOWS_c.pickle +++ b/js/Sinks/TOWS_c.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'ascii' +S'x' p2 -atp3 -Rp4 +aS'ascii' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Sinks/TRASH_f.js b/js/Sinks/TRASH_f.js index 691a96af..08d08d47 100644 --- a/js/Sinks/TRASH_f.js +++ b/js/Sinks/TRASH_f.js @@ -10,13 +10,14 @@ function TRASH_f() { model.dep_ut = [false,false]; exprs = " "; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } TRASH_f.prototype.details = function TRASH_f() { + return this.x; } TRASH_f.prototype.get = function TRASH_f() { } TRASH_f.prototype.set = function TRASH_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Sinks/TRASH_f.pickle b/js/Sinks/TRASH_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/TRASH_f.pickle +++ b/js/Sinks/TRASH_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sinks/WFILE_f.js b/js/Sinks/WFILE_f.js index 9acdb952..b1b5a5b9 100644 --- a/js/Sinks/WFILE_f.js +++ b/js/Sinks/WFILE_f.js @@ -17,19 +17,20 @@ function WFILE_f() { model.dep_ut = [true,false]; exprs = [[sci2exp(in1)],[fname],[frmt],[string(N)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } WFILE_f.prototype.details = function WFILE_f() { + return this.x; } WFILE_f.prototype.get = function WFILE_f() { } WFILE_f.prototype.set = function WFILE_f() { -warnobsolete("WRITEC_f","6.0.0"); + warnobsolete("WRITEC_f","6.0.0"); warnMessage = msprintf(_("Feature %s is obsolete."),"WFILE_f"); warnAdvise = msprintf(_("Please use %s instead."),"WRITEC_f"); warnXcosMessage = msprintf("%s %s",warnMessage,warnAdvise); -warnBlockByUID(arg1.model.label,warnXcosMessage); - x = arg1; + warnBlockByUID(arg1.model.label,warnXcosMessage); + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -38,53 +39,53 @@ warnBlockByUID(arg1.model.label,warnXcosMessage); fname = exprs[2-1]; frmt = exprs[3-1]; while (true) { - [ok,in1,fname1,frmt1,N,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WFILE_f")],[" "],[gettext("Write to output file")],[" "],[gettext("Write is done on:")],[gettext("  - A binary file if no format given")],[gettext("  - A formatted text file if a format (Fortran type) is given")]],[[gettext("Input Size")],[gettext("Output File Name")],[gettext("Output Format")],[gettext("Buffer Size")]],list("vec",1,"str",1,"str",1,"vec",1),exprs); - if (!ok) { -break; -} - in1 = int(in1); - nin = in1; - fname1 = pathconvert(stripblanks(fname1),false,true); - frmt1 = stripblanks(frmt1); - if (lunit>0&&min(length(frmt),1)!=min(length(frmt1),1)) { -block_parameter_error(gettext("Simulation running !!! You cannot switch
between formatted and unformatted when running"),gettext("End current simulation first.")); - ok = false; - } else if (lunit>0&&fname1!=fname) { -block_parameter_error(gettext("You cannot modify \'Output File Name\' when running."),gettext("End current simulation first.")); - ok = false; - } else if (fname1=="") { -block_parameter_error(gettext("Wrong value for \'Output File Name\' parameter"),gettext("You must provide a filename.")); - ok = false; - } else if (fileparts(fname1)!="") { - [pa,fn,ex] = fileparts(fname1); - if (!this.isdir[pa-1]) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),msprintf(gettext("Directory \'%s\' does not exist"),pa)); - ok = false; -} - } else if (frmt1!=""&&(part(frmt1,1)!="("||part(frmt1,length(frmt1))!=")")) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("You must enclose the format\'s string between parentheses.")); - ok = false; - } else if (N<2) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Must be greater than 1.")); - ok = false; - } else if (in1<=0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Input Size"),in1),gettext("Strictly positive integer expected.")); - ok = false; -} - if (ok) { - ipar = [[length(fname1)],[length(frmt1)],[0],[N],[this._str2code[fname1-1]],[this._str2code[frmt1-1]]]; - if (prod(size(dstate))!=(nin+1)*N+2) { - dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; -} - model.in1 = nin; - model.dstate = dstate; - model.ipar = ipar; - model.dep_ut = [true,false]; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,in1,fname1,frmt1,N,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WFILE_f")],[" "],[gettext("Write to output file")],[" "],[gettext("Write is done on:")],[gettext("  - A binary file if no format given")],[gettext("  - A formatted text file if a format (Fortran type) is given")]],[[gettext("Input Size")],[gettext("Output File Name")],[gettext("Output Format")],[gettext("Buffer Size")]],list("vec",1,"str",1,"str",1,"vec",1),exprs); + if (!ok) { + break; + } + in1 = int(in1); + nin = in1; + fname1 = pathconvert(stripblanks(fname1),false,true); + frmt1 = stripblanks(frmt1); + if (lunit>0&&min(length(frmt),1)!=min(length(frmt1),1)) { + block_parameter_error(gettext("Simulation running !!! You cannot switch
between formatted and unformatted when running"),gettext("End current simulation first.")); + ok = false; + } else if (lunit>0&&fname1!=fname) { + block_parameter_error(gettext("You cannot modify \'Output File Name\' when running."),gettext("End current simulation first.")); + ok = false; + } else if (fname1=="") { + block_parameter_error(gettext("Wrong value for \'Output File Name\' parameter"),gettext("You must provide a filename.")); + ok = false; + } else if (fileparts(fname1)!="") { + [pa,fn,ex] = fileparts(fname1); + if (!this.isdir[pa-1]) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),msprintf(gettext("Directory \'%s\' does not exist"),pa)); + ok = false; + } + } else if (frmt1!=""&&(part(frmt1,1)!="("||part(frmt1,length(frmt1))!=")")) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("You must enclose the format\'s string between parentheses.")); + ok = false; + } else if (N<2) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Must be greater than 1.")); + ok = false; + } else if (in1<=0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Input Size"),in1),gettext("Strictly positive integer expected.")); + ok = false; + } + if (ok) { + ipar = [[length(fname1)],[length(frmt1)],[0],[N],[this._str2code[fname1-1]],[this._str2code[frmt1-1]]]; + if (prod(size(dstate))!=(nin+1)*N+2) { + dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; + } + model.in1 = nin; + model.dstate = dstate; + model.ipar = ipar; + model.dep_ut = [true,false]; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/WFILE_f.pickle b/js/Sinks/WFILE_f.pickle index c7024ed7..0cb2ae6e 100644 --- a/js/Sinks/WFILE_f.pickle +++ b/js/Sinks/WFILE_f.pickle @@ -4,8 +4,10 @@ p0 ((lp1 S'isdir' p2 -aS'_str2code' +aS'x' p3 -atp4 -Rp5 +aS'_str2code' +p4 +atp5 +Rp6 . \ No newline at end of file diff --git a/js/Sinks/WRITEAU_f.js b/js/Sinks/WRITEAU_f.js index 847a2140..40833663 100644 --- a/js/Sinks/WRITEAU_f.js +++ b/js/Sinks/WRITEAU_f.js @@ -18,14 +18,15 @@ function WRITEAU_f() { model.dep_ut = [true,false]; exprs = [string(N),string(swap)]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } WRITEAU_f.prototype.details = function WRITEAU_f() { + return this.x; } WRITEAU_f.prototype.get = function WRITEAU_f() { } WRITEAU_f.prototype.set = function WRITEAU_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -33,37 +34,37 @@ function WRITEAU_f() { dstate = model.dstate; lunit = dstate[2-1]; while (true) { - [ok,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WRITEAU_f")],[" "],[gettext("Write \'.au\' sound file on audio device")]],[[gettext("Buffer Size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - nin = 1; - fname1 = "/dev/audio"; - frmt1 = "uc "; - if (this.alreadyran&&(N!=ipar[5-1])) { -block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Buffer Size")),gettext("End current simulation first")); - ok = false; - } else if (N<1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected.")); - ok = false; -} - if (swap!=0&&swap!=1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Swap Mode"),swap),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); - ok = false; -} - if (ok) { - ipar = [[length(fname1)],[this._str2code[frmt1-1]],[N],[swap],[this._str2code[fname1-1]]]; - if (prod(size(dstate))!=(nin+1)*N+2) { - dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; -} - model.in1 = 1; - model.dstate = dstate; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WRITEAU_f")],[" "],[gettext("Write \'.au\' sound file on audio device")]],[[gettext("Buffer Size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + nin = 1; + fname1 = "/dev/audio"; + frmt1 = "uc "; + if (this.alreadyran&&(N!=ipar[5-1])) { + block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Buffer Size")),gettext("End current simulation first")); + ok = false; + } else if (N<1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected.")); + ok = false; + } + if (swap!=0&&swap!=1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Swap Mode"),swap),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); + ok = false; + } + if (ok) { + ipar = [[length(fname1)],[this._str2code[frmt1-1]],[N],[swap],[this._str2code[fname1-1]]]; + if (prod(size(dstate))!=(nin+1)*N+2) { + dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; + } + model.in1 = 1; + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/WRITEAU_f.pickle b/js/Sinks/WRITEAU_f.pickle index 62a7fafc..8a32035f 100644 --- a/js/Sinks/WRITEAU_f.pickle +++ b/js/Sinks/WRITEAU_f.pickle @@ -4,8 +4,10 @@ p0 ((lp1 S'_str2code' p2 -aS'alreadyran' +aS'x' p3 -atp4 -Rp5 +aS'alreadyran' +p4 +atp5 +Rp6 . \ No newline at end of file diff --git a/js/Sinks/WRITEC_f.js b/js/Sinks/WRITEC_f.js index dfe9db07..20e8e20c 100644 --- a/js/Sinks/WRITEC_f.js +++ b/js/Sinks/WRITEC_f.js @@ -18,14 +18,15 @@ function WRITEC_f() { model.dep_ut = [true,false]; exprs = [[sci2exp(in1)],[fname],[frmt],[string(N),string(swap)]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } WRITEC_f.prototype.details = function WRITEC_f() { + return this.x; } WRITEC_f.prototype.get = function WRITEC_f() { } WRITEC_f.prototype.set = function WRITEC_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -35,56 +36,56 @@ function WRITEC_f() { fname = exprs[2-1]; frmt = exprs[3-1]; while (true) { - [ok,in1,fname1,frmt1,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WRITEC_f")],[" "],[gettext("Write to C binary file")]],[[gettext("Input Size")],[gettext("Output File Name")],[gettext("Output Format")],[gettext("Buffer Size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",1,"str",1,"str",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - in1 = int(in1); - nin = in1; - fname1 = pathconvert(stripblanks(fname1),false,true); - frmt1 = stripblanks(frmt1); - fmts = ["s","l","d","f","c","us","ul","uc","ull","uls","ubl","ubs","dl","fl","ll","sl","db","fb","lb","sb"]; - if (and(frmt1!=fmts)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("Valid formats are: "+strcat(fmts,", "))); - ok = false; - } else if (this.alreadyran&&fname1!=fname) { -block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running"),gettext("Input Format")),gettext("End current simulation first.")); - ok = false; - } else if (this.alreadyran&&N!=ipar[5-1]) { -block_parameter_error(msprintf(gettext("You cannot modify \'Buffer Size\' when running."),gettext("Buffer Size")),gettext("End current simulation first")); - ok = false; - } else if (fname1=="") { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),gettext("You must provide a filename.")); - } else if (fileparts(fname1)!="") { - [pa,fn,ex] = fileparts(fname1); - if (!this.isdir[pa-1]) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),msprintf(gettext("Directory \'%s\' does not exist"),pa)); - ok = false; -} - } else if (N<1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected.")); - ok = false; - } else if (in1<=0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Input Size"),in1),gettext("Strictly positive integer expected.")); - ok = false; - } else if (swap!=0&&swap!=1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Swap Mode"),swap),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); - ok = false; -} - frmt1 = part(frmt1,1,3); - if (ok) { - ipar = [[length(fname1)],[this._str2code[frmt1-1]],[N],[swap],[this._str2code[fname1-1]]]; - if (prod(size(dstate))!=(nin+1)*N+2) { - dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; -} - model.in1 = nin; - model.dstate = dstate; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,in1,fname1,frmt1,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WRITEC_f")],[" "],[gettext("Write to C binary file")]],[[gettext("Input Size")],[gettext("Output File Name")],[gettext("Output Format")],[gettext("Buffer Size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",1,"str",1,"str",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + in1 = int(in1); + nin = in1; + fname1 = pathconvert(stripblanks(fname1),false,true); + frmt1 = stripblanks(frmt1); + fmts = ["s","l","d","f","c","us","ul","uc","ull","uls","ubl","ubs","dl","fl","ll","sl","db","fb","lb","sb"]; + if (and(frmt1!=fmts)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("Valid formats are: "+strcat(fmts,", "))); + ok = false; + } else if (this.alreadyran&&fname1!=fname) { + block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running"),gettext("Input Format")),gettext("End current simulation first.")); + ok = false; + } else if (this.alreadyran&&N!=ipar[5-1]) { + block_parameter_error(msprintf(gettext("You cannot modify \'Buffer Size\' when running."),gettext("Buffer Size")),gettext("End current simulation first")); + ok = false; + } else if (fname1=="") { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),gettext("You must provide a filename.")); + } else if (fileparts(fname1)!="") { + [pa,fn,ex] = fileparts(fname1); + if (!this.isdir[pa-1]) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),msprintf(gettext("Directory \'%s\' does not exist"),pa)); + ok = false; + } + } else if (N<1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected.")); + ok = false; + } else if (in1<=0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Input Size"),in1),gettext("Strictly positive integer expected.")); + ok = false; + } else if (swap!=0&&swap!=1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Swap Mode"),swap),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); + ok = false; + } + frmt1 = part(frmt1,1,3); + if (ok) { + ipar = [[length(fname1)],[this._str2code[frmt1-1]],[N],[swap],[this._str2code[fname1-1]]]; + if (prod(size(dstate))!=(nin+1)*N+2) { + dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; + } + model.in1 = nin; + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/WRITEC_f.pickle b/js/Sinks/WRITEC_f.pickle index 80ba7661..b0c10e53 100644 --- a/js/Sinks/WRITEC_f.pickle +++ b/js/Sinks/WRITEC_f.pickle @@ -4,10 +4,12 @@ p0 ((lp1 S'isdir' p2 -aS'_str2code' +aS'x' p3 -aS'alreadyran' +aS'_str2code' p4 -atp5 -Rp6 +aS'alreadyran' +p5 +atp6 +Rp7 . \ No newline at end of file diff --git a/js/Sources/CLKINV_f.js b/js/Sources/CLKINV_f.js index eef5c718..9eb73a81 100644 --- a/js/Sources/CLKINV_f.js +++ b/js/Sources/CLKINV_f.js @@ -11,35 +11,36 @@ function CLKINV_f() { model.dep_ut = [false,false]; exprs = string(prt); gr_i = []; - x = standard_define([1,1],model,exprs,gr_i); + this.x = standard_define([1,1],model,exprs,gr_i); } CLKINV_f.prototype.details = function CLKINV_f() { + return this.x; } CLKINV_f.prototype.get = function CLKINV_f() { } CLKINV_f.prototype.set = function CLKINV_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; exprs = exprs[1-1]; while (true) { - [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLKINV_f")],[" "],[gettext("Event input port")],[" "]],"Port Number",list("vec",1),exprs); - prt = int(prt); - if (!ok) { -break; -} - if (prt<=0) { -block_parameter_error(msprintf(gettext("Wrong values for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); - } else { - model.ipar = prt; - model.evtout = 1; - model.firing = -1; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLKINV_f")],[" "],[gettext("Event input port")],[" "]],"Port Number",list("vec",1),exprs); + prt = int(prt); + if (!ok) { + break; + } + if (prt<=0) { + block_parameter_error(msprintf(gettext("Wrong values for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); + } else { + model.ipar = prt; + model.evtout = 1; + model.firing = -1; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/CLKINV_f.pickle b/js/Sources/CLKINV_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CLKINV_f.pickle +++ b/js/Sources/CLKINV_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/CLKIN_f.js b/js/Sources/CLKIN_f.js index 727e5422..f8cf6735 100644 --- a/js/Sources/CLKIN_f.js +++ b/js/Sources/CLKIN_f.js @@ -10,35 +10,36 @@ function CLKIN_f() { model.firing = -1; model.dep_ut = [false,false]; exprs = string(prt); - x = standard_define([1,1],model,exprs," "); + this.x = standard_define([1,1],model,exprs," "); } CLKIN_f.prototype.details = function CLKIN_f() { + return this.x; } CLKIN_f.prototype.get = function CLKIN_f() { } CLKIN_f.prototype.set = function CLKIN_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; exprs = exprs[1-1]; while (true) { - [ok,prt,exprs] = scicos_getvalue("Set Event Input block parameters","Port number",list("vec",1),exprs); - prt = int(prt); - if (!ok) { -break; -} - if (prt<=0) { -message("Port number must be a positive integer"); - } else { - model.ipar = prt; - model.evtout = 1; - model.firing = -1; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,prt,exprs] = scicos_getvalue("Set Event Input block parameters","Port number",list("vec",1),exprs); + prt = int(prt); + if (!ok) { + break; + } + if (prt<=0) { + message("Port number must be a positive integer"); + } else { + model.ipar = prt; + model.evtout = 1; + model.firing = -1; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/CLKIN_f.pickle b/js/Sources/CLKIN_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CLKIN_f.pickle +++ b/js/Sources/CLKIN_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/CLOCK_c.js b/js/Sources/CLOCK_c.js index 78b0f1e1..aac88f72 100644 --- a/js/Sources/CLOCK_c.js +++ b/js/Sources/CLOCK_c.js @@ -29,30 +29,31 @@ function CLOCK_c() { diagram.objs[4-1] = split; diagram.objs[5-1] = scicos_link(xx=[[380.71],[399]],yy=[[172],[172]],ct=[5,-1],from=[4,1],to=[1,1]); diagram.objs[6-1] = scicos_link(xx=[[380.71],[380.71],[340],[340]],yy=[[172],[302],[302],[277.71]],ct=[5,-1],from=[4,2],to=[2,1]); - x = scicos_block(); - x.gui = "CLOCK_c"; - x.graphics.sz = [2,2]; - x.graphics.gr_i = gr_i; - x.graphics.peout = 0; - x.model.sim = "csuper"; - x.model.evtout = 1; - x.model.blocktype = "h"; - x.model.firing = false; - x.model.dep_ut = [false,false]; - x.model.rpar = diagram; + this.x = scicos_block(); + this.x.gui = "CLOCK_c"; + this.x.graphics.sz = [2,2]; + this.x.graphics.gr_i = gr_i; + this.x.graphics.peout = 0; + this.x.model.sim = "csuper"; + this.x.model.evtout = 1; + this.x.model.blocktype = "h"; + this.x.model.firing = false; + this.x.model.dep_ut = [false,false]; + this.x.model.rpar = diagram; } CLOCK_c.prototype.details = function CLOCK_c() { + return this.x; } CLOCK_c.prototype.get = function CLOCK_c() { } CLOCK_c.prototype.set = function CLOCK_c() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="EVTDLY_c") { - path = i; -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="EVTDLY_c") { + path = i; + break; + } + } newpar = list(); xx = arg1.model.rpar.objs[path-1]; exprs = xx.graphics.exprs; @@ -61,32 +62,32 @@ break; dt_old = model.rpar[1-1]; model_n = model; while (true) { - [ok,dt,t0,exprs0] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLOCK_c")],[" "],[gettext("Event clock generator")],[" "],[gettext("  Do not start if \'Initialisation Time\' is negative")],[" "]],[[gettext("Period")],[gettext("Initialisation Time")]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (dt<=0) { -block_parameter_error(msprintf(gettext("Wrong values for \'%s\' parameter: %5.1e."),gettext("Period"),dt),gettext("Strictly positive number expected.")); - ok = false; -} - if (ok) { - xx.graphics.exprs = exprs0; - model.rpar = [[dt],[t0]]; - model.firing = t0; - xx.model = model; - arg1.model.rpar.objs[path-1] = xx; -break; -} -} + [ok,dt,t0,exprs0] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLOCK_c")],[" "],[gettext("Event clock generator")],[" "],[gettext("  Do not start if \'Initialisation Time\' is negative")],[" "]],[[gettext("Period")],[gettext("Initialisation Time")]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (dt<=0) { + block_parameter_error(msprintf(gettext("Wrong values for \'%s\' parameter: %5.1e."),gettext("Period"),dt),gettext("Strictly positive number expected.")); + ok = false; + } + if (ok) { + xx.graphics.exprs = exprs0; + model.rpar = [[dt],[t0]]; + model.firing = t0; + xx.model = model; + arg1.model.rpar.objs[path-1] = xx; + break; + } + } if (!and([t0_old,dt_old]==[t0,dt])) { - newpar[size(newpar)+1-1] = path; -} + newpar[size(newpar)+1-1] = path; + } if (t0_old!=t0) { - needcompile = 2; + needcompile = 2; } else { - needcompile = 0; -} - x = arg1; + needcompile = 0; + } + this.x = arg1; y = needcompile; typ = newpar; } diff --git a/js/Sources/CLOCK_c.pickle b/js/Sources/CLOCK_c.pickle index 50891984..2287bb36 100644 --- a/js/Sources/CLOCK_c.pickle +++ b/js/Sources/CLOCK_c.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'EVTDLY_c' +S'x' p2 -atp3 -Rp4 +aS'EVTDLY_c' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Sources/CLOCK_f.js b/js/Sources/CLOCK_f.js index 2ddee5fe..ddfcd81b 100644 --- a/js/Sources/CLOCK_f.js +++ b/js/Sources/CLOCK_f.js @@ -29,30 +29,31 @@ function CLOCK_f() { diagram.objs[4-1] = split; diagram.objs[5-1] = scicos_link(xx=[[380.71],[399]],yy=[[172],[172]],ct=[5,-1],from=[4,1],to=[1,1]); diagram.objs[6-1] = scicos_link(xx=[[380.71],[380.71],[340],[340]],yy=[[172],[302],[302],[277.71]],ct=[5,-1],from=[4,2],to=[2,1]); - x = scicos_block(); - x.gui = "CLOCK_f"; - x.graphics.sz = [2,2]; - x.graphics.gr_i = gr_i; - x.graphics.peout = 0; - x.model.sim = "csuper"; - x.model.evtout = 1; - x.model.blocktype = "h"; - x.model.firing = false; - x.model.dep_ut = [false,false]; - x.model.rpar = diagram; + this.x = scicos_block(); + this.x.gui = "CLOCK_f"; + this.x.graphics.sz = [2,2]; + this.x.graphics.gr_i = gr_i; + this.x.graphics.peout = 0; + this.x.model.sim = "csuper"; + this.x.model.evtout = 1; + this.x.model.blocktype = "h"; + this.x.model.firing = false; + this.x.model.dep_ut = [false,false]; + this.x.model.rpar = diagram; } CLOCK_f.prototype.details = function CLOCK_f() { + return this.x; } CLOCK_f.prototype.get = function CLOCK_f() { } CLOCK_f.prototype.set = function CLOCK_f() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") { - path = i; -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") { + path = i; + break; + } + } newpar = list(); xx = arg1.model.rpar.objs[path-1]; exprs = xx.graphics.exprs; @@ -61,32 +62,32 @@ break; dt_old = model.rpar; model_n = model; while (true) { - [ok,dt,t0,exprs0] = scicos_getvalue("Set Clock block parameters",[["Period"],["Init time"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (dt<=0) { -message("period must be positive"); - ok = false; -} - if (ok) { - xx.graphics.exprs = exprs0; - model.rpar = dt; - model.firing = t0; - xx.model = model; - arg1.model.rpar.objs[path-1] = xx; -break; -} -} + [ok,dt,t0,exprs0] = scicos_getvalue("Set Clock block parameters",[["Period"],["Init time"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (dt<=0) { + message("period must be positive"); + ok = false; + } + if (ok) { + xx.graphics.exprs = exprs0; + model.rpar = dt; + model.firing = t0; + xx.model = model; + arg1.model.rpar.objs[path-1] = xx; + break; + } + } if (!and([t0_old,dt_old]==[t0,dt])||!and(exprs0==exprs)) { - newpar[size(newpar)+1-1] = path; -} + newpar[size(newpar)+1-1] = path; + } if (t0_old!=t0) { - needcompile = 2; + needcompile = 2; } else { - needcompile = 0; -} - x = arg1; + needcompile = 0; + } + this.x = arg1; y = needcompile; typ = newpar; } diff --git a/js/Sources/CLOCK_f.pickle b/js/Sources/CLOCK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CLOCK_f.pickle +++ b/js/Sources/CLOCK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/CONST.js b/js/Sources/CONST.js index d96bad1c..509e6271 100644 --- a/js/Sources/CONST.js +++ b/js/Sources/CONST.js @@ -11,36 +11,37 @@ function CONST() { model.dep_ut = [false,false]; exprs = strcat(sci2exp(C)); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CONST.prototype.details = function CONST() { + return this.x; } CONST.prototype.get = function CONST() { } CONST.prototype.set = function CONST() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,C,exprs] = scicos_getvalue(["Set Contant Block"],"Constant",list("vec",-1),exprs); - if (!ok) { -break; -} - sz = size(C); - nout = size(C,"*"); - if (nout==0) { -message("C must have at least one element"); - } else if (and(sz>1)) { -message("C matrix is not supported, use CONST_m instead"); - } else { - model.rpar = C.slice(); - model.out = nout; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,C,exprs] = scicos_getvalue(["Set Contant Block"],"Constant",list("vec",-1),exprs); + if (!ok) { + break; + } + sz = size(C); + nout = size(C,"*"); + if (nout==0) { + message("C must have at least one element"); + } else if (and(sz>1)) { + message("C matrix is not supported, use CONST_m instead"); + } else { + model.rpar = C.slice(); + model.out = nout; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/CONST.pickle b/js/Sources/CONST.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CONST.pickle +++ b/js/Sources/CONST.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/CONST_f.js b/js/Sources/CONST_f.js index ee7d7566..8753b046 100644 --- a/js/Sources/CONST_f.js +++ b/js/Sources/CONST_f.js @@ -11,33 +11,34 @@ function CONST_f() { model.dep_ut = [false,false]; exprs = strcat(sci2exp(C)); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CONST_f.prototype.details = function CONST_f() { + return this.x; } CONST_f.prototype.get = function CONST_f() { } CONST_f.prototype.set = function CONST_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,C,exprs] = scicos_getvalue(["Set Contant Block"],"Constant",list("vec",-1),exprs); - if (!ok) { -break; -} - nout = size(C,"*"); - if (nout==0) { -message("C must have at least one element"); - } else { - model.rpar = C.slice(); - model.out = nout; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,C,exprs] = scicos_getvalue(["Set Contant Block"],"Constant",list("vec",-1),exprs); + if (!ok) { + break; + } + nout = size(C,"*"); + if (nout==0) { + message("C must have at least one element"); + } else { + model.rpar = C.slice(); + model.out = nout; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/CONST_f.pickle b/js/Sources/CONST_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CONST_f.pickle +++ b/js/Sources/CONST_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/CONST_m.js b/js/Sources/CONST_m.js index 471e09ff..ac1e84ce 100644 --- a/js/Sources/CONST_m.js +++ b/js/Sources/CONST_m.js @@ -14,59 +14,60 @@ function CONST_m() { model.dep_ut = [false,false]; exprs = sci2exp(C); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CONST_m.prototype.details = function CONST_m() { + return this.x; } CONST_m.prototype.get = function CONST_m() { } CONST_m.prototype.set = function CONST_m() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,C,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CONST_m")],[" "],[gettext("Constant value generator")],[" "]],gettext("Constant Value"),list("vec",-1),exprs); - if (!ok) { -break; -} - nout = size(C); - if (find(nout==0)!=[]) { -block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter"),gettext("Constant Value")),gettext("Constant value must have at least one element.")); - } else { - model.sim = list("cstblk4_m",4); - model.opar = list(C); - if ((this.type[C-1]==1)) { - if (isreal(C)) { - ot = 1; - } else { - ot = 2; -} - } else if ((typeof(C)=="int32")) { - ot = 3; - } else if ((typeof(C)=="int16")) { - ot = 4; - } else if ((typeof(C)=="int8")) { - ot = 5; - } else if ((typeof(C)=="uint32")) { - ot = 6; - } else if ((typeof(C)=="uint16")) { - ot = 7; - } else if ((typeof(C)=="uint8")) { - ot = 8; - } else { -block_parameter_error(msprintf(gettext("Wrong type for \'%s\' parameter"),gettext("Constant Value")),gettext("Value type must be a numeric type (double, complex, int, int8, ...).")); - ok = false; -} - if (ok) { - model.rpar = []; - [model,graphics,ok] = set_io(model,graphics,list(),list(nout,ot),[],[]); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,C,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CONST_m")],[" "],[gettext("Constant value generator")],[" "]],gettext("Constant Value"),list("vec",-1),exprs); + if (!ok) { + break; + } + nout = size(C); + if (find(nout==0)!=[]) { + block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter"),gettext("Constant Value")),gettext("Constant value must have at least one element.")); + } else { + model.sim = list("cstblk4_m",4); + model.opar = list(C); + if ((this.type[C-1]==1)) { + if (isreal(C)) { + ot = 1; + } else { + ot = 2; + } + } else if ((typeof(C)=="int32")) { + ot = 3; + } else if ((typeof(C)=="int16")) { + ot = 4; + } else if ((typeof(C)=="int8")) { + ot = 5; + } else if ((typeof(C)=="uint32")) { + ot = 6; + } else if ((typeof(C)=="uint16")) { + ot = 7; + } else if ((typeof(C)=="uint8")) { + ot = 8; + } else { + block_parameter_error(msprintf(gettext("Wrong type for \'%s\' parameter"),gettext("Constant Value")),gettext("Value type must be a numeric type (double, complex, int, int8, ...).")); + ok = false; + } + if (ok) { + model.rpar = []; + [model,graphics,ok] = set_io(model,graphics,list(),list(nout,ot),[],[]); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sources/CONST_m.pickle b/js/Sources/CONST_m.pickle index 0ac03d7f..54a16ece 100644 --- a/js/Sources/CONST_m.pickle +++ b/js/Sources/CONST_m.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'type' +S'x' p2 -atp3 -Rp4 +aS'type' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Sources/CURVE_c.pickle b/js/Sources/CURVE_c.pickle index 8cef5b52..b1c7cff9 100644 --- a/js/Sources/CURVE_c.pickle +++ b/js/Sources/CURVE_c.pickle @@ -12,8 +12,10 @@ aS'argn' p5 aS'xy' p6 -aS'curwin' +aS'x' p7 -atp8 -Rp9 +aS'curwin' +p8 +atp9 +Rp10 . \ No newline at end of file diff --git a/js/Sources/CURV_f.js b/js/Sources/CURV_f.js index f9f00cb5..cd6199a9 100644 --- a/js/Sources/CURV_f.js +++ b/js/Sources/CURV_f.js @@ -16,14 +16,15 @@ function CURV_f() { model.blocktype = "c"; model.dep_ut = [false,true]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } CURV_f.prototype.details = function CURV_f() { + return this.x; } CURV_f.prototype.get = function CURV_f() { } CURV_f.prototype.set = function CURV_f() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; rpar = model.rpar; @@ -33,31 +34,31 @@ function CURV_f() { yy = rpar.slice(n+1-1,2*n); gc = list(rpar.slice(2*n+1-1,2*n+4),ipar.slice(2-1,5)); while (true) { -[ln,fun]=where() - if (!or(fun=="do_eval")) { - [xx,yy,ok,gc] = edit_curv(xx,yy,"axy",[" "," "," "],gc); - } else { - ok = true; -} - if (!ok) { -break; -} - n = size(xx,"*"); - if (or(xx.slice(2-1,n)-xx.slice(1-1,n-1)<0)) { -message("You have not defined a function"); - ok = false; -} - if (ok) { - model.sim = "intplt"; - model.firing = []; - rect = gc[1-1]; - model.rpar = [[xx.slice()],[yy.slice()],[rect.slice()]]; - axisdata = gc[2-1]; - model.ipar = [[size(xx,"*")],[axisdata.slice()]]; - x.graphics = graphics; - x.model = model; -break; -} -} + [ln,fun]=where() + if (!or(fun=="do_eval")) { + [xx,yy,ok,gc] = edit_curv(xx,yy,"axy",[" "," "," "],gc); + } else { + ok = true; + } + if (!ok) { + break; + } + n = size(xx,"*"); + if (or(xx.slice(2-1,n)-xx.slice(1-1,n-1)<0)) { + message("You have not defined a function"); + ok = false; + } + if (ok) { + model.sim = "intplt"; + model.firing = []; + rect = gc[1-1]; + model.rpar = [[xx.slice()],[yy.slice()],[rect.slice()]]; + axisdata = gc[2-1]; + model.ipar = [[size(xx,"*")],[axisdata.slice()]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/CURV_f.pickle b/js/Sources/CURV_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CURV_f.pickle +++ b/js/Sources/CURV_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/Counter.js b/js/Sources/Counter.js index cfd0dccd..5e768e00 100644 --- a/js/Sources/Counter.js +++ b/js/Sources/Counter.js @@ -15,36 +15,37 @@ function Counter() { model.dep_ut = [false,false]; exprs = [[string(minim)],[string(maxim)],[string(rule)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } Counter.prototype.details = function Counter() { + return this.x; } Counter.prototype.get = function Counter() { } Counter.prototype.set = function Counter() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,minim,maxim,rule,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"Counter")],[" "],[gettext("Integer counter generator")],[" "]],[[gettext("Minimum")],[gettext("Maximum")],[gettext("Rule (1:Increment, 2:Decrement)")]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - maxim = int(maxim); - minim = int(minim); - if (maxim1) { - if (model_n.sim[2-1]>1000) { - if (model.sim[1-1]!=model_n.sim[1-1]) { - needcompile = 4; -} -} -} - } else { - modified = or(model_n!=model); - eq = model.equations; - eqn = model_n.equations; - if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { - needcompile = 4; -} -} - arg1[spath-1] = this.xxn; - newpar[size(newpar)+1-1] = path; - y = max(y,needcompile); -} -} - x = arg1; + np = size(path,"*"); + spath = list(); + for (k=1;k<=np;k+=1) { + spath[$+1-1] = "model"; + spath[$+1-1] = "rpar"; + spath[$+1-1] = "objs"; + spath[$+1-1] = path[k-1]; + } + xx = arg1[spath-1]; + execstr("xxn="+xx.gui+"(\'set\',xx)"); + if (!this.isequalbitwise[this.xxn-1][xx-1]) { + model = xx.model; + model_n = this.xxn.model; + if (!is_modelica_block(xx)) { + modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.odstate,model_n.odstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.opar,model_n.opar)||!isequal(model.label,model_n.label); + if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)||or(model.in2!=model_n.in2)||or(model.out2!=model_n.out2)||or(model.outtyp!=model_n.outtyp)||or(model.intyp!=model_n.intyp)) { + needcompile = 1; + } + if (or(model.firing!=model_n.firing)) { + needcompile = 2; + } + if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) { + needcompile = 4; + } + if (model.sim=="input"||model.sim=="output") { + if (model.ipar!=model_n.ipar) { + needcompile = 4; + } + } + if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { + needcompile = 4; + } + if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; + } + if (prod(size(model_n.sim))>1) { + if (model_n.sim[2-1]>1000) { + if (model.sim[1-1]!=model_n.sim[1-1]) { + needcompile = 4; + } + } + } + } else { + modified = or(model_n!=model); + eq = model.equations; + eqn = model_n.equations; + if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { + needcompile = 4; + } + } + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; + y = max(y,needcompile); + } + } + this.x = arg1; typ = newpar; } } diff --git a/js/Sources/FROMWSB.pickle b/js/Sources/FROMWSB.pickle index 794658bf..dd4ce05f 100644 --- a/js/Sources/FROMWSB.pickle +++ b/js/Sources/FROMWSB.pickle @@ -2,10 +2,12 @@ c__builtin__ set p0 ((lp1 -S'xxn' +S'x' p2 -aS'isequalbitwise' +aS'xxn' p3 -atp4 -Rp5 +aS'isequalbitwise' +p4 +atp5 +Rp6 . \ No newline at end of file diff --git a/js/Sources/FROMWS_c.js b/js/Sources/FROMWS_c.js index 88ce7821..1b5fa3f0 100644 --- a/js/Sources/FROMWS_c.js +++ b/js/Sources/FROMWS_c.js @@ -18,50 +18,51 @@ function FROMWS_c() { model.dep_ut = [false,true]; gr_i = []; exprs = [[string(varnam)],[string(Method)],[string(ZC)],[string(OutEnd)]]; - x = standard_define([3.5,2],model,exprs,gr_i); + this.x = standard_define([3.5,2],model,exprs,gr_i); } FROMWS_c.prototype.details = function FROMWS_c() { + return this.x; } FROMWS_c.prototype.get = function FROMWS_c() { } FROMWS_c.prototype.set = function FROMWS_c() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,varnam,Method,ZC,OutEnd,exprs] = scicos_getvalue("Set From_Workspace block parameters",[["Variable name"],["Interpolation Method"],["Enable zero crossing(0:No, 1:Yes)?"],["Output at end(0:Zero, 1:Hold, 2:Repeat)"]],list("str",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (!(Method==0||Method==1||Method==2||Method==3)) { -message("Interpolation method should be chosen in [0,1,2,3]"); - ok = false; -} - if (!(ZC==0||ZC==1)) { -message("Zero crossing should be either 0 or 1"); - ok = false; -} - if (!(OutEnd==0||OutEnd==1||OutEnd==2)) { -message("Output at end option should be either 0 or 1"); - ok = false; -} - r = false; - ierr = execstr("r=validvar(varnam)","errcatch"); - if (!r) { -message([["Invalid variable name."],["Please choose another variable name."]]); - ok = false; -} - if (ok) { - model.ipar = [[length(varnam)],[this._str2code[varnam-1]],[Method],[ZC],[OutEnd]]; - [model,graphics,ok] = set_io(model,graphics,list(),list([-1,-2],-1),1,1); - if (ok) { - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,varnam,Method,ZC,OutEnd,exprs] = scicos_getvalue("Set From_Workspace block parameters",[["Variable name"],["Interpolation Method"],["Enable zero crossing(0:No, 1:Yes)?"],["Output at end(0:Zero, 1:Hold, 2:Repeat)"]],list("str",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (!(Method==0||Method==1||Method==2||Method==3)) { + message("Interpolation method should be chosen in [0,1,2,3]"); + ok = false; + } + if (!(ZC==0||ZC==1)) { + message("Zero crossing should be either 0 or 1"); + ok = false; + } + if (!(OutEnd==0||OutEnd==1||OutEnd==2)) { + message("Output at end option should be either 0 or 1"); + ok = false; + } + r = false; + ierr = execstr("r=validvar(varnam)","errcatch"); + if (!r) { + message([["Invalid variable name."],["Please choose another variable name."]]); + ok = false; + } + if (ok) { + model.ipar = [[length(varnam)],[this._str2code[varnam-1]],[Method],[ZC],[OutEnd]]; + [model,graphics,ok] = set_io(model,graphics,list(),list([-1,-2],-1),1,1); + if (ok) { + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sources/FROMWS_c.pickle b/js/Sources/FROMWS_c.pickle index 3efc5bbe..bcacb8ca 100644 --- a/js/Sources/FROMWS_c.pickle +++ b/js/Sources/FROMWS_c.pickle @@ -4,6 +4,8 @@ p0 ((lp1 S'_str2code' p2 -atp3 -Rp4 +aS'x' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Sources/GENSIN_f.js b/js/Sources/GENSIN_f.js index bab92c8c..801a5a30 100644 --- a/js/Sources/GENSIN_f.js +++ b/js/Sources/GENSIN_f.js @@ -13,36 +13,37 @@ function GENSIN_f() { model.dep_ut = [false,true]; exprs = [[string(rpar[1-1])],[string(rpar[2-1])],[string(rpar[3-1])]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } GENSIN_f.prototype.details = function GENSIN_f() { + return this.x; } GENSIN_f.prototype.get = function GENSIN_f() { } GENSIN_f.prototype.set = function GENSIN_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,M,F,P,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"GENSIN_f")],[" "],[gettext("Sine wave generator")],[" "]],[[gettext("Magnitude")],[gettext("Frequency (rad/s)")],[gettext("Phase (rad)")]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (F<0) { -block_parameter_error(msprintf(gettext("Wrong value for \'Frequency\' parameter: %e."),F),gettext("Strictly positive integer expected.")); - ok = false; -} - if (ok) { - [model,graphics,ok] = check_io(model,graphics,[],1,[],[]); - model.rpar = [[M],[F],[P]]; - model.out2 = 1; - model.outtyp = 1; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,M,F,P,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"GENSIN_f")],[" "],[gettext("Sine wave generator")],[" "]],[[gettext("Magnitude")],[gettext("Frequency (rad/s)")],[gettext("Phase (rad)")]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (F<0) { + block_parameter_error(msprintf(gettext("Wrong value for \'Frequency\' parameter: %e."),F),gettext("Strictly positive integer expected.")); + ok = false; + } + if (ok) { + [model,graphics,ok] = check_io(model,graphics,[],1,[],[]); + model.rpar = [[M],[F],[P]]; + model.out2 = 1; + model.outtyp = 1; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/GENSIN_f.pickle b/js/Sources/GENSIN_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/GENSIN_f.pickle +++ b/js/Sources/GENSIN_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/GENSQR_f.js b/js/Sources/GENSQR_f.js index 5d7dc200..c052eba7 100644 --- a/js/Sources/GENSQR_f.js +++ b/js/Sources/GENSQR_f.js @@ -13,32 +13,33 @@ function GENSQR_f() { model.dep_ut = [false,false]; exprs = string(Amplitude); gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } GENSQR_f.prototype.details = function GENSQR_f() { + return this.x; } GENSQR_f.prototype.get = function GENSQR_f() { } GENSQR_f.prototype.set = function GENSQR_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==2) { - exprs = exprs[2-1]; -} + exprs = exprs[2-1]; + } while (true) { - [ok,Amplitude,exprs] = scicos_getvalue(["Set Square generator block parameters"],["Amplitude"],list("vec",1),exprs); - if (!ok) { -break; -} - graphics.exprs = exprs; - model.dstate = Amplitude; - model.out2 = 1; - model.outtyp = 1; - x.graphics = graphics; - x.model = model; -break; -} + [ok,Amplitude,exprs] = scicos_getvalue(["Set Square generator block parameters"],["Amplitude"],list("vec",1),exprs); + if (!ok) { + break; + } + graphics.exprs = exprs; + model.dstate = Amplitude; + model.out2 = 1; + model.outtyp = 1; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Sources/GENSQR_f.pickle b/js/Sources/GENSQR_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/GENSQR_f.pickle +++ b/js/Sources/GENSQR_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/GEN_SQR.js b/js/Sources/GEN_SQR.js index 212d5ab4..4565cb48 100644 --- a/js/Sources/GEN_SQR.js +++ b/js/Sources/GEN_SQR.js @@ -47,9 +47,10 @@ function GEN_SQR() { F = 1; exprs = [sci2exp(Amin),sci2exp(Amax),sci2exp(rule),sci2exp(F)]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } GEN_SQR.prototype.details = function GEN_SQR() { + return this.x; } GEN_SQR.prototype.get = function GEN_SQR() { } @@ -64,28 +65,28 @@ function GEN_SQR() { Bitems = [["Minimum Value"],["Maximum Value"],["Initial Value( 1= Minimum Value 2= Maximum Value)"],["Period (sec)"]]; Ss = list("mat",[-1,-1],"mat",[-1,-1],"pol",-1,"pol",-1); scicos_context = struct(); - x = arg1; + this.x = arg1; ok = false; while (!ok) { - [ok,scicos_context.Amin,scicos_context.Amax,scicos_context.rule,scicos_context.F,exprs] = scicos_getvalue(Btitre,Bitems,Ss,exprs); - if (!ok) { -return; -} - PREVAR_scicos_context = scicos_context; - sblock = x.model.rpar; - [PREVAR_scicos_context,ierr] = script2var(sblock.props.context,PREVAR_scicos_context); - if (ierr==0) { - [sblock,%w,needcompile2,ok] = do_eval(sblock,list()); - if (ok) { - y = max(2,this.needcompile,needcompile2); - x.graphics.exprs = exprs; - x.model.rpar = sblock; -break; -} - } else { -message(lasterror()); - ok = false; -} -} + [ok,scicos_context.Amin,scicos_context.Amax,scicos_context.rule,scicos_context.F,exprs] = scicos_getvalue(Btitre,Bitems,Ss,exprs); + if (!ok) { + return; + } + PREVAR_scicos_context = scicos_context; + sblock = this.x.model.rpar; + [PREVAR_scicos_context,ierr] = script2var(sblock.props.context,PREVAR_scicos_context); + if (ierr==0) { + [sblock,%w,needcompile2,ok] = do_eval(sblock,list()); + if (ok) { + y = max(2,this.needcompile,needcompile2); + this.x.graphics.exprs = exprs; + this.x.model.rpar = sblock; + break; + } + } else { + message(lasterror()); + ok = false; + } + } } } diff --git a/js/Sources/GEN_SQR.pickle b/js/Sources/GEN_SQR.pickle index 1922e519..2a35c6de 100644 --- a/js/Sources/GEN_SQR.pickle +++ b/js/Sources/GEN_SQR.pickle @@ -4,6 +4,8 @@ p0 ((lp1 S'needcompile' p2 -atp3 -Rp4 +aS'x' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Sources/Ground_g.js b/js/Sources/Ground_g.js index 2a20d38d..f70f4de8 100644 --- a/js/Sources/Ground_g.js +++ b/js/Sources/Ground_g.js @@ -15,13 +15,14 @@ function Ground_g() { model.dep_ut = [false,false]; exprs = []; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } Ground_g.prototype.details = function Ground_g() { + return this.x; } Ground_g.prototype.get = function Ground_g() { } Ground_g.prototype.set = function Ground_g() { - x = arg1; + this.x = arg1; } } diff --git a/js/Sources/Ground_g.pickle b/js/Sources/Ground_g.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/Ground_g.pickle +++ b/js/Sources/Ground_g.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/INIMPL_f.js b/js/Sources/INIMPL_f.js index f2075b5c..39a8fc91 100644 --- a/js/Sources/INIMPL_f.js +++ b/js/Sources/INIMPL_f.js @@ -15,40 +15,41 @@ function INIMPL_f() { prt = 1; exprs = "1"; gr_i = []; - x = standard_define([1,1],model,exprs,gr_i); - x.graphics.out_implicit = ["I"]; + this.x = standard_define([1,1],model,exprs,gr_i); + this.x.graphics.out_implicit = ["I"]; } INIMPL_f.prototype.details = function INIMPL_f() { + return this.x; } INIMPL_f.prototype.get = function INIMPL_f() { } INIMPL_f.prototype.set = function INIMPL_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==2) { - exprs = exprs[1-1]; -} + exprs = exprs[1-1]; + } while (true) { - [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"INIMPL_f")],[" "],[gettext("Implicit input port")],[" "]],"Port Number",list("vec",1),exprs); - if (!ok) { -break; -} - prt = int(prt); - if (prt<=0) { -block_parameter_error(msprintf(gettext("Wrong value for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); - } else { - if (model.ipar!=prt) { - needcompile = 4; - y = needcompile; -} - model.ipar = prt; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"INIMPL_f")],[" "],[gettext("Implicit input port")],[" "]],"Port Number",list("vec",1),exprs); + if (!ok) { + break; + } + prt = int(prt); + if (prt<=0) { + block_parameter_error(msprintf(gettext("Wrong value for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); + } else { + if (model.ipar!=prt) { + needcompile = 4; + y = needcompile; + } + model.ipar = prt; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/INIMPL_f.pickle b/js/Sources/INIMPL_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/INIMPL_f.pickle +++ b/js/Sources/INIMPL_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/IN_f.js b/js/Sources/IN_f.js index d5d41983..b5d4fc06 100644 --- a/js/Sources/IN_f.js +++ b/js/Sources/IN_f.js @@ -12,50 +12,51 @@ function IN_f() { model.dep_ut = [false,false]; exprs = sci2exp(prt); gr_i = []; - x = standard_define([1,1],model,exprs,gr_i); + this.x = standard_define([1,1],model,exprs,gr_i); } IN_f.prototype.details = function IN_f() { + return this.x; } IN_f.prototype.get = function IN_f() { } IN_f.prototype.set = function IN_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; if (size(exprs,"*")==2) { - exprs = exprs[1-1]; -} + exprs = exprs[1-1]; + } if (size(exprs,"*")==1) { - exprs = [[exprs[1-1]],["[-1 -2]"],["-1"]]; -} + exprs = [[exprs[1-1]],["[-1 -2]"],["-1"]]; + } while (true) { - [ok,prt,otsz,ot,exprs] = getvalue(_("Set Input block parameters"),[[_("Port number")],[_("Outport size ([-1 -2] for inherit)")],[_("Outport Type (-1 for inherit)")]],list("vec",1,"vec",-1,"vec",1),exprs); - if (!ok) { -break; -} - prt = int(prt); - if (prt<=0) { -message(_("Port number must be a positive integer")); - } else if (!isequal(size(otsz,"*"),2)) { -message(_("Outport Size must be a 2 elements vector")); - } else if (((ot<1||ot>9)&&(ot!=-1))) { -message(_("Outport type must be a number between 1 and 9, or -1 for inheritance.")); - } else { - if (model.ipar!=prt) { - needcompile = 4; - y = needcompile; -} - model.ipar = prt; - model.firing = []; - model.out = otsz[1-1]; - model.out2 = otsz[2-1]; - model.outtyp = ot; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,prt,otsz,ot,exprs] = getvalue(_("Set Input block parameters"),[[_("Port number")],[_("Outport size ([-1 -2] for inherit)")],[_("Outport Type (-1 for inherit)")]],list("vec",1,"vec",-1,"vec",1),exprs); + if (!ok) { + break; + } + prt = int(prt); + if (prt<=0) { + message(_("Port number must be a positive integer")); + } else if (!isequal(size(otsz,"*"),2)) { + message(_("Outport Size must be a 2 elements vector")); + } else if (((ot<1||ot>9)&&(ot!=-1))) { + message(_("Outport type must be a number between 1 and 9, or -1 for inheritance.")); + } else { + if (model.ipar!=prt) { + needcompile = 4; + y = needcompile; + } + model.ipar = prt; + model.firing = []; + model.out = otsz[1-1]; + model.out2 = otsz[2-1]; + model.outtyp = ot; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/IN_f.pickle b/js/Sources/IN_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/IN_f.pickle +++ b/js/Sources/IN_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/Modulo_Count.js b/js/Sources/Modulo_Count.js index 03482970..c10e7f51 100644 --- a/js/Sources/Modulo_Count.js +++ b/js/Sources/Modulo_Count.js @@ -13,36 +13,37 @@ function Modulo_Count() { model.dep_ut = [false,false]; exprs = [[string(ini_c)],[string(base)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } Modulo_Count.prototype.details = function Modulo_Count() { + return this.x; } Modulo_Count.prototype.get = function Modulo_Count() { } Modulo_Count.prototype.set = function Modulo_Count() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,ini_c,base,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"Modulo_Count")],[" "],[gettext("Modulo counter (0 to N counter)")],[" "]],[[gettext("Initial State (zero or positive number)")],[gettext("Upper Limit (positive number)")]],list("vec",1,"vec",1),exprs); - ini_c = int(ini_c); - base = int(base); - if (!ok) { -break; -} - if (ini_c<0) { -block_parameter_error(msprintf(gettext("Wrong value for \'Initial State\' parameter: %d."),ini_c),gettext("Null or positive integer expected.")); - } else if (base<=0) { -block_parameter_error(msprintf(gettext("Wrong values for \'Upper Limit\' parameter: %d."),base),gettext("Strictly positive integer expected.")); - } else { - graphics.exprs = exprs; - model.ipar = base; - model.dstate = ini_c; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,ini_c,base,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"Modulo_Count")],[" "],[gettext("Modulo counter (0 to N counter)")],[" "]],[[gettext("Initial State (zero or positive number)")],[gettext("Upper Limit (positive number)")]],list("vec",1,"vec",1),exprs); + ini_c = int(ini_c); + base = int(base); + if (!ok) { + break; + } + if (ini_c<0) { + block_parameter_error(msprintf(gettext("Wrong value for \'Initial State\' parameter: %d."),ini_c),gettext("Null or positive integer expected.")); + } else if (base<=0) { + block_parameter_error(msprintf(gettext("Wrong values for \'Upper Limit\' parameter: %d."),base),gettext("Strictly positive integer expected.")); + } else { + graphics.exprs = exprs; + model.ipar = base; + model.dstate = ini_c; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/Modulo_Count.pickle b/js/Sources/Modulo_Count.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/Modulo_Count.pickle +++ b/js/Sources/Modulo_Count.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/PULSE_SC.js b/js/Sources/PULSE_SC.js index 00dd65d2..51ca49a5 100644 --- a/js/Sources/PULSE_SC.js +++ b/js/Sources/PULSE_SC.js @@ -42,9 +42,10 @@ function PULSE_SC() { A = 1; exprs = [sci2exp(E),sci2exp(W),sci2exp(F),sci2exp(A)]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } PULSE_SC.prototype.details = function PULSE_SC() { + return this.x; } PULSE_SC.prototype.get = function PULSE_SC() { } @@ -59,30 +60,30 @@ function PULSE_SC() { Bitems = [["Phase delay (secs):"],["Pulse Width (% of period):"],["Period (secs):"],["Amplitude:"]]; Ss = list("pol",-1,"pol",-1,"pol",-1,"mat",[-1,-1]); scicos_context = struct(); - x = arg1; + this.x = arg1; ok = false; while (!ok) { - [ok,scicos_context.E,scicos_context.W,scicos_context.F,scicos_context.A,exprs] = scicos_getvalue(Btitre,Bitems,Ss,exprs); - if (!ok) { -return; -} - PREVAR_scicos_context = scicos_context; - sblock = x.model.rpar; - [PREVAR_scicos_context,ierr] = script2var(sblock.props.context,PREVAR_scicos_context); - if (ierr==0) { - [sblock,%w,needcompile2,ok] = do_eval(sblock,list()); - if (ok) { - y = max(2,this.needcompile,needcompile2); - x.graphics.exprs = exprs; - x.model.rpar = sblock; -break; -} - } else { - if ((lasterror()!=[])) { -messagebox(lasterror()); -} - ok = false; -} -} + [ok,scicos_context.E,scicos_context.W,scicos_context.F,scicos_context.A,exprs] = scicos_getvalue(Btitre,Bitems,Ss,exprs); + if (!ok) { + return; + } + PREVAR_scicos_context = scicos_context; + sblock = this.x.model.rpar; + [PREVAR_scicos_context,ierr] = script2var(sblock.props.context,PREVAR_scicos_context); + if (ierr==0) { + [sblock,%w,needcompile2,ok] = do_eval(sblock,list()); + if (ok) { + y = max(2,this.needcompile,needcompile2); + this.x.graphics.exprs = exprs; + this.x.model.rpar = sblock; + break; + } + } else { + if ((lasterror()!=[])) { + messagebox(lasterror()); + } + ok = false; + } + } } } diff --git a/js/Sources/PULSE_SC.pickle b/js/Sources/PULSE_SC.pickle index 1922e519..2a35c6de 100644 --- a/js/Sources/PULSE_SC.pickle +++ b/js/Sources/PULSE_SC.pickle @@ -4,6 +4,8 @@ p0 ((lp1 S'needcompile' p2 -atp3 -Rp4 +aS'x' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Sources/RAMP.js b/js/Sources/RAMP.js index add6822e..7453d2d0 100644 --- a/js/Sources/RAMP.js +++ b/js/Sources/RAMP.js @@ -16,31 +16,32 @@ function RAMP() { model.dep_ut = [false,true]; exprs = [string(rpar)]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } RAMP.prototype.details = function RAMP() { + return this.x; } RAMP.prototype.get = function RAMP() { } RAMP.prototype.set = function RAMP() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,slope,stt,iout,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"RAMP")],[" "],[gettext("Ramp function")],[" "]],[[gettext("Slope")],[gettext("Start Time")],[gettext("Initial Value")]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (stt<0) { -block_parameter_error(msprintf(gettext("Wrong value for \'Start Time\' parameter: %e."),stt),gettext("Null or positive integer expected.")); - } else { - model.rpar = [[slope],[stt],[iout]]; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,slope,stt,iout,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"RAMP")],[" "],[gettext("Ramp function")],[" "]],[[gettext("Slope")],[gettext("Start Time")],[gettext("Initial Value")]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (stt<0) { + block_parameter_error(msprintf(gettext("Wrong value for \'Start Time\' parameter: %e."),stt),gettext("Null or positive integer expected.")); + } else { + model.rpar = [[slope],[stt],[iout]]; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/RAMP.pickle b/js/Sources/RAMP.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/RAMP.pickle +++ b/js/Sources/RAMP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/RAND_f.js b/js/Sources/RAND_f.js index 1302b020..901c2e9d 100644 --- a/js/Sources/RAND_f.js +++ b/js/Sources/RAND_f.js @@ -17,41 +17,42 @@ function RAND_f() { model.dep_ut = [false,false]; exprs = [[string(flag)],[sci2exp(a.slice())],[sci2exp(b.slice())],[string(model.dstate[1-1])]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } RAND_f.prototype.details = function RAND_f() { + return this.x; } RAND_f.prototype.get = function RAND_f() { } RAND_f.prototype.set = function RAND_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==5) { - exprs = exprs.slice(1-1,3); -} + exprs = exprs.slice(1-1,3); + } if (size(exprs,"*")==3) { - exprs = [[exprs],[string(model.dstate[1-1])]]; -} + exprs = [[exprs],[string(model.dstate[1-1])]]; + } while (true) { - [ok,flag,a,b,seed_c,exprs] = scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be vector with equal sizes"],["seed is the seed of random number generator (integer<2**31)"]],[["flag"],["A"],["B"],["seed"]],list("vec",1,"vec",-1,"vec","size(%2,\'*\')","vec",1),exprs); - if (!ok) { -break; -} - if (flag!=0&&flag!=1) { -message("flag must be equal to 1 or 0"); - } else { - nout = size(a,"*"); - graphics.exprs = exprs; - model.out = nout; - model.ipar = flag; - model.rpar = [[a.slice()],[b.slice()]]; - model.dstate = [[seed_c],[0*a.slice()]]; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,flag,a,b,seed_c,exprs] = scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be vector with equal sizes"],["seed is the seed of random number generator (integer<2**31)"]],[["flag"],["A"],["B"],["seed"]],list("vec",1,"vec",-1,"vec","size(%2,\'*\')","vec",1),exprs); + if (!ok) { + break; + } + if (flag!=0&&flag!=1) { + message("flag must be equal to 1 or 0"); + } else { + nout = size(a,"*"); + graphics.exprs = exprs; + model.out = nout; + model.ipar = flag; + model.rpar = [[a.slice()],[b.slice()]]; + model.dstate = [[seed_c],[0*a.slice()]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/RAND_f.pickle b/js/Sources/RAND_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/RAND_f.pickle +++ b/js/Sources/RAND_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/RAND_m.js b/js/Sources/RAND_m.js index ab7e919f..5c6a35fd 100644 --- a/js/Sources/RAND_m.js +++ b/js/Sources/RAND_m.js @@ -26,55 +26,56 @@ function RAND_m() { model.dep_ut = [false,false]; exprs = [[sci2exp(1)],[string(flag)],[sci2exp([a])],[sci2exp([b])],[sci2exp([model.dstate[1-1],int(rand()*(10^7-1))])]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } RAND_m.prototype.details = function RAND_m() { + return this.x; } RAND_m.prototype.get = function RAND_m() { } RAND_m.prototype.set = function RAND_m() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==14) { - exprs[9-1] = []; -} + exprs[9-1] = []; + } while (true) { - [ok,typ,flag,a,b,seed_c,exprs] = scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be matrix with equal sizes"]],[["Datatype(1=real double 2=complex)"],["flag"],["A"],["B"],["SEED"]],list("vec",1,"vec",1,"mat",[-1,-2],"mat","[-1 -2]","mat",[1,2]),exprs); - if (!ok) { -break; -} - if (flag!=0&&flag!=1) { -message("flag must be equal to 1 or 0"); - } else { - out = size(a); - if (typ==1) { - function_name = "rndblk_m"; - model.rpar = [[real(a.slice())],[real(b.slice())]]; - model.dstate = [[seed_c[1-1]],[0*real(a.slice())]]; - ot = 1; - } else if (typ==2) { - function_name = "rndblkz_m"; - ot = 2; - model.rpar = [[real(a.slice())],[imag(a.slice())],[real(b.slice())],[imag(b.slice())]]; - model.dstate = [[seed_c.slice()],[0*[[real(a.slice())],[imag(a.slice())]]]]; - } else { -message("Datatype is not supported"); - ok = false; -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list([],[]),list(out,ot),1,[]); - if (ok) { - model.sim = list(function_name,4); - graphics.exprs = exprs; - model.ipar = flag; - x.graphics = graphics; - x.model = model; -break; -} -} -} -} + [ok,typ,flag,a,b,seed_c,exprs] = scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be matrix with equal sizes"]],[["Datatype(1=real double 2=complex)"],["flag"],["A"],["B"],["SEED"]],list("vec",1,"vec",1,"mat",[-1,-2],"mat","[-1 -2]","mat",[1,2]),exprs); + if (!ok) { + break; + } + if (flag!=0&&flag!=1) { + message("flag must be equal to 1 or 0"); + } else { + out = size(a); + if (typ==1) { + function_name = "rndblk_m"; + model.rpar = [[real(a.slice())],[real(b.slice())]]; + model.dstate = [[seed_c[1-1]],[0*real(a.slice())]]; + ot = 1; + } else if (typ==2) { + function_name = "rndblkz_m"; + ot = 2; + model.rpar = [[real(a.slice())],[imag(a.slice())],[real(b.slice())],[imag(b.slice())]]; + model.dstate = [[seed_c.slice()],[0*[[real(a.slice())],[imag(a.slice())]]]]; + } else { + message("Datatype is not supported"); + ok = false; + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([],[]),list(out,ot),1,[]); + if (ok) { + model.sim = list(function_name,4); + graphics.exprs = exprs; + model.ipar = flag; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } + } } } diff --git a/js/Sources/RAND_m.pickle b/js/Sources/RAND_m.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/RAND_m.pickle +++ b/js/Sources/RAND_m.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/READAU_f.js b/js/Sources/READAU_f.js index 5ff6df01..009a3b0e 100644 --- a/js/Sources/READAU_f.js +++ b/js/Sources/READAU_f.js @@ -22,14 +22,15 @@ function READAU_f() { model.dep_ut = [false,false]; exprs = [[fname],[string(N)],[string(swap)]]; gr_i = []; - x = standard_define([5,2],model,exprs,gr_i); + this.x = standard_define([5,2],model,exprs,gr_i); } READAU_f.prototype.details = function READAU_f() { + return this.x; } READAU_f.prototype.get = function READAU_f() { } READAU_f.prototype.set = function READAU_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -41,43 +42,43 @@ function READAU_f() { lunit = dstate[3-1]; fname = exprs[1-1]; while (true) { - [ok,fname1,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"READAU_f")],[" "],[gettext("(Read Audio File)")],[" "],[gettext("Read is done on a binary \'.au\' file")]],[[gettext("Input File Name")],[gettext("Buffer size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("str",1,"vec",1,"vec",1),exprs); - tmask1 = []; - outmask = 1; - frmt1 = "uc"; - M = 1; - offset = 1; - if (!ok) { -break; -} - fname1 = stripblanks(fname1); - frmt1 = stripblanks(frmt1); - if (this.alreadyran&&fname1!=fname) { -block_parameter_error(gettext("Simulation running !!! You cannot modify Input file name"),gettext("End current simulation first.")); - } else if (fname1=="") { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Input File Name")),gettext("You must provide a filename.")); - } else if (N<1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer size"),N),msprintf(gettext("Must be greater than %d."),1)); - } else if (this.alreadyran&&(N!=ipar[6-1])) { -block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Buffer Size")),gettext("End current simulation first.")); - } else if (swap!=0&&swap!=1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Swap Mode"),swap),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); - } else { - [model,graphics,ok] = check_io(model,graphics,[],1,1,[]); - frmt1 = part(frmt1,1,3); - if (ok) { - ipar = [[length(fname1)],[this._str2code[frmt1-1]],[0],[N],[M],[swap],[offset,this._str2code[fname1-1]],[tmask1,outmask.slice()]]; - if (prod(size(dstate))!=(N*M)+3) { - dstate = [[-1],[-1],[lunit],[zeros(N*M,1)]]; -} - model.dstate = dstate; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,fname1,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"READAU_f")],[" "],[gettext("(Read Audio File)")],[" "],[gettext("Read is done on a binary \'.au\' file")]],[[gettext("Input File Name")],[gettext("Buffer size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("str",1,"vec",1,"vec",1),exprs); + tmask1 = []; + outmask = 1; + frmt1 = "uc"; + M = 1; + offset = 1; + if (!ok) { + break; + } + fname1 = stripblanks(fname1); + frmt1 = stripblanks(frmt1); + if (this.alreadyran&&fname1!=fname) { + block_parameter_error(gettext("Simulation running !!! You cannot modify Input file name"),gettext("End current simulation first.")); + } else if (fname1=="") { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Input File Name")),gettext("You must provide a filename.")); + } else if (N<1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer size"),N),msprintf(gettext("Must be greater than %d."),1)); + } else if (this.alreadyran&&(N!=ipar[6-1])) { + block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Buffer Size")),gettext("End current simulation first.")); + } else if (swap!=0&&swap!=1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Swap Mode"),swap),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); + } else { + [model,graphics,ok] = check_io(model,graphics,[],1,1,[]); + frmt1 = part(frmt1,1,3); + if (ok) { + ipar = [[length(fname1)],[this._str2code[frmt1-1]],[0],[N],[M],[swap],[offset,this._str2code[fname1-1]],[tmask1,outmask.slice()]]; + if (prod(size(dstate))!=(N*M)+3) { + dstate = [[-1],[-1],[lunit],[zeros(N*M,1)]]; + } + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sources/READAU_f.pickle b/js/Sources/READAU_f.pickle index 62a7fafc..8a32035f 100644 --- a/js/Sources/READAU_f.pickle +++ b/js/Sources/READAU_f.pickle @@ -4,8 +4,10 @@ p0 ((lp1 S'_str2code' p2 -aS'alreadyran' +aS'x' p3 -atp4 -Rp5 +aS'alreadyran' +p4 +atp5 +Rp6 . \ No newline at end of file diff --git a/js/Sources/READC_f.js b/js/Sources/READC_f.js index e97e0eb7..7e6bc5e1 100644 --- a/js/Sources/READC_f.js +++ b/js/Sources/READC_f.js @@ -26,15 +26,16 @@ function READC_f() { model.dep_ut = [false,false]; exprs = [["[]"],[sci2exp(outmask)],[fname],[frmt],[string(M)],[string(N)],[string(offset)],[string(swap)]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } READC_f.prototype.details = function READC_f() { + return this.x; } READC_f.prototype.get = function READC_f() { } READC_f.prototype.set = function READC_f() { - x = arg1; - model = x.model; + this.x = arg1; + model = this.x.model; graphics = arg1.graphics; exprs = graphics.exprs; out = model.out; @@ -46,72 +47,72 @@ function READC_f() { fname = exprs[3-1]; frmt = exprs[4-1]; while (true) { - [ok,tmask1,outmask,fname1,frmt1,M,N,offset,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"READC_f")],[" "],[gettext("Read from C binary file")]],[[gettext("Time Record Selection")],[gettext("Outputs Record Selection")],[gettext("Input File Name")],[gettext("Input Format")],[gettext("Record Size")],[gettext("Buffer Size")],[gettext("Initial Record Index")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",-1,"vec",-1,"str",1,"str",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - fname1 = pathconvert(stripblanks(fname1),false,true); - frmt1 = stripblanks(frmt1); - fmts = ["s","l","d","f","c","us","ul","uc","ull","uls","ubl","ubs","dl","fl","ll","sl","db","fb","lb","sb"]; - nout = size(outmask,"*"); - if (prod(size(tmask1))>1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Time Record Selection")),gettext("Must be a scalar or an empty matrix.")); - } else if (and(frmt1!=fmts)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("Valid formats are: "+strcat(fmts,", "))); - } else if (this.alreadyran&&fname1!=fname) { -block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running"),gettext("Input File Name")),gettext("End current simulation first.")); - } else if (N!=ipar[6-1]&&this.alreadyran) { -block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Buffer Size")),gettext("End current simulation first")); - } else if (this.alreadyran&&size(tmask1)!=size(tmask)) { -block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Time Record Selection")),gettext("End current simulation first.")); - } else if (fname1=="") { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Input File Name")),gettext("You must provide a file name.")); - } else if (M<1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Record Size"),M),gettext("Strictly positive integer expected.")); - } else if (tmask1!=[]&&(tmask1<1||tmask1>M)) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Time Record Selection"),tmask1),msprintf(gettext("Must be in the interval %s."),gettext("[1, Record Size = ")+string(M)+"]")); - } else if (nout==0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Outputs Record Selection"),nout),gettext("Strictly positive integer expected.")); - } else if (nout>M) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Outputs Record Selection"),nout),msprintf(gettext("Must be in the interval %s."),gettext("[1, Record Size = ")+string(M)+"]")); - } else if (max(outmask)>M||min(outmask)<1) { -block_parameter_error(msprintf(gettext("Wrong value for indexes in \'%s\' parameter: %s."),gettext("Outputs Record Selection"),strcat(string(outmask.slice())," ")),msprintf(gettext("Must be in the interval %s."),gettext("[1, Record Size = ")+string(M)+"]")); - } else if (N<1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected.")); - } else if (swap!=0&&swap!=1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Swap Mode"),swap),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); - } else if (offset<1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Initial Record Index"),offset),gettext("Strictly positive integer expected.")); - } else { - if (tmask1==[]) { - ievt = 0; - tmask1 = 0; - outpt = []; - } else { - ievt = 1; - outpt = 1; -} - out = size(outmask,"*"); - [model,graphics,ok] = check_io(model,graphics,[],out,1,outpt); - frmt1 = part(frmt1,1,3); - if (ok) { - if (ievt==0) { - model.firing = -1; - } else { - model.firing = 0; -} - ipar = [[length(fname1)],[this._str2code[frmt1-1]],[ievt],[N],[M],[swap],[offset],[this._str2code[fname1-1]],[tmask1],[outmask.slice()]]; - if (prod(size(dstate))!=(N*M)+3) { - dstate = [[-1],[-1],[lunit],[zeros(N*M,1)]]; -} - model.dstate = dstate; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,tmask1,outmask,fname1,frmt1,M,N,offset,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"READC_f")],[" "],[gettext("Read from C binary file")]],[[gettext("Time Record Selection")],[gettext("Outputs Record Selection")],[gettext("Input File Name")],[gettext("Input Format")],[gettext("Record Size")],[gettext("Buffer Size")],[gettext("Initial Record Index")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",-1,"vec",-1,"str",1,"str",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + fname1 = pathconvert(stripblanks(fname1),false,true); + frmt1 = stripblanks(frmt1); + fmts = ["s","l","d","f","c","us","ul","uc","ull","uls","ubl","ubs","dl","fl","ll","sl","db","fb","lb","sb"]; + nout = size(outmask,"*"); + if (prod(size(tmask1))>1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Time Record Selection")),gettext("Must be a scalar or an empty matrix.")); + } else if (and(frmt1!=fmts)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("Valid formats are: "+strcat(fmts,", "))); + } else if (this.alreadyran&&fname1!=fname) { + block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running"),gettext("Input File Name")),gettext("End current simulation first.")); + } else if (N!=ipar[6-1]&&this.alreadyran) { + block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Buffer Size")),gettext("End current simulation first")); + } else if (this.alreadyran&&size(tmask1)!=size(tmask)) { + block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Time Record Selection")),gettext("End current simulation first.")); + } else if (fname1=="") { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Input File Name")),gettext("You must provide a file name.")); + } else if (M<1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Record Size"),M),gettext("Strictly positive integer expected.")); + } else if (tmask1!=[]&&(tmask1<1||tmask1>M)) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Time Record Selection"),tmask1),msprintf(gettext("Must be in the interval %s."),gettext("[1, Record Size = ")+string(M)+"]")); + } else if (nout==0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Outputs Record Selection"),nout),gettext("Strictly positive integer expected.")); + } else if (nout>M) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Outputs Record Selection"),nout),msprintf(gettext("Must be in the interval %s."),gettext("[1, Record Size = ")+string(M)+"]")); + } else if (max(outmask)>M||min(outmask)<1) { + block_parameter_error(msprintf(gettext("Wrong value for indexes in \'%s\' parameter: %s."),gettext("Outputs Record Selection"),strcat(string(outmask.slice())," ")),msprintf(gettext("Must be in the interval %s."),gettext("[1, Record Size = ")+string(M)+"]")); + } else if (N<1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected.")); + } else if (swap!=0&&swap!=1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Swap Mode"),swap),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); + } else if (offset<1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Initial Record Index"),offset),gettext("Strictly positive integer expected.")); + } else { + if (tmask1==[]) { + ievt = 0; + tmask1 = 0; + outpt = []; + } else { + ievt = 1; + outpt = 1; + } + out = size(outmask,"*"); + [model,graphics,ok] = check_io(model,graphics,[],out,1,outpt); + frmt1 = part(frmt1,1,3); + if (ok) { + if (ievt==0) { + model.firing = -1; + } else { + model.firing = 0; + } + ipar = [[length(fname1)],[this._str2code[frmt1-1]],[ievt],[N],[M],[swap],[offset],[this._str2code[fname1-1]],[tmask1],[outmask.slice()]]; + if (prod(size(dstate))!=(N*M)+3) { + dstate = [[-1],[-1],[lunit],[zeros(N*M,1)]]; + } + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sources/READC_f.pickle b/js/Sources/READC_f.pickle index 62a7fafc..8a32035f 100644 --- a/js/Sources/READC_f.pickle +++ b/js/Sources/READC_f.pickle @@ -4,8 +4,10 @@ p0 ((lp1 S'_str2code' p2 -aS'alreadyran' +aS'x' p3 -atp4 -Rp5 +aS'alreadyran' +p4 +atp5 +Rp6 . \ No newline at end of file diff --git a/js/Sources/RFILE_f.js b/js/Sources/RFILE_f.js index 7c4335b3..3038948d 100644 --- a/js/Sources/RFILE_f.js +++ b/js/Sources/RFILE_f.js @@ -22,14 +22,15 @@ function RFILE_f() { model.dep_ut = [false,false]; exprs = [[sci2exp([])],[sci2exp(outmask)],[fname],[frmt],[string(N)],[sci2exp(out)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } RFILE_f.prototype.details = function RFILE_f() { + return this.x; } RFILE_f.prototype.get = function RFILE_f() { } RFILE_f.prototype.set = function RFILE_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -43,64 +44,64 @@ function RFILE_f() { fname = exprs[3-1]; frmt = exprs[4-1]; if (size(exprs,"*")>5) { - exprs[6-1] = []; -} + exprs[6-1] = []; + } while (true) { - [ok,tmask1,outmask,fname1,frmt1,N,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"RFILE_f")],[" "],[gettext("Read from an input file")],[" "],[gettext("Read is done on:")],[gettext("  - A binary file if no format given")],[gettext("  - A formatted text file if a format (fortran type) is given")]],[[gettext("Time Record Selection")],[gettext("Outputs Record Selection")],[gettext("Input File Name")],[gettext("Input Format")],[gettext("Buffer Size")]],list("vec",-1,"vec",-1,"str",1,"str",1,"vec",1),exprs); - if (!ok) { -break; -} - fname1 = pathconvert(stripblanks(fname1),false,true); - frmt1 = stripblanks(frmt1); - nout = size(outmask,"*"); - if (prod(size(tmask1))>1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Time Record Selection"),strcat(string(tmask1.slice())," ")),gettext("Empty matrix or scalar expected.")); - } else if (tmask1!=[]&&tmask1<1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d"),gettext("Time Record Selection"),tmask1),gettext("Strictly positive integer expected.")); - } else if (lunit>0&&min(length(frmt),1)!=min(length(frmt1),1)) { -block_parameter_error([gettext("Simulation running !!! You cannot switch
between formatted and unformatted")],gettext("End current simulation first.")); - } else if (lunit>0&&fname1!=fname) { -block_parameter_error(gettext("Simulation running !!! You cannot modify \'Input File Name\'"),gettext("End current simulation first.")); - } else if (lunit>0&&size(tmask1)!=size(tmask)) { -block_parameter_error(gettext("Simulation running !!! You cannot modify \'Time Record Selection\'"),gettext("End current simulation first.")); - } else if (fname1=="") { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s"),gettext("Input File Name"),fname1),gettext("You must provide a filename.")); - } else if (frmt1!=""&&(part(frmt1,1)!="("||part(frmt1,length(frmt1))!=")")) { -block_parameter_error(msprintf(gettext("Wrong format for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("You must enclose the format\'s string between parentheses.")); - } else if (N<2) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Buffer size must be at least 2.")); - } else if (nout==0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Outputs Record Selection"),nout),gettext("You must read at least one field in record.")); - } else if (min(outmask)<1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s"),gettext("Outputs Record Selection"),strcat(string(outmask.slice())," ")),gettext("Strictly positive indexes expected.")); - } else { - if (tmask1==[]) { - ievt = 0; - cout = []; - tmask1 = 0; - } else { - ievt = 1; - cout = 1; -} - [model,graphics,ok] = check_io(model,graphics,[],nout,1,cout); - if (ok) { - if (ievt==0) { - model.firing = []; - } else { - model.firing = 0; -} - ipar = [[length(fname1)],[length(frmt1)],[ievt],[N],[this._str2code[fname1-1]],[this._str2code[frmt1-1]],[tmask1],[outmask.slice()]]; - if (prod(size(dstate))!=(nout+ievt)*N+3) { - dstate = [[-1],[-1],[lunit],[zeros((nout+ievt)*N,1)]]; -} - model.dstate = dstate; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,tmask1,outmask,fname1,frmt1,N,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"RFILE_f")],[" "],[gettext("Read from an input file")],[" "],[gettext("Read is done on:")],[gettext("  - A binary file if no format given")],[gettext("  - A formatted text file if a format (fortran type) is given")]],[[gettext("Time Record Selection")],[gettext("Outputs Record Selection")],[gettext("Input File Name")],[gettext("Input Format")],[gettext("Buffer Size")]],list("vec",-1,"vec",-1,"str",1,"str",1,"vec",1),exprs); + if (!ok) { + break; + } + fname1 = pathconvert(stripblanks(fname1),false,true); + frmt1 = stripblanks(frmt1); + nout = size(outmask,"*"); + if (prod(size(tmask1))>1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Time Record Selection"),strcat(string(tmask1.slice())," ")),gettext("Empty matrix or scalar expected.")); + } else if (tmask1!=[]&&tmask1<1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d"),gettext("Time Record Selection"),tmask1),gettext("Strictly positive integer expected.")); + } else if (lunit>0&&min(length(frmt),1)!=min(length(frmt1),1)) { + block_parameter_error([gettext("Simulation running !!! You cannot switch
between formatted and unformatted")],gettext("End current simulation first.")); + } else if (lunit>0&&fname1!=fname) { + block_parameter_error(gettext("Simulation running !!! You cannot modify \'Input File Name\'"),gettext("End current simulation first.")); + } else if (lunit>0&&size(tmask1)!=size(tmask)) { + block_parameter_error(gettext("Simulation running !!! You cannot modify \'Time Record Selection\'"),gettext("End current simulation first.")); + } else if (fname1=="") { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s"),gettext("Input File Name"),fname1),gettext("You must provide a filename.")); + } else if (frmt1!=""&&(part(frmt1,1)!="("||part(frmt1,length(frmt1))!=")")) { + block_parameter_error(msprintf(gettext("Wrong format for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("You must enclose the format\'s string between parentheses.")); + } else if (N<2) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Buffer size must be at least 2.")); + } else if (nout==0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Outputs Record Selection"),nout),gettext("You must read at least one field in record.")); + } else if (min(outmask)<1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s"),gettext("Outputs Record Selection"),strcat(string(outmask.slice())," ")),gettext("Strictly positive indexes expected.")); + } else { + if (tmask1==[]) { + ievt = 0; + cout = []; + tmask1 = 0; + } else { + ievt = 1; + cout = 1; + } + [model,graphics,ok] = check_io(model,graphics,[],nout,1,cout); + if (ok) { + if (ievt==0) { + model.firing = []; + } else { + model.firing = 0; + } + ipar = [[length(fname1)],[length(frmt1)],[ievt],[N],[this._str2code[fname1-1]],[this._str2code[frmt1-1]],[tmask1],[outmask.slice()]]; + if (prod(size(dstate))!=(nout+ievt)*N+3) { + dstate = [[-1],[-1],[lunit],[zeros((nout+ievt)*N,1)]]; + } + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sources/RFILE_f.pickle b/js/Sources/RFILE_f.pickle index 3efc5bbe..bcacb8ca 100644 --- a/js/Sources/RFILE_f.pickle +++ b/js/Sources/RFILE_f.pickle @@ -4,6 +4,8 @@ p0 ((lp1 S'_str2code' p2 -atp3 -Rp4 +aS'x' +p3 +atp4 +Rp5 . \ No newline at end of file diff --git a/js/Sources/SAWTOOTH_f.js b/js/Sources/SAWTOOTH_f.js index 27b5b214..40ab391a 100644 --- a/js/Sources/SAWTOOTH_f.js +++ b/js/Sources/SAWTOOTH_f.js @@ -10,13 +10,14 @@ function SAWTOOTH_f() { model.dep_ut = [false,true]; exprs = " "; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } SAWTOOTH_f.prototype.details = function SAWTOOTH_f() { + return this.x; } SAWTOOTH_f.prototype.get = function SAWTOOTH_f() { } SAWTOOTH_f.prototype.set = function SAWTOOTH_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Sources/SAWTOOTH_f.pickle b/js/Sources/SAWTOOTH_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/SAWTOOTH_f.pickle +++ b/js/Sources/SAWTOOTH_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/STEP.js b/js/Sources/STEP.js index 14f1f03f..e2f455e6 100644 --- a/js/Sources/STEP.js +++ b/js/Sources/STEP.js @@ -15,52 +15,53 @@ function STEP() { model.dep_ut = [false,false]; exprs = [[string(1)],[string(rpar)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } STEP.prototype.details = function STEP() { + return this.x; } STEP.prototype.get = function STEP() { } STEP.prototype.set = function STEP() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,temps,in1,fi,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"STEP_FUNCTION")],[" "],[gettext("Step Function")],[" "]],[[gettext("Step Time")],[gettext("Initial Value")],[gettext("Final Value")]],list("vec",1,"vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - in1 = in1.slice(); - fi = fi.slice(); - if (size(in1,"*")!=size(fi,"*")) { - if (size(in1,"*")==1) { - in1 = in1*ones(fi); - } else if (size(fi,"*")==1) { - fi = fi*ones(in1); - } else { -block_parameter_error(msprintf(gettext("\'Initial Value\' and \'Final Value\': incompatible sizes: %d and %d."),size(in1,"*"),size(fi,"*")),gettext("Same sizes expected.")); - ok = false; -} -} - if (ok) { - model.out2 = 1; - model.outtyp = 1; - [model,graphics,ok] = check_io(model,graphics,[],size(fi,"*"),1,1); -} - if (ok) { - model.firing = temps; - if (temps==0) { - rpar = [[fi],[fi]]; - } else { - rpar = [[in1],[fi]]; -} - model.rpar = rpar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,temps,in1,fi,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"STEP_FUNCTION")],[" "],[gettext("Step Function")],[" "]],[[gettext("Step Time")],[gettext("Initial Value")],[gettext("Final Value")]],list("vec",1,"vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + in1 = in1.slice(); + fi = fi.slice(); + if (size(in1,"*")!=size(fi,"*")) { + if (size(in1,"*")==1) { + in1 = in1*ones(fi); + } else if (size(fi,"*")==1) { + fi = fi*ones(in1); + } else { + block_parameter_error(msprintf(gettext("\'Initial Value\' and \'Final Value\': incompatible sizes: %d and %d."),size(in1,"*"),size(fi,"*")),gettext("Same sizes expected.")); + ok = false; + } + } + if (ok) { + model.out2 = 1; + model.outtyp = 1; + [model,graphics,ok] = check_io(model,graphics,[],size(fi,"*"),1,1); + } + if (ok) { + model.firing = temps; + if (temps==0) { + rpar = [[fi],[fi]]; + } else { + rpar = [[in1],[fi]]; + } + model.rpar = rpar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/STEP.pickle b/js/Sources/STEP.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/STEP.pickle +++ b/js/Sources/STEP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/STEP_FUNCTION.js b/js/Sources/STEP_FUNCTION.js index f1aee187..9b2fe9f8 100644 --- a/js/Sources/STEP_FUNCTION.js +++ b/js/Sources/STEP_FUNCTION.js @@ -39,8 +39,8 @@ function STEP_FUNCTION() { lnk.from = [1,1,0]; lnk.to = [1,1,1]; scs_m_1.objs[4-1] = lnk; -blk={}; -lnk={}; + blk={}; + lnk={}; model = scicos_model(); model.sim = "csuper"; model.out = 1; @@ -48,74 +48,75 @@ lnk={}; model.outtyp = 1; model.rpar = scs_m_1; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } STEP_FUNCTION.prototype.details = function STEP_FUNCTION() { + return this.x; } STEP_FUNCTION.prototype.get = function STEP_FUNCTION() { } STEP_FUNCTION.prototype.set = function STEP_FUNCTION() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="STEP") { - ppath = list(i); -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="STEP") { + ppath = list(i); + break; + } + } newpar = list(); for (path in ppath) { - np = size(path,"*"); - spath = list(); -for (k=1;k<=np;k+=1) { - spath[$+1-1] = "model"; - spath[$+1-1] = "rpar"; - spath[$+1-1] = "objs"; - spath[$+1-1] = path[k-1]; -} - xx = arg1[spath-1]; -execstr("xxn="+xx.gui+"(\'set\',xx)"); - if (diffobjs(this.xxn,xx)) { - model = xx.model; - model_n = this.xxn.model; - if (!is_modelica_block(xx)) { - modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label); - if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) { - needcompile = 1; -} - if (or(model.firing!=model_n.firing)) { - needcompile = 2; -} - if (model.sim=="input"||model.sim=="output") { - if (model.ipar!=model_n.ipar) { - needcompile = 4; -} -} - if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { - needcompile = 4; -} - if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { - needcompile = 4; -} - if (prod(size(model_n.sim))>1) { - if (model_n.sim[2-1]>1000) { - if (model.sim[1-1]!=model_n.sim[1-1]) { - needcompile = 4; -} -} -} - } else { - modified = or(model_n!=model); - eq = model.equations; - eqn = model_n.equations; - if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { - needcompile = 4; -} -} - arg1[spath-1] = this.xxn; - newpar[size(newpar)+1-1] = path; -} -} - x = arg1; + np = size(path,"*"); + spath = list(); + for (k=1;k<=np;k+=1) { + spath[$+1-1] = "model"; + spath[$+1-1] = "rpar"; + spath[$+1-1] = "objs"; + spath[$+1-1] = path[k-1]; + } + xx = arg1[spath-1]; + execstr("xxn="+xx.gui+"(\'set\',xx)"); + if (diffobjs(this.xxn,xx)) { + model = xx.model; + model_n = this.xxn.model; + if (!is_modelica_block(xx)) { + modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label); + if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) { + needcompile = 1; + } + if (or(model.firing!=model_n.firing)) { + needcompile = 2; + } + if (model.sim=="input"||model.sim=="output") { + if (model.ipar!=model_n.ipar) { + needcompile = 4; + } + } + if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { + needcompile = 4; + } + if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; + } + if (prod(size(model_n.sim))>1) { + if (model_n.sim[2-1]>1000) { + if (model.sim[1-1]!=model_n.sim[1-1]) { + needcompile = 4; + } + } + } + } else { + modified = or(model_n!=model); + eq = model.equations; + eqn = model_n.equations; + if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { + needcompile = 4; + } + } + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; + } + } + this.x = arg1; y = needcompile; typ = newpar; } diff --git a/js/Sources/STEP_FUNCTION.pickle b/js/Sources/STEP_FUNCTION.pickle index 8ecebb29..85e1e424 100644 --- a/js/Sources/STEP_FUNCTION.pickle +++ b/js/Sources/STEP_FUNCTION.pickle @@ -2,10 +2,12 @@ c__builtin__ set p0 ((lp1 -S'STEP' +S'x' p2 -aS'xxn' +aS'STEP' p3 -atp4 -Rp5 +aS'xxn' +p4 +atp5 +Rp6 . \ No newline at end of file diff --git a/js/Sources/SampleCLK.js b/js/Sources/SampleCLK.js index 9e372ede..72175267 100644 --- a/js/Sources/SampleCLK.js +++ b/js/Sources/SampleCLK.js @@ -9,44 +9,45 @@ function SampleCLK() { model.firing = -1; model.dep_ut = [false,false]; exprs = [[sci2exp(1)],[sci2exp(0)]]; - x = standard_define([2,2],model,exprs," "); + this.x = standard_define([2,2],model,exprs," "); } SampleCLK.prototype.details = function SampleCLK() { + return this.x; } SampleCLK.prototype.get = function SampleCLK() { } SampleCLK.prototype.set = function SampleCLK() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,frequ,offset,exprs] = scicos_getvalue("Set block parameters",[["Sample time"],["Offset"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - if (frequ<0) { -message("Frequency must be a positif number"); - ok = false; -} - if (abs(offset)>frequ) { -message("The |Offset| must be less than the Frequency"); - ok = false; -} - if (ok) { - if (or(model.rpar.slice()!=[[frequ],[offset]])) { - needcompile = 4; - y = needcompile; -} - model.rpar = [[frequ],[offset]]; - model.evtout = 1; - model.firing = -1; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -needcompile=resume(needcompile) + [ok,frequ,offset,exprs] = scicos_getvalue("Set block parameters",[["Sample time"],["Offset"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (frequ<0) { + message("Frequency must be a positif number"); + ok = false; + } + if (abs(offset)>frequ) { + message("The |Offset| must be less than the Frequency"); + ok = false; + } + if (ok) { + if (or(model.rpar.slice()!=[[frequ],[offset]])) { + needcompile = 4; + y = needcompile; + } + model.rpar = [[frequ],[offset]]; + model.evtout = 1; + model.firing = -1; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Sources/SampleCLK.pickle b/js/Sources/SampleCLK.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/SampleCLK.pickle +++ b/js/Sources/SampleCLK.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/Sigbuilder.js b/js/Sources/Sigbuilder.js index 910f1421..f27189ff 100644 --- a/js/Sources/Sigbuilder.js +++ b/js/Sources/Sigbuilder.js @@ -12,80 +12,81 @@ function Sigbuilder() { scs_m_1.objs[8-1] = scicos_link(xx=[[349.49528],[349.49528]],yy=[[565.10704],[535.10704]],id="drawlink",thick=[0,0],ct=[5,-1],from=[3,1,0],to=[7,1,1]); model = scicos_model(sim="csuper",in1=[],in2=[],intyp=1,out=-1,out2=[],outtyp=1,evtin=[],evtout=1,state=[],dstate=[],odstate=list(),rpar=scs_m_1,ipar=[],opar=list(),blocktype="h",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()); gr_i = []; - x = standard_define([3,2],model,[],gr_i); + this.x = standard_define([3,2],model,[],gr_i); } Sigbuilder.prototype.details = function Sigbuilder() { + return this.x; } Sigbuilder.prototype.get = function Sigbuilder() { } Sigbuilder.prototype.set = function Sigbuilder() { ppath = list(0); -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="CURVE_c") { - ppath[1-1] = i; -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="CURVE_c") { + ppath[1-1] = i; + break; + } + } newpar = list(); this.y = 0; for (path in ppath) { - np = size(path,"*"); - spath = list(); -for (k=1;k<=np;k+=1) { - spath[$+1-1] = "model"; - spath[$+1-1] = "rpar"; - spath[$+1-1] = "objs"; - spath[$+1-1] = path[k-1]; -} - xx = arg1[spath-1]; -execstr("xxn="+xx.gui+"(\'set\',xx)"); - if (diffobjs(this.xxn,xx)) { - model = xx.model; - model_n = this.xxn.model; - if (!is_modelica_block(xx)) { - modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.odstate,model_n.odstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.opar,model_n.opar)||!isequal(model.label,model_n.label); - if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)||or(model.in2!=model_n.in2)||or(model.out2!=model_n.out2)||or(model.outtyp!=model_n.outtyp)||or(model.intyp!=model_n.intyp)) { - needcompile = 1; -} - if (or(model.firing!=model_n.firing)) { - needcompile = 2; -} - if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) { - needcompile = 4; -} - if (model.sim=="input"||model.sim=="output") { - if (model.ipar!=model_n.ipar) { - needcompile = 4; -} -} - if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { - needcompile = 4; -} - if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { - needcompile = 4; -} - if (prod(size(model_n.sim))>1) { - if (model_n.sim[2-1]>1000) { - if (model.sim[1-1]!=model_n.sim[1-1]) { - needcompile = 4; -} -} -} - } else { - modified = or(model_n!=model); - eq = model.equations; - eqn = model_n.equations; - if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { - needcompile = 4; -} -} - arg1[spath-1] = this.xxn; - newpar[size(newpar)+1-1] = path; - this.y = max(this.y,needcompile); -} -} - x = arg1; + np = size(path,"*"); + spath = list(); + for (k=1;k<=np;k+=1) { + spath[$+1-1] = "model"; + spath[$+1-1] = "rpar"; + spath[$+1-1] = "objs"; + spath[$+1-1] = path[k-1]; + } + xx = arg1[spath-1]; + execstr("xxn="+xx.gui+"(\'set\',xx)"); + if (diffobjs(this.xxn,xx)) { + model = xx.model; + model_n = this.xxn.model; + if (!is_modelica_block(xx)) { + modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.odstate,model_n.odstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.opar,model_n.opar)||!isequal(model.label,model_n.label); + if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)||or(model.in2!=model_n.in2)||or(model.out2!=model_n.out2)||or(model.outtyp!=model_n.outtyp)||or(model.intyp!=model_n.intyp)) { + needcompile = 1; + } + if (or(model.firing!=model_n.firing)) { + needcompile = 2; + } + if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) { + needcompile = 4; + } + if (model.sim=="input"||model.sim=="output") { + if (model.ipar!=model_n.ipar) { + needcompile = 4; + } + } + if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { + needcompile = 4; + } + if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; + } + if (prod(size(model_n.sim))>1) { + if (model_n.sim[2-1]>1000) { + if (model.sim[1-1]!=model_n.sim[1-1]) { + needcompile = 4; + } + } + } + } else { + modified = or(model_n!=model); + eq = model.equations; + eqn = model_n.equations; + if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { + needcompile = 4; + } + } + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; + this.y = max(this.y,needcompile); + } + } + this.x = arg1; typ = newpar; } } diff --git a/js/Sources/Sigbuilder.pickle b/js/Sources/Sigbuilder.pickle index 52400405..2fef70c1 100644 --- a/js/Sources/Sigbuilder.pickle +++ b/js/Sources/Sigbuilder.pickle @@ -2,16 +2,18 @@ c__builtin__ set p0 ((lp1 -S'y' +S'xxn' p2 -aS'order' +aS'y' p3 -aS'ORDER2' +aS'x' p4 -aS'xxn' -p5 aS'N' +p5 +aS'ORDER2' p6 -atp7 -Rp8 +aS'order' +p7 +atp8 +Rp9 . \ No newline at end of file diff --git a/js/Sources/TIME_f.js b/js/Sources/TIME_f.js index 5c25b655..2c9f1ced 100644 --- a/js/Sources/TIME_f.js +++ b/js/Sources/TIME_f.js @@ -7,13 +7,14 @@ function TIME_f() { model.blocktype = "c"; model.dep_ut = [false,true]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } TIME_f.prototype.details = function TIME_f() { + return this.x; } TIME_f.prototype.get = function TIME_f() { } TIME_f.prototype.set = function TIME_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Sources/TIME_f.pickle b/js/Sources/TIME_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/TIME_f.pickle +++ b/js/Sources/TIME_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Sources/TKSCALE.js b/js/Sources/TKSCALE.js index 82a2a369..6e4b9522 100644 --- a/js/Sources/TKSCALE.js +++ b/js/Sources/TKSCALE.js @@ -13,23 +13,24 @@ function TKSCALE() { model.dep_ut = [false,false]; exprs = [[sci2exp(a)],[sci2exp(b)],[sci2exp(f)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } TKSCALE.prototype.details = function TKSCALE() { + return this.x; } TKSCALE.prototype.get = function TKSCALE() { } TKSCALE.prototype.set = function TKSCALE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; [ok,a,b,f,exprs] = scicos_getvalue("Set scale block parameters",[["Min value"],["Max value"],["Normalization"]],list("vec",1,"vec",1,"vec",1),exprs); if (ok) { - graphics.exprs = exprs; - model.rpar = [[a],[b],[f]]; - x.graphics = graphics; - x.model = model; -} + graphics.exprs = exprs; + model.rpar = [[a],[b],[f]]; + this.x.graphics = graphics; + this.x.model = model; + } } } diff --git a/js/Sources/TKSCALE.pickle b/js/Sources/TKSCALE.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/TKSCALE.pickle +++ b/js/Sources/TKSCALE.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Threshold/GENERAL_f.js b/js/Threshold/GENERAL_f.js index 6ad0a076..7a98c8ef 100644 --- a/js/Threshold/GENERAL_f.js +++ b/js/Threshold/GENERAL_f.js @@ -15,14 +15,15 @@ function GENERAL_f() { model.dep_ut = [true,false]; exprs = [[strcat(sci2exp(in1))],[strcat(sci2exp(out))]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } GENERAL_f.prototype.details = function GENERAL_f() { + return this.x; } GENERAL_f.prototype.get = function GENERAL_f() { } GENERAL_f.prototype.set = function GENERAL_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -33,27 +34,27 @@ function GENERAL_f() { nout = sum(out); [ok,in1,out,exprs] = scicos_getvalue("Set General Zero-Crossing parameters",[["Input size"],["Number of event output"]],list("vec",1,"vec",1),exprs); if (ok) { - [model,graphics,ok] = check_io(model,graphics,in1,[],[],ones(out,1)); - if (ok) { - nout1 = out; - nin1 = in1; - if (nout==nout1&&nin==nin1) { - rp = matrix(rpar,nout,2^(2*nin)); - } else { - rp = -1*ones(nout1,2^(2*nin1)); -} - n = size(rp,2)/2; - result = x_mdialog("routing matrix",string(1,nout1),string(1,2^(2*nin1)),string(rp.slice().slice())); - if (result!=[]) { - rp.slice(1-1,nout1).slice(1-1,2*n) = evstr(result); - model.nzcross = in1; - model.rpar = rp.slice(); - model.firing = -ones(out,1); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -} -} -} + [model,graphics,ok] = check_io(model,graphics,in1,[],[],ones(out,1)); + if (ok) { + nout1 = out; + nin1 = in1; + if (nout==nout1&&nin==nin1) { + rp = matrix(rpar,nout,2^(2*nin)); + } else { + rp = -1*ones(nout1,2^(2*nin1)); + } + n = size(rp,2)/2; + result = x_mdialog("routing matrix",string(1,nout1),string(1,2^(2*nin1)),string(rp.slice().slice())); + if (result!=[]) { + rp.slice(1-1,nout1).slice(1-1,2*n) = evstr(result); + model.nzcross = in1; + model.rpar = rp.slice(); + model.firing = -ones(out,1); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + } + } + } } } diff --git a/js/Threshold/GENERAL_f.pickle b/js/Threshold/GENERAL_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Threshold/GENERAL_f.pickle +++ b/js/Threshold/GENERAL_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Threshold/NEGTOPOS_f.js b/js/Threshold/NEGTOPOS_f.js index 82fe5548..5c9b4ae1 100644 --- a/js/Threshold/NEGTOPOS_f.js +++ b/js/Threshold/NEGTOPOS_f.js @@ -11,14 +11,15 @@ function NEGTOPOS_f() { model.firing = -1; model.dep_ut = [true,false]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } NEGTOPOS_f.prototype.details = function NEGTOPOS_f() { + return this.x; } NEGTOPOS_f.prototype.get = function NEGTOPOS_f() { } NEGTOPOS_f.prototype.set = function NEGTOPOS_f() { - x = arg1; - x.model.firing = -1; + this.x = arg1; + this.x.model.firing = -1; } } diff --git a/js/Threshold/NEGTOPOS_f.pickle b/js/Threshold/NEGTOPOS_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Threshold/NEGTOPOS_f.pickle +++ b/js/Threshold/NEGTOPOS_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Threshold/POSTONEG_f.js b/js/Threshold/POSTONEG_f.js index 5a59bb94..d5d94a39 100644 --- a/js/Threshold/POSTONEG_f.js +++ b/js/Threshold/POSTONEG_f.js @@ -12,14 +12,15 @@ function POSTONEG_f() { model.dep_ut = [true,false]; model.firing = [-1]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } POSTONEG_f.prototype.details = function POSTONEG_f() { + return this.x; } POSTONEG_f.prototype.get = function POSTONEG_f() { } POSTONEG_f.prototype.set = function POSTONEG_f() { - x = arg1; - x.model.firing = [-1]; + this.x = arg1; + this.x.model.firing = [-1]; } } diff --git a/js/Threshold/POSTONEG_f.pickle b/js/Threshold/POSTONEG_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Threshold/POSTONEG_f.pickle +++ b/js/Threshold/POSTONEG_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file diff --git a/js/Threshold/ZCROSS_f.js b/js/Threshold/ZCROSS_f.js index cd20e7a7..a8934ea9 100644 --- a/js/Threshold/ZCROSS_f.js +++ b/js/Threshold/ZCROSS_f.js @@ -14,39 +14,40 @@ function ZCROSS_f() { model.dep_ut = [true,false]; exprs = strcat(sci2exp(in1)); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } ZCROSS_f.prototype.details = function ZCROSS_f() { + return this.x; } ZCROSS_f.prototype.get = function ZCROSS_f() { } ZCROSS_f.prototype.set = function ZCROSS_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,in1,exprs] = scicos_getvalue([["Set Zero-Crossing parameters"],["All surfaces must cross together"]],"Input size",list("vec",1),exprs); - if (!ok) { -break; -} - in1 = int(in1); - if (in1<=0) { -message("Block must have at least one input"); - } else { - kk = 0; -for (jj=1;jj<=in1;jj+=1) { - kk = kk+2^(in1+jj-1); -} - model.rpar = [[-ones(kk,1)],[zeros(2^(2*in1)-kk,1)]]; - graphics.exprs = exprs; - model.in1 = in1; - model.nzcross = in1; - model.firing = -1; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,in1,exprs] = scicos_getvalue([["Set Zero-Crossing parameters"],["All surfaces must cross together"]],"Input size",list("vec",1),exprs); + if (!ok) { + break; + } + in1 = int(in1); + if (in1<=0) { + message("Block must have at least one input"); + } else { + kk = 0; + for (jj=1;jj<=in1;jj+=1) { + kk = kk+2^(in1+jj-1); + } + model.rpar = [[-ones(kk,1)],[zeros(2^(2*in1)-kk,1)]]; + graphics.exprs = exprs; + model.in1 = in1; + model.nzcross = in1; + model.firing = -1; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Threshold/ZCROSS_f.pickle b/js/Threshold/ZCROSS_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Threshold/ZCROSS_f.pickle +++ b/js/Threshold/ZCROSS_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 . \ No newline at end of file -- cgit