copy SCI/macros/scicos_blocks to SCI/modules/scicos_blocks/macros
Allan Cornet [Thu, 31 Jan 2008 15:08:02 +0000 (15:08 +0000)]
367 files changed:
scilab/modules/scicos_blocks/macros/Branching/CLKFROM.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/CLKGOTO.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/CLKGotoTagVisibility.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/DEMUX.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/DEMUX_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/ESELECT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/EXTRACTOR.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/FROM.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/FROMMO.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/GOTO.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/GOTOMO.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/GotoTagVisibility.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/GotoTagVisibilityMO.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/ISELECT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/ISELECT_m.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/MUX.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/MUX_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/M_SWITCH.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/NRMSOM_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/RELAY_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/SCALAR2VECTOR.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/SELECT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/SELECT_m.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/SWITCH2.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/SWITCH2_m.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/SWITCH_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Branching/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/CCS.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/CCS.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/CVS.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/CVS.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Capacitor.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Capacitor.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/ConstantVoltage.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/ConstantVoltage.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/CurrentSensor.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/CurrentSensor.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Diode.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Diode.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/ExternFunction.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Ground.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Ground.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Gyrator.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Gyrator.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/IdealTransformer.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/IdealTransformer.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/InPutPort.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Inductor.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Inductor.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/MOTOR.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Maths.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/NMOS.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/NMOS.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/NPN.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/NPN.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/OpAmp.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/OpAmp.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/OutPort.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/OutPutPort.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/PMOS.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/PMOS.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/PNP.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/PNP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Pin.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/PotentialSensor.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/PotentialSensor.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Resistor.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Resistor.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/SineVoltage.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/SineVoltage.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Switch.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/Switch.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/VVsourceAC.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/VVsourceAC.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/VariableResistor.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/VariableResistor.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/VoltageSensor.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/VoltageSensor.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/VsourceAC.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/VsourceAC.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/VsourceDC.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Electrical/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/ANDBLK.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/ANDLOG_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/CLKSOMV_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/CLKSOM_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/CLKSPLIT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/END_c.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/EVTDLY_c.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/EVTDLY_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/EVTGEN_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/EVTVARDLY.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/HALT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/IFTHEL_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/MCLOCK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/MFCLCK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/M_freq.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Events/freq_div.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/Bache.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/Bache.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/PerteDP.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/PerteDP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/PortPHQ1.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/PortPHQ2.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/Puits.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/PuitsP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/Source.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/SourceP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/ThermoCarre.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/VanneReglante.mo [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/VanneReglante.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/bache_draw_ports.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/bache_inputs.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/bache_outputs.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/puit_draw_ports.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/puit_inputs.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/source_draw_ports.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/source_inputs.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/vanne_draw_ports.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/vanne_inputs.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Hydraulics/vanne_outputs.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/BITCLEAR.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/BITSET.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/CONVERT.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/DFLIPFLOP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/DLATCH.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/EXTRACTBITS.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/INTMUL.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/JKFLIPFLOP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/LOGIC.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/SHIFT.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/SRFLIPFLOP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/IntegerOp/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/BIGSOM_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/CLINDUMMY_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/CLR.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/CLR_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/CLSS.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/CLSS_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/DELAYV_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/DELAY_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/DERIV.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/DLR.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/DLR_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/DLSS.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/DLSS_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/DOLLAR.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/DOLLAR_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/DOLLAR_m.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/GAINBLK.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/GAINBLK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/GAIN_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/INTEGRAL.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/INTEGRAL_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/INTEGRAL_m.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/PID.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/REGISTER.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/REGISTER_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/SAMPHOLD.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/SAMPHOLD_m.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/SAMPLEHOLD_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/SOM_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/SUMMATION.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/SUM_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/TCLSS.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/TCLSS_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/TIME_DELAY.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/VARIABLE_DELAY.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Linear/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/CUMSUM.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/EXTRACT.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/EXTTRI.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATBKSL.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATCATH.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATCATV.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATDET.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATDIAG.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATDIV.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATEIG.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATEXPM.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATINV.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATLU.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATMAGPHI.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATMUL.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATPINV.sci [new file with mode: 0755]
scilab/modules/scicos_blocks/macros/MatrixOp/MATRESH.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATSING.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATSUM.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATTRAN.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATZCONJ.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/MATZREIM.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/RICC.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/ROOTCOEF.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/SQRT.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/SUBMAT.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/MatrixOp/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/AUTOMAT.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/BACKLASH.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/BOUNCE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/BOUNCEXY.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/BPLATFORM.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/CBLOCK.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/CONSTRAINT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/DEADBAND.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/DEBUG_SCICOS.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/DIFF_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/DSUPER.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/EDGETRIGGER.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/EDGE_TRIGGER.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/ENDBLK.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/EXPRESSION.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/Extract_Activation.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/HYSTHERESIS.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/IMPSPLIT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/LOGICAL_OP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/MBLOCK.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/MEMORY_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/RATELIMITER.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/RELATIONALOP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/SPLIT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/SUPER_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/TEXT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/bplatform2.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/c_block.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/fortran_block.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/func_block.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/generic_block.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/generic_block2.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/generic_block3.sci [new file with mode: 0755]
scilab/modules/scicos_blocks/macros/Misc/m_sin.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/scifunc_block.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Misc/scifunc_block_m.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/ABSBLK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/ABS_VALUE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/COSBLK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/DLRADAPT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/EXPBLK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/EXPBLK_m.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/FSV_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/INTRP2BLK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/INTRPLBLK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/INVBLK.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/INVBLK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/LOGBLK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/LOOKUP_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/MAXMIN.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/MAX_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/MIN_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/POWBLK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/PRODUCT.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/PROD_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/QUANT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/SATURATION.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/SAT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/SIGNUM.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/SINBLK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/TANBLK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/TrigFun.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/NonLinear/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/CFORTREDP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/Disc2_5_FVM1d.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/Disc_diff_oper2.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/Disc_diff_oper45.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/IHM_EDP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/PDE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/addf_mat.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/addfv.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/arbre_decision.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/assemb.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/assemblage_FE1D.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/cformatlinedp.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/code_generation.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/coef_FEM1d.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/elemoper.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/eval_pts_EF.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/eval_pts_df.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/eval_pts_vf.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/extraction_infos.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/formkf.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/gen_code_FDM.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/gen_code_FEM.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/gen_code_FVM.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/lecture_xml.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/maillage_FE1D.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/meth.xml [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/msprintfv.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/mulf3.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/mulf3v.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/mulf_string.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/mulfstring.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/mulfv.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/multMatVect.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/multVectStr.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/nombre_etats.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/setint.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/setvalue_IHM-PDE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/shape.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/subf_mat.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/subfv.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/translate.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/PDE/unimesh1D.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/AFFICH_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/AFFICH_m.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CANIMXY.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CANIMXY3D.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CEVENTSCOPE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CFSCOPE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CLKOUTV_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CLKOUT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CMAT3D.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CMATVIEW.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CMSCOPE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CSCOPE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CSCOPXY.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/CSCOPXY3D.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/OUTIMPL_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/OUT_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/TOWS_c.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/TRASH_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/WFILE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/WFILE_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/WRITEAU_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/WRITEC_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sinks/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/CLKINV_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/CLKIN_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/CLOCK_c.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/CLOCK_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/CONST.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/CONST_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/CONST_m.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/CURVE_c.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/CURV_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/Counter.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/FROMWSB.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/FROMWS_c.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/GENSIN_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/GENSQR_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/INIMPL_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/IN_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/Modulo_Count.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/RAMP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/RAND_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/RAND_m.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/READAU_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/READC_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/RFILE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/RFILE_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/SAWTOOTH_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/SLIDER_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/STEP.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/STEP_FUNCTION.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/SampleCLK.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/Sigbuilder.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/TIME_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/TKSCALE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Sources/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Threshold/GENERAL_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Threshold/NEGTOPOS_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Threshold/POSTONEG_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Threshold/ZCROSS_f.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/Threshold/buildmacros.sce [new file with mode: 0644]
scilab/modules/scicos_blocks/macros/buildmacros.sce [new file with mode: 0644]

diff --git a/scilab/modules/scicos_blocks/macros/Branching/CLKFROM.sci b/scilab/modules/scicos_blocks/macros/Branching/CLKFROM.sci
new file mode 100644 (file)
index 0000000..14017d2
--- /dev/null
@@ -0,0 +1,109 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=CLKFROM(job,arg1,arg2)
+x=[];y=[];typ=[]
+select job
+case 'plot' then
+  orig=arg1.graphics.orig;sz=arg1.graphics.sz;orient=arg1.graphics.flip;
+  prt='['+arg1.graphics.exprs+']'
+  pat=xget('pattern');xset('pattern',default_color(-1))
+  thick=xget('thickness');xset('thickness',2)
+  if orient then
+    y=orig(2)+sz(2)*[1/4 1/2 1;1 1 1;1 1/2 1/4;1/4 1/8 0;0 1/8 1/4]'
+    x=orig(1)+sz(1)*[0 0 0;0 1/2 1;1 1 1;1 3/4 1/2;1/2 1/4 0]'
+    x1=0
+  else
+    y=orig(2)+sz(2)*[0 1/2 3/4;3/4 7/8 1;1 7/8 3/4;3/4 1/2 0;0 0 0]'
+    x=orig(1)+sz(1)*[0 0 0;0 1/4 1/2;1/2 3/4 1;1 1 1;1 1/2 0]'
+    x1=0
+  end
+  xpolys(x,y,5*ones(1,5))
+  xstringb(orig(1)+x1*sz(1),orig(2),prt,(1-x1)*sz(1),sz(2))
+
+  xset('thickness',thick)
+  xset('pattern',pat)
+  //identification
+  ident = arg1.graphics.id
+  if ident <> [] & ident <> '' then
+    font=xget('font')
+    xset('font', options.ID(1)(1), options.ID(1)(2))
+    if ~orient then
+       rectangle = xstringl(orig(1), orig(2), ident) ;
+       w = max(rectangle(3), sz(1)) ;
+       h = rectangle(4) * 1.3 ;
+       xstringb(orig(1) + sz(1) / 2 - w / 2, orig(2) - h , ident , w, h) ;
+    else
+       rectangle = xstringl(orig(1), orig(2)+sz(2), ident) ;
+       w = max(rectangle(3), sz(1)) ;
+       h = rectangle(4) * 1.3 ;
+       xstringb(orig(1) + sz(1) / 2 - w / 2, orig(2)+ sz(2) , ident , w, h) ;
+    end
+    xset('font', font(1), font(2))
+  end
+  x=[];y=[]
+case 'getinputs' then
+  x=[];y=[];typ=[]
+case 'getoutputs' then
+  orig=arg1.graphics.orig;sz=arg1.graphics.sz;
+  if arg1.graphics.flip then
+    x=orig(1)+sz(1)/2
+    y=orig(2)
+  else
+    x=orig(1)+sz(1)/2
+    y=orig(2)+sz(2)
+  end
+  typ=-ones(x)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;
+  model=arg1.model;
+  exprs=graphics.exprs
+  while %t do
+    [ok,tag,exprs]=getvalue('Set block parameters',..
+       'Tag',list('str',-1),exprs)
+    if ~ok then break,end
+    if model.opar<>list(tag) then needcompile=4;y=needcompile,end
+      model.opar=list(tag)
+      model.evtout=1
+      model.firing=-1//compatibility
+      graphics.exprs=exprs
+      x.graphics=graphics
+      x.model=model
+      break
+  end
+  needcompile=resume(needcompile)
+case 'define' then
+  model=scicos_model()
+  model.sim='clkfrom'
+  model.evtout=1
+  model.opar=list('A')
+  model.blocktype='d'
+  model.firing=-1
+  model.dep_ut=[%f %f]
+
+  exprs='A'
+  x=standard_define([1.5 1.5],model,exprs,' ')
+  x.graphics.id="From"
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/CLKGOTO.sci b/scilab/modules/scicos_blocks/macros/Branching/CLKGOTO.sci
new file mode 100644 (file)
index 0000000..9a64448
--- /dev/null
@@ -0,0 +1,121 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=CLKGOTO(job,arg1,arg2)
+x=[];y=[];typ=[]
+select job
+case 'plot' then
+  orig=arg1.graphics.orig;sz=arg1.graphics.sz;orient=arg1.graphics.flip;
+  rul=['[','{','',']','}','']
+  prt=rul(evstr(arg1.graphics.exprs(2)))+arg1.graphics.exprs(1)+rul(evstr(arg1.graphics.exprs(2))+3)
+  pat=xget('pattern');xset('pattern',default_color(-1))
+  thick=xget('thickness');xset('thickness',2)
+  if ~orient then
+    y=orig(2)+sz(2)*[1/4 1/2 1;1 1 1;1 1/2 1/4;1/4 1/8 0;0 1/8 1/4]'
+    x=orig(1)+sz(1)*[0 0 0;0 1/2 1;1 1 1;1 3/4 1/2;1/2 1/4 0]'
+    x1=0
+  else
+    y=orig(2)+sz(2)*[0 1/2 3/4;3/4 7/8 1;1 7/8 3/4;3/4 1/2 0;0 0 0]'
+    x=orig(1)+sz(1)*[0 0 0;0 1/4 1/2;1/2 3/4 1;1 1 1;1 1/2 0]'
+    x1=0
+  end
+  xpolys(x,y,5*ones(1,5))
+  xstringb(orig(1)+x1*sz(1),orig(2),prt,(1-x1)*sz(1),sz(2))
+
+  xset('thickness',thick)
+  xset('pattern',pat)
+  //identification
+  ident = arg1.graphics.id
+  if ident <> [] & ident <> '' then
+    font=xget('font')
+    xset('font', options.ID(1)(1), options.ID(1)(2))
+    if orient then
+       rectangle = xstringl(orig(1), orig(2), ident) ;
+       w = max(rectangle(3), sz(1)) ;
+       h = rectangle(4) * 1.3 ;
+       xstringb(orig(1) + sz(1) / 2 - w / 2, orig(2) - h , ident , w, h) ;
+    else
+       rectangle = xstringl(orig(1), orig(2)+sz(2), ident) ;
+       w = max(rectangle(3), sz(1)) ;
+       h = rectangle(4) * 1.3 ;
+       xstringb(orig(1) + sz(1) / 2 - w / 2, orig(2)+ sz(2) , ident , w, h) ;
+    end
+    xset('font', font(1), font(2))
+  end
+  x=[];y=[]
+case 'getinputs' then
+  orig=arg1.graphics.orig;
+  sz=arg1.graphics.sz;
+  if arg1.graphics.flip then
+    x=orig(1)+sz(1)/2
+    y=orig(2)+sz(2)
+  else
+    x=orig(1)+sz(1)/2
+    y=orig(2)
+  end
+  typ=-ones(x) //undefined type
+case 'getoutputs' then
+  x=[];y=[];typ=[]
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;
+  model=arg1.model;
+  exprs=graphics.exprs
+  while %t do
+    [ok,tag,tagvis,exprs]=getvalue('Set block parameters',..
+       ['Tag';'Tag Visibility (1=Local 2=Scoped 3=Global)'],list('str',-1,'vec',1),exprs)
+    if ~ok then break,end
+    if ((tagvis<1)|(tagvis>3)) then
+          message('Tag Visibility must be between 1 and 3');ok=%f;
+    end
+    tagvis=int(tagvis);
+    if ok then
+       if ((model.opar<>list(tag))| (model.ipar<>tagvis)) then
+          needcompile=4;y=needcompile
+       end
+       model.opar=list(tag)
+       model.ipar=tagvis
+       model.evtout=1
+       model.firing=-1//compatibility
+       graphics.exprs=exprs
+       x.graphics=graphics
+       x.model=model
+       break
+     end
+  end
+  needcompile=resume(needcompile)
+case 'define' then
+  model=scicos_model()
+  model.sim='clkgoto'
+  model.evtin=1
+  model.opar=list('A')
+  model.ipar=int(1)
+  model.blocktype='d'
+  model.firing=-1
+  model.dep_ut=[%f %f]
+
+  exprs=['A',sci2exp(1)]
+  x=standard_define([1.5 1.5],model,exprs,' ')
+  x.graphics.id="Goto"
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/CLKGotoTagVisibility.sci b/scilab/modules/scicos_blocks/macros/Branching/CLKGotoTagVisibility.sci
new file mode 100644 (file)
index 0000000..935a1c1
--- /dev/null
@@ -0,0 +1,82 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=CLKGotoTagVisibility(job,arg1,arg2)
+  x=[];y=[],typ=[]
+  select job
+   case 'plot' then
+    standard_draw(arg1)
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,tag,exprs]=getvalue('Set parameters',..
+         ['GotoTag'],..
+         list('str',-1),exprs)
+      if ~ok then break,end
+      if ok then
+       if model.opar<>list(tag) then needcompile=4;y=needcompile,end
+       graphics.exprs=exprs;
+       model.opar=list(tag);
+       x.graphics=graphics;x.model=model;
+       break
+      end
+    end
+   needcompile=resume(needcompile)
+   case 'define' then
+   model=scicos_model()
+   model.sim='clkgototagvisibility'
+   model.in=[]
+   model.in2=[]
+   model.out=[]
+   model.out2=[]
+   model.evtin=[]
+   model.intyp=1
+   model.outtyp=1
+   model.opar=list('A');
+   model.blocktype='c'
+   model.firing=%f
+   model.dep_ut=[%f %f]
+   exprs='A'
+   gr_i=['xstringb(orig(1),orig(2),[''{''+arg1.graphics.exprs(1)+''}''],sz(1),sz(2),''fill'');';
+         'wd=xget(''wdim'').*[1.016,1.12];';
+              'thick=xget(''thickness'');xset(''thickness'',2);';
+              'p=wd(2)/wd(1);p=1;';
+              'xarcs([orig(1)+0.05*sz(1);';
+              'orig(2)+0.95*sz(2);';
+                 '0.9*sz(1)*p;';
+                 '0.9*sz(2);';
+                 '0;';
+              '360*64],scs_color(5));';
+              'xset(''thickness'',thick)']
+ //        'g=gca();'
+    //     'g.children.font_foreground=5']
+   x=standard_define([2 2],model,exprs,gr_i)
+   x.graphics.id=["Goto Tag";"Visibility"]
+  end
+endfunction
\ No newline at end of file
diff --git a/scilab/modules/scicos_blocks/macros/Branching/DEMUX.sci b/scilab/modules/scicos_blocks/macros/Branching/DEMUX.sci
new file mode 100644 (file)
index 0000000..2e56ad7
--- /dev/null
@@ -0,0 +1,81 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=DEMUX(job,arg1,arg2)
+  x=[];y=[];typ=[];
+  select job
+   case 'plot' then
+    standard_draw(arg1)
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,out,exprs]=getvalue('Set DEMUX block parameters',..
+                             ['number of output ports or vector of sizes'],list('vec',-1),exprs)
+      if ~ok then break,end
+      if size(out,'*')==1 then
+       if out<2|out>31 then
+         message('Block must have at least 2 and at most 31 output ports')
+         ok=%f
+       else
+         [model,graphics,ok]=check_io(model,graphics,0,-[1:out]',[],[])
+       end
+      else
+        if size(out,'*')<2| or(out==0)|size(out,'*')>31 then
+         message(['Block must have at least 2 and at most 31 output ports';
+                  'size 0 is not allowed'])
+         ok=%f
+       else
+         if min(out)<0 then nin=0,else nin=sum(out),end
+         [model,graphics,ok]=check_io(model,graphics,nin,out(:),[],[])
+         if ok then out=size(out,'*'),end
+       end
+      end
+      if ok then
+       graphics.exprs=exprs;model.ipar=out
+       x.graphics=graphics;x.model=model
+       break
+      end
+    end
+   case 'define' then
+    out=2
+    model=scicos_model()
+    model.sim=list('multiplex',4)
+    model.in=0 //means equal to the sum of the outputs
+    model.out=-[1:out]'
+    model.ipar=out
+    model.blocktype='c'
+    model.firing=[]
+    model.dep_ut=[%t %f]
+    
+    exprs=string(out)
+    gr_i=''  //'xstringb(orig(1),orig(2),''Demux'',sz(1),sz(2),''fill'')'
+    x=standard_define([.5 2],model,exprs,gr_i)
+    x.graphics.id="Demux"
+  end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/DEMUX_f.sci b/scilab/modules/scicos_blocks/macros/Branching/DEMUX_f.sci
new file mode 100644 (file)
index 0000000..bd13741
--- /dev/null
@@ -0,0 +1,80 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=DEMUX_f(job,arg1,arg2)
+  x=[];y=[];typ=[];
+  select job
+   case 'plot' then
+    standard_draw(arg1)
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,out,exprs]=getvalue('Set DEMUX block parameters',..
+                             ['number of output ports or vector of sizes'],list('vec',-1),exprs)
+      if ~ok then break,end
+      if size(out,'*')==1 then
+       if out<2 | out>8 then
+         message('Block must have at least 2 and at most 8 output ports')
+         ok=%f
+       else
+         [model,graphics,ok]=check_io(model,graphics,0,-[1:out]',[],[])
+       end
+      else
+        if size(out,'*')<2| size(out,'*')>8|or(out==0) then
+         message(['Block must have at least 2 and at most 8 output ports';
+               'and size 0 is not allowed']   )
+         ok=%f
+       else
+         if min(out)<0 then nin=0,else nin=sum(out),end
+         [model,graphics,ok]=check_io(model,graphics,nin,out(:),[],[])
+         if ok then out=size(out,'*'),end
+       end
+      end
+      if ok then
+       graphics.exprs=exprs;model.ipar=out
+       x.graphics=graphics;x.model=model
+       break
+      end
+    end
+   case 'define' then
+    out=2
+    model=scicos_model()
+    model.sim=list('demux',1)
+    model.in=0 //????
+    model.out=-[1:out]'
+    model.ipar=out
+    model.blocktype='c'
+    model.firing=[]
+    model.dep_ut=[%t %f]
+    
+    exprs=string(out)
+    gr_i='xstringb(orig(1),orig(2),''Demux'',sz(1),sz(2),''fill'')'
+    x=standard_define([2 2],model,exprs,gr_i)
+  end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/ESELECT_f.sci b/scilab/modules/scicos_blocks/macros/Branching/ESELECT_f.sci
new file mode 100644 (file)
index 0000000..518fe3d
--- /dev/null
@@ -0,0 +1,82 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=ESELECT_f(job,arg1,arg2)
+x=[];y=[];typ=[]
+select job
+case 'plot' then
+  standard_draw(arg1)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  if size(exprs,'*')==1 then exprs(2)=string(1);end
+  if size(exprs,'*')==2 then exprs(3)=string(0);end
+  model=arg1.model;
+  while %t do
+    [ok,out,inh,nmod,exprs]=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 then break,end
+    if nmod<>0 then nmod=1,end
+    if inh==0 then inh=[]; else inh=1;end
+    out=int(out)
+    if out<2 then
+      message('Block must have at least two output ports')
+    else
+      [model,graphics,ok]=check_io(model,graphics,1,[],inh,[ones(out,1)])
+      if ok then
+       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
+      end
+    end
+  end
+case 'define' then
+  out=2
+  model=scicos_model()
+  model.sim=list('eselect',-2)
+  model.in=1
+  model.in2=1
+  model.intyp=-1
+  model.evtin=1
+  model.evtout=ones(out,1);
+  model.blocktype='l'
+  model.firing=-ones(out,1);
+  model.dep_ut=[%t %f]
+  model.nmode=0
+  model.nzcross=0
+   
+  gr_i=['txt=[''event select''];';
+    'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
+  exprs=[string(out);string(1);string(model.nmode)]
+  x=standard_define([3 2],model,exprs,gr_i)
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/EXTRACTOR.sci b/scilab/modules/scicos_blocks/macros/Branching/EXTRACTOR.sci
new file mode 100644 (file)
index 0000000..5b465ad
--- /dev/null
@@ -0,0 +1,66 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=EXTRACTOR(job,arg1,arg2)
+  x=[];y=[];typ=[]
+  select job
+   case 'plot' then
+    standard_draw(arg1)
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,ind,exprs]=..
+         getvalue('Set block parameters',..
+                  ['indices to extract'],..
+                  list('vec',-1),exprs)
+      if ~ok then break,end
+      ind=int(ind);ind=ind(:);
+      [model,graphics,ok]=check_io(model,graphics,[-1],size(ind,1),[],[])
+      if ok then
+       model.ipar=ind
+       graphics.exprs=exprs;
+       x.graphics=graphics;x.model=model
+       break
+      end
+    end
+   case 'define' then
+    ind=1
+    model=scicos_model()
+    model.sim=list('extractor',4)
+    model.in=-1
+    model.out=1
+    model.blocktype='c'
+    model.dep_ut=[%t %f]
+    model.ipar=ind
+    exprs=[sci2exp(ind)]
+    gr_i=['txt=[''Extractor''];';
+          'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
+    x=standard_define([2 2],model,exprs,gr_i)
+  end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/FROM.sci b/scilab/modules/scicos_blocks/macros/Branching/FROM.sci
new file mode 100644 (file)
index 0000000..d6659b0
--- /dev/null
@@ -0,0 +1,165 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=FROM(job,arg1,arg2)
+  x=[];y=[];typ=[]
+  select job
+   case 'plot' then
+    pat=xget('pattern'); xset('pattern',default_color(0))
+    orig=arg1.graphics.orig;
+    sz=arg1.graphics.sz;
+    orient=arg1.graphics.flip;
+    tg='['+arg1.graphics.exprs(1)+']';
+    if orient then
+      xx=orig(1)+[0 0 0;0 1/2 3/4;3/4 7/8 1;1 7/8 3/4;3/4 1/2 0]'*sz(1);
+      yy=orig(2)+[0 1/2 1;1 1 1;1 3/4 1/2;1/2 1/4 0;0 0 0]'*sz(2);
+      x1=0
+    else
+      xx=orig(1)+[0 1/8 1/4;1/4 1/2 1;1 1 1;1 1/2 1/4;1/4 1/8 0]'*sz(1);
+      yy=orig(2)+[1/2 3/4 1 ;1 1 1;1 1/2 0;0 0 0;0 1/4 1/2]'*sz(2);
+      x1=1/4
+    end
+    xpolys(xx,yy)
+    xstringb(orig(1)+x1*sz(1),orig(2),tg,(1-x1)*sz(1),sz(2));
+
+    xf=60
+    yf=40
+    nin=0;nout=1
+
+    if orient then  //standard orientation
+                   
+      // set port shape
+      out=[0  -1/14
+          1/7 0
+          0   1/14
+          0  -1/14]*diag([xf,yf])
+      in= [-1/7  -1/14
+          0    0
+          -1/7   1/14
+          -1/7  -1/14]*diag([xf,yf])
+      dy=sz(2)/(nout+1)
+      xset('pattern',default_color(1))
+      for k=1:nout
+       xfpoly(out(:,1)+ones(4,1)*(orig(1)+sz(1)),..
+              out(:,2)+ones(4,1)*(orig(2)+sz(2)-dy*k),1)
+      end
+
+      dy=sz(2)/(nin+1)
+      for k=1:nin
+       xfpoly(in(:,1)+ones(4,1)*orig(1),..
+              in(:,2)+ones(4,1)*(orig(2)+sz(2)-dy*k),1)
+      end
+    else //tilded orientation
+      out=[0  -1/14
+          -1/7 0
+          0   1/14
+          0  -1/14]*diag([xf,yf])
+      in= [1/7  -1/14
+          0    0
+          1/7   1/14
+          1/7  -1/14]*diag([xf,yf])
+      dy=sz(2)/(nout+1)
+      xset('pattern',default_color(1))
+      for k=1:nout
+       xfpoly(out(:,1)+ones(4,1)*orig(1)-1,..
+              out(:,2)+ones(4,1)*(orig(2)+sz(2)-dy*k),1)
+      end
+      dy=sz(2)/(nin+1)
+      for k=1:nin
+       xfpoly(in(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
+              in(:,2)+ones(4,1)*(orig(2)+sz(2)-dy*k),1)
+      end
+    end
+    xset('pattern',pat)
+        //** ------- Identification ---------------------------
+    ident = o.graphics.id
+    gh_axes = gca(); //** get the Axes proprieties 
+  
+    // draw Identification
+    if ident <> []& ident <> ''  then
+  
+      //** Save font state  
+      axes_font_style = gh_axes.font_style ;
+      axes_font_size  = gh_axes.font_size  ;
+      //** axes_font_color = gh_axes.font_color ; //** optional
+  
+        gh_axes.font_style = options.ID(1)(1) ; 
+        gh_axes.font_size  = options.ID(1)(2) ;
+        //** font color not yet used 
+        rectangle = xstringl(orig(1), orig(2), ident) ;
+        w = max(rectangle(3), sz(1)) ;
+        h = rectangle(4) * 1.3 ;
+        xstringb(orig(1) + sz(1) / 2 - w / 2, orig(2) - h , ident , w, h) ;
+  
+     //** Restore font state 
+     gh_axes.font_style = axes_font_style ;
+     gh_axes.font_size  = axes_font_size  ;
+     //** gh_axes.font_color = axes_font_color ; //** optional
+
+    end
+  //** ----- Identification End -----------------------------
+
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,tag,exprs]=getvalue('Set parameters',..
+               ['Tag'],..
+                   list('str',-1),exprs)
+      if ~ok then break,end
+      if ok then 
+         if model.opar<>list(tag) then needcompile=4;y=needcompile,end
+        graphics.exprs=exprs;
+        model.opar=list(tag)
+        x.model=model
+        x.graphics=graphics
+        break
+      end
+    end
+   needcompile=resume(needcompile)
+   case 'define' then
+    model=scicos_model()
+    model.sim='from'
+    model.in=[]
+    model.in2=[]
+    model.intyp=1
+    model.out=-1
+    model.out2=-2
+    model.outtyp=-1
+    model.ipar=[]
+    model.opar=list('A')
+    model.blocktype='c'
+    model.dep_ut=[%f %f]
+    
+    exprs=['A']
+    
+    gr_i='';
+    x=standard_define([1.5 1.5],model,exprs,gr_i)
+    x.graphics.id="From"
+  end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/FROMMO.sci b/scilab/modules/scicos_blocks/macros/Branching/FROMMO.sci
new file mode 100644 (file)
index 0000000..78f89be
--- /dev/null
@@ -0,0 +1,147 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=FROMMO(job,arg1,arg2)
+  x=[];y=[];typ=[]
+  select job
+   case 'plot' then
+    pat=xget('pattern'); xset('pattern',default_color(0))
+    orig=arg1.graphics.orig;
+    sz=arg1.graphics.sz;
+    orient=arg1.graphics.flip;
+    tg='['+arg1.graphics.exprs(1)+']';
+    if orient then
+      xx=orig(1)+[0 0 0;0 1/2 3/4;3/4 7/8 1;1 7/8 3/4;3/4 1/2 0]'*sz(1);
+      yy=orig(2)+[0 1/2 1;1 1 1;1 3/4 1/2;1/2 1/4 0;0 0 0]'*sz(2);
+      x1=0
+    else
+      xx=orig(1)+[0 1/8 1/4;1/4 1/2 1;1 1 1;1 1/2 1/4;1/4 1/8 0]'*sz(1);
+      yy=orig(2)+[1/2 3/4 1 ;1 1 1;1 1/2 0;0 0 0;0 1/4 1/2]'*sz(2);
+      x1=0
+    end
+    xpolys(xx,yy)
+    xstringb(orig(1)+x1*sz(1),orig(2),tg,(1-x1)*sz(1),sz(2));
+
+    xf=60
+    yf=40
+    nin=0;nout=1
+
+      // set port shape
+      out=[0   -1/14
+          1/7 -1/14
+          1/7 1/14
+          0   1/14
+          0   -1/14]*diag([xf,yf])
+      in= [-1/7  -1/14
+          0     -1/14
+          0      1/14
+          -1/7   1/14
+          -1/7  -1/14]*diag([xf,yf])
+      dy=sz(2)/(nout+1)
+       xset('pattern',default_color(1))
+    if orient then  //standard orientation
+      for k=1:nout
+       xpoly(out(:,1)+ones(5,1)*(orig(1)+sz(1)),..
+              out(:,2)+ones(5,1)*(orig(2)+sz(2)-dy*k),"lines",1)
+      end
+    else //tilded orientation
+      for k=1:nout
+       xpoly(out(:,1)+ones(5,1)*orig(1)-1/7*xf,..
+              out(:,2)+ones(5,1)*(orig(2)+sz(2)-dy*k),"lines",1)
+      end
+    end
+    xset('pattern',pat)
+        //** ------- Identification ---------------------------
+    ident = o.graphics.id
+    gh_axes = gca(); //** get the Axes proprieties 
+  
+    // draw Identification
+    if ident <> []& ident <> ''  then
+  
+      //** Save font state  
+      axes_font_style = gh_axes.font_style ;
+      axes_font_size  = gh_axes.font_size  ;
+      //** axes_font_color = gh_axes.font_color ; //** optional
+  
+        gh_axes.font_style = options.ID(1)(1) ; 
+        gh_axes.font_size  = options.ID(1)(2) ;
+        //** font color not yet used 
+        rectangle = xstringl(orig(1), orig(2), ident) ;
+        w = max(rectangle(3), sz(1)) ;
+        h = rectangle(4) * 1.3 ;
+        xstringb(orig(1) + sz(1) / 2 - w / 2, orig(2) - h , ident , w, h) ;
+  
+     //** Restore font state 
+     gh_axes.font_style = axes_font_style ;
+     gh_axes.font_size  = axes_font_size  ;
+     //** gh_axes.font_color = axes_font_color ; //** optional
+
+    end
+  //** ----- Identification End -----------------------------
+
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,tag,exprs]=getvalue('Set parameters',..
+               ['Tag'],..
+                   list('str',-1),exprs)
+      if ~ok then break,end
+      if ok then 
+         if model.opar<>list(tag) then needcompile=4;y=needcompile,end
+        graphics.exprs=exprs;
+        model.opar=list(tag)
+        x.model=model
+        x.graphics=graphics
+        break
+      end
+    end
+   needcompile=resume(needcompile)
+   case 'define' then
+    model=scicos_model()
+    model.sim='frommo'
+    model.in=[]
+    model.in2=[]
+    model.intyp=1
+    model.out=-1
+    model.out2=-2
+    model.outtyp=-1
+    model.ipar=[]
+    model.opar=list('A')
+    model.blocktype='c'
+    model.dep_ut=[%f %f]
+    mo=modelica()
+    mo.model='frommo'
+    mo.outputs='n'
+    exprs=['A']
+    
+    gr_i='';
+    x=standard_define([1.5 1.5],model,exprs,gr_i)
+    x.graphics.out_implicit=['I']
+  end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/GOTO.sci b/scilab/modules/scicos_blocks/macros/Branching/GOTO.sci
new file mode 100644 (file)
index 0000000..93565ea
--- /dev/null
@@ -0,0 +1,173 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=GOTO(job,arg1,arg2)
+  x=[];y=[];typ=[]
+  select job
+   case 'plot' then
+    pat=xget('pattern'); xset('pattern',default_color(0))
+    orig=arg1.graphics.orig;
+    sz=arg1.graphics.sz;
+    orient=arg1.graphics.flip;
+    tg=arg1.graphics.exprs(1);
+    forma=['[','{','',']','}','']
+    tg=forma(evstr(arg1.graphics.exprs(2)))+tg+forma(evstr(arg1.graphics.exprs(2))+3)
+    if orient then
+      xx=orig(1)+[0 1/8 1/4;1/4 1/2 1;1 1 1;1 1/2 1/4;1/4 1/8 0]'*sz(1);
+      yy=orig(2)+[1/2 3/4 1 ;1 1 1;1 1/2 0;0 0 0;0 1/4 1/2]'*sz(2);
+      x1=0
+    else
+      xx=orig(1)+[0 0 0;0 1/2 3/4;3/4 7/8 1;1 7/8 3/4;3/4 1/2 0]'*sz(1);
+      yy=orig(2)+[0 1/2 1;1 1 1;1 3/4 1/2;1/2 1/4 0;0 0 0]'*sz(2);
+      x1=1/4
+    end
+    xpolys(xx,yy)
+    xstringb(orig(1)+x1*sz(1),orig(2),tg,(1-x1)*sz(1),sz(2));
+
+    xf=60
+    yf=40
+    nin=1;nout=0
+
+    if orient then  //standard orientation
+                   
+      // set port shape
+      out=[0  -1/14
+          1/7 0
+          0   1/14
+          0  -1/14]*diag([xf,yf])
+      in= [-1/7  -1/14
+          0    0
+          -1/7   1/14
+          -1/7  -1/14]*diag([xf,yf])
+      dy=sz(2)/(nout+1)
+      xset('pattern',default_color(1))
+      for k=1:nout
+       xfpoly(out(:,1)+ones(4,1)*(orig(1)+sz(1)),..
+              out(:,2)+ones(4,1)*(orig(2)+sz(2)-dy*k),1)
+      end
+
+      dy=sz(2)/(nin+1)
+      for k=1:nin
+       xfpoly(in(:,1)+ones(4,1)*orig(1),..
+              in(:,2)+ones(4,1)*(orig(2)+sz(2)-dy*k),1)
+      end
+    else //tilded orientation
+      out=[0  -1/14
+          -1/7 0
+          0   1/14
+          0  -1/14]*diag([xf,yf])
+      in= [1/7  -1/14
+          0    0
+          1/7   1/14
+          1/7  -1/14]*diag([xf,yf])
+      dy=sz(2)/(nout+1)
+      xset('pattern',default_color(1))
+      for k=1:nout
+       xfpoly(out(:,1)+ones(4,1)*orig(1)-1,..
+              out(:,2)+ones(4,1)*(orig(2)+sz(2)-dy*k),1)
+      end
+      dy=sz(2)/(nin+1)
+      for k=1:nin
+       xfpoly(in(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
+              in(:,2)+ones(4,1)*(orig(2)+sz(2)-dy*k),1)
+      end
+    end
+    xset('pattern',pat)
+        //** ------- Identification ---------------------------
+    ident = o.graphics.id
+    gh_axes = gca(); //** get the Axes proprieties 
+  
+    // draw Identification
+    if ident <> []& ident <> ''  then
+  
+      //** Save font state  
+      axes_font_style = gh_axes.font_style ;
+      axes_font_size  = gh_axes.font_size  ;
+      //** axes_font_color = gh_axes.font_color ; //** optional
+  
+        gh_axes.font_style = options.ID(1)(1) ; 
+        gh_axes.font_size  = options.ID(1)(2) ;
+        //** font color not yet used 
+        rectangle = xstringl(orig(1), orig(2), ident) ;
+        w = max(rectangle(3), sz(1)) ;
+        h = rectangle(4) * 1.3 ;
+        xstringb(orig(1) + sz(1) / 2 - w / 2, orig(2) - h , ident , w, h) ;
+  
+     //** Restore font state 
+     gh_axes.font_style = axes_font_style ;
+     gh_axes.font_size  = axes_font_size  ;
+     //** gh_axes.font_color = axes_font_color ; //** optional
+
+    end
+  //** ----- Identification End -----------------------------
+
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,tag,tagvis,exprs]=getvalue('Set parameters',..
+               ['Tag';'Tag Visibility(1=Local 2=scoped 3= global)'],..
+                   list('str',-1,'vec',1),exprs)
+      if ~ok then break,end
+      tagvis=int(tagvis)
+      if ((tagvis<1)|(tagvis>3)) then
+          message('Tag Visibility must be between 1 and 3');ok=%f;
+      end
+      if ok then 
+        if ((model.ipar<>tagvis)|(model.opar<>list(tag))) then needcompile=4;y=needcompile,end
+        graphics.exprs=exprs;
+        model.opar=list(tag)
+        model.ipar=tagvis
+        x.model=model
+        x.graphics=graphics
+        arg1=x
+        break
+      end
+    end
+   needcompile=resume(needcompile)
+   case 'define' then
+    model=scicos_model()
+    model.sim='goto'
+    model.in=-1
+    model.in2=-2
+    model.intyp=-1
+    model.out=[]
+    model.out2=[]
+    model.outtyp=1
+    model.ipar=int(1)
+    model.opar=list('A')
+    model.blocktype='c'
+    model.dep_ut=[%f %f]
+    
+    exprs=['A';sci2exp(1)]
+    
+    gr_i='';
+    x=standard_define([1.5 1.5],model,exprs,gr_i)
+    x.graphics.id="Goto"
+  end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/GOTOMO.sci b/scilab/modules/scicos_blocks/macros/Branching/GOTOMO.sci
new file mode 100644 (file)
index 0000000..18b3524
--- /dev/null
@@ -0,0 +1,155 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=GOTOMO(job,arg1,arg2)
+  x=[];y=[];typ=[]
+  select job
+   case 'plot' then
+    pat=xget('pattern'); xset('pattern',default_color(0))
+    orig=arg1.graphics.orig;
+    sz=arg1.graphics.sz;
+    orient=arg1.graphics.flip;
+    tg=arg1.graphics.exprs(1);
+    forma=['[','{','',']','}','']
+    tg=forma(evstr(arg1.graphics.exprs(2)))+tg+forma(evstr(arg1.graphics.exprs(2))+3)
+    if orient then
+      xx=orig(1)+[0 1/8 1/4;1/4 1/2 1;1 1 1;1 1/2 1/4;1/4 1/8 0]'*sz(1);
+      yy=orig(2)+[1/2 3/4 1 ;1 1 1;1 1/2 0;0 0 0;0 1/4 1/2]'*sz(2);
+      x1=0
+    else
+      xx=orig(1)+[0 0 0;0 1/2 3/4;3/4 7/8 1;1 7/8 3/4;3/4 1/2 0]'*sz(1);
+      yy=orig(2)+[0 1/2 1;1 1 1;1 3/4 1/2;1/2 1/4 0;0 0 0]'*sz(2);
+      x1=0
+    end
+    xpolys(xx,yy)
+    xstringb(orig(1)+x1*sz(1),orig(2),tg,(1-x1)*sz(1),sz(2));
+
+    xf=60
+    yf=40
+    nin=1;nout=0
+                   
+      // set port shape
+      out=[0   -1/14
+          1/7 -1/14
+          1/7 1/14
+          0   1/14
+          0   -1/14]*diag([xf,yf])
+      in= [-1/7  -1/14
+          0     -1/14
+          0      1/14
+          -1/7   1/14
+          -1/7  -1/14]*diag([xf,yf])
+      dy=sz(2)/(nin+1)
+      xset('pattern',default_color(1))
+   if orient then  //standard orientation
+      for k=1:nin
+       xfpoly(in(:,1)+ones(5,1)*orig(1),..
+              in(:,2)+ones(5,1)*(orig(2)+sz(2)-dy*k),1)
+      end
+    else //tilded orientation
+      for k=1:nin
+       xfpoly(in(:,1)+ones(5,1)*(orig(1)+sz(1)+1/7*xf),..
+              in(:,2)+ones(5,1)*(orig(2)+sz(2)-dy*k),1)
+      end
+    end
+    xset('pattern',pat)
+        //** ------- Identification ---------------------------
+    ident = o.graphics.id
+    gh_axes = gca(); //** get the Axes proprieties 
+  
+    // draw Identification
+    if ident <> []& ident <> ''  then
+  
+      //** Save font state  
+      axes_font_style = gh_axes.font_style ;
+      axes_font_size  = gh_axes.font_size  ;
+      //** axes_font_color = gh_axes.font_color ; //** optional
+  
+        gh_axes.font_style = options.ID(1)(1) ; 
+        gh_axes.font_size  = options.ID(1)(2) ;
+        //** font color not yet used 
+        rectangle = xstringl(orig(1), orig(2), ident) ;
+        w = max(rectangle(3), sz(1)) ;
+        h = rectangle(4) * 1.3 ;
+        xstringb(orig(1) + sz(1) / 2 - w / 2, orig(2) - h , ident , w, h) ;
+  
+     //** Restore font state 
+     gh_axes.font_style = axes_font_style ;
+     gh_axes.font_size  = axes_font_size  ;
+     //** gh_axes.font_color = axes_font_color ; //** optional
+
+    end
+  //** ----- Identification End -----------------------------
+
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,tag,tagvis,exprs]=getvalue('Set parameters',..
+               ['Tag';'Tag Visibility(1=Local 2=scoped 3= global)'],..
+                   list('str',-1,'vec',1),exprs)
+      if ~ok then break,end
+      tagvis=int(tagvis)
+      if ((tagvis<1)|(tagvis>3)) then
+          message('Tag Visibility must be between 1 and 3');ok=%f;
+      end
+      if ok then 
+        if ((model.ipar<>tagvis)|(model.opar<>list(tag))) then needcompile=4;y=needcompile,end
+        graphics.exprs=exprs;
+        model.opar=list(tag)
+        model.ipar=tagvis
+        x.model=model
+        x.graphics=graphics
+        arg1=x
+        break
+      end
+    end
+   needcompile=resume(needcompile)
+   case 'define' then
+    model=scicos_model()
+    model.sim='gotomo'
+    model.in=-1
+    model.in2=-2
+    model.intyp=[]
+    model.out=[]
+    model.out2=[]
+    model.outtyp=1
+    model.ipar=int(1)
+    model.opar=list('A')
+    model.blocktype='c'
+    model.dep_ut=[%f %f]
+    mo=modelica()
+    mo.model='gotomo'
+    mo.inputs='p'
+    exprs=['A';sci2exp(1)]
+    
+    gr_i='';
+    x=standard_define([1.5 1.5],model,exprs,gr_i)
+    x.graphics.in_implicit=['I']
+  end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/GotoTagVisibility.sci b/scilab/modules/scicos_blocks/macros/Branching/GotoTagVisibility.sci
new file mode 100644 (file)
index 0000000..2008ba5
--- /dev/null
@@ -0,0 +1,70 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=GotoTagVisibility(job,arg1,arg2)
+  x=[];y=[],typ=[]
+  select job
+   case 'plot' then
+    standard_draw(arg1)
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,tag,exprs]=getvalue('Set parameters',..
+         ['GotoTag'],..
+         list('str',-1),exprs)
+      if ~ok then break,end
+      if ok then
+       if model.opar<>list(tag) then needcompile=4;y=needcompile,end
+       graphics.exprs=exprs;
+       model.opar=list(tag);
+       x.graphics=graphics;x.model=model;
+       break
+      end
+    end
+   needcompile=resume(needcompile)
+   case 'define' then
+   model=scicos_model()
+   model.sim='gototagvisibility'
+   model.in=[]
+   model.in2=[]
+   model.out=[]
+   model.out2=[]
+   model.evtin=[]
+   model.intyp=1
+   model.outtyp=1
+   model.opar=list('A');
+   model.blocktype='c'
+   model.firing=%f
+   model.dep_ut=[%f %f]
+   exprs='A'
+   gr_i=['xstringb(orig(1),orig(2),[''{''+arg1.graphics.exprs(1)+''}''],sz(1),sz(2),''fill'');']
+   x=standard_define([2 2],model,exprs,gr_i)
+   x.graphics.id=["Goto Tag";"Visibility"]
+  end
+endfunction
\ No newline at end of file
diff --git a/scilab/modules/scicos_blocks/macros/Branching/GotoTagVisibilityMO.sci b/scilab/modules/scicos_blocks/macros/Branching/GotoTagVisibilityMO.sci
new file mode 100644 (file)
index 0000000..2ddad3b
--- /dev/null
@@ -0,0 +1,82 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=GotoTagVisibilityMO(job,arg1,arg2)
+  x=[];y=[],typ=[]
+  select job
+   case 'plot' then
+    standard_draw(arg1)
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,tag,exprs]=getvalue('Set parameters',..
+         ['GotoTag'],..
+         list('str',-1),exprs)
+      if ~ok then break,end
+      if ok then
+       if model.opar<>list(tag) then needcompile=4;y=needcompile,end
+       graphics.exprs=exprs;
+       model.opar=list(tag);
+       x.graphics=graphics;x.model=model;
+       break
+      end
+    end
+   needcompile=resume(needcompile)
+   case 'define' then
+   model=scicos_model()
+   model.sim='gototagvisibilitymo'
+   model.in=[]
+   model.in2=[]
+   model.out=[]
+   model.out2=[]
+   model.evtin=[]
+   model.intyp=1
+   model.outtyp=1
+   model.opar=list('A');
+   model.blocktype='c'
+   model.firing=%f
+   model.dep_ut=[%f %f]
+   exprs='A'
+   gr_i=['xstringb(orig(1),orig(2),[''{''+arg1.graphics.exprs(1)+''}''],sz(1),sz(2),''fill'');';
+         'wd=xget(''wdim'').*[1.016,1.12];';
+              'thick=xget(''thickness'');xset(''thickness'',2);';
+              'p=wd(2)/wd(1);p=1;';
+              'xarcs([orig(1)+0.05*sz(1);';
+              'orig(2)+0.95*sz(2);';
+                 '0.9*sz(1)*p;';
+                 '0.9*sz(2);';
+                 '0;';
+              '360*64],scs_color(3));';
+              'xset(''thickness'',thick)']
+ //        'g=gca();'
+    //     'g.children.font_foreground=5']
+   x=standard_define([2 2],model,exprs,gr_i)
+   x.graphics.id=["Goto Tag";"Visibility"]
+  end
+endfunction
\ No newline at end of file
diff --git a/scilab/modules/scicos_blocks/macros/Branching/ISELECT_f.sci b/scilab/modules/scicos_blocks/macros/Branching/ISELECT_f.sci
new file mode 100644 (file)
index 0000000..f1ed44b
--- /dev/null
@@ -0,0 +1,71 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=ISELECT_f(job,arg1,arg2)
+x=[];y=[];typ=[]
+select job
+case 'plot' then
+  standard_draw(arg1)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,nout,z0,exprs]=getvalue('Set parameters',..
+       ['number of outputs';'initial connected output'],..
+       list('vec',1,'vec',1),exprs)
+    if ~ok then break,end
+    if z0>nout|z0<=0 then
+      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 then
+       graphics.exprs=exprs;
+       model.dstate=z0-1,
+       x.graphics=graphics;x.model=model
+       break
+      end
+    end
+  end
+case 'define' then
+  z0=0
+  out=[-1;-1]
+  nout=2
+  model=scicos_model()
+  model.sim=list('selector',2)
+  model.in=-1
+  model.out=out
+  model.evtin=ones(out)
+  model.dstate=z0
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+
+  exprs=[string(nout);string(z0+1)]
+  gr_i=['xstringb(orig(1),orig(2),''Selector'',sz(1),sz(2),''fill'');']
+  x=standard_define([2 2],model,exprs,gr_i)
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/ISELECT_m.sci b/scilab/modules/scicos_blocks/macros/Branching/ISELECT_m.sci
new file mode 100644 (file)
index 0000000..539c115
--- /dev/null
@@ -0,0 +1,87 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=ISELECT_m(job,arg1,arg2)
+x=[];y=[];typ=[]
+select job
+case 'plot' then
+  standard_draw(arg1)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,typ,nout,z0,exprs]=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 then break,end
+    if z0>nout|z0<=0 then
+      message('initial connected input is not a valid input port number')
+    elseif ((typ<1)|(typ>8)) message("Datatype is not supported");ok=%f;
+    else
+      it=typ
+      ot=typ*ones(1,nout)
+      if ok then
+      out=[-ones(nout,1) -2*ones(nout,1)]
+      in=[-1 -2]
+      [model,graphics,ok]=set_io(model,graphics,list(in,it),list(out,ot),ones(nout,1),[])
+      if ok then
+       graphics.exprs=exprs;
+       model.dstate=z0,
+       x.graphics=graphics;x.model=model
+       break
+      end
+      end
+    end
+  end
+case 'define' then
+  z0=1
+  nout=2
+
+  model=scicos_model()
+  model.sim=list('selector_m',4)
+  model.out=[-1;-1]
+  model.out2=[-2;-2]
+  model.outtyp=1
+  model.in=-1
+  model.in2=-2
+  model.intyp=1
+  model.evtout=[]
+  model.state=[]
+  model.rpar=[]
+  model.ipar=[] 
+  model.firing=[]
+  model.evtin=ones(nout,1)
+  model.dstate=z0
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  
+  exprs=[sci2exp(1);sci2exp(nout);sci2exp(z0)]
+  gr_i=['xstringb(orig(1),orig(2),''Selector'',sz(1),sz(2),''fill'');']
+  x=standard_define([2 2],model,exprs,gr_i)
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/MUX.sci b/scilab/modules/scicos_blocks/macros/Branching/MUX.sci
new file mode 100644 (file)
index 0000000..93ee4f4
--- /dev/null
@@ -0,0 +1,80 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=MUX(job,arg1,arg2)
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  standard_draw(arg1)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,in,exprs]=getvalue('Set MUX block parameters',..
+       'number of input ports or vector of sizes',list('vec',-1),exprs)
+    if ~ok then break,end
+    if size(in,'*')==1 then
+      if in<2|in>31 then
+       message('Block must have at least two input ports and at most 31')
+       ok=%f
+      else
+       [model,graphics,ok]=check_io(model,graphics,-[1:in]',0,[],[])
+      end
+    else
+      if size(in,'*')<2| or(in==0)|size(in,'*')>31 then
+       message(['Block must have at least two input ports';
+                'and at most 31. Size 0 is not allowed. '])
+       ok=%f
+      else
+       if min(in)<0 then nout=0,else nout=sum(in),end
+       [model,graphics,ok]=check_io(model,graphics,in(:),nout,[],[])
+       if ok then in=size(in,'*'),end
+      end
+    end
+    if ok then
+      graphics.exprs=exprs;model.ipar=in
+      x.graphics=graphics;x.model=model
+      break
+    end
+  end
+ case 'define' then
+  in=2
+  model=scicos_model()
+  model.sim=list('multiplex',4)
+  model.in=-[1:in]'
+  model.out=0
+  model.ipar=in
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+
+  exprs=string(in)
+  gr_i=' ' //'xstringb(orig(1),orig(2),''Mux'',sz(1),sz(2),''fill'')'
+  x=standard_define([.5 2],model,exprs,gr_i)
+  x.graphics.id="Mux"
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/MUX_f.sci b/scilab/modules/scicos_blocks/macros/Branching/MUX_f.sci
new file mode 100644 (file)
index 0000000..7b20319
--- /dev/null
@@ -0,0 +1,79 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=MUX_f(job,arg1,arg2)
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  standard_draw(arg1)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,in,exprs]=getvalue('Set MUX block parameters',..
+       'number of input ports or vector of sizes',list('vec',-1),exprs)
+    if ~ok then break,end
+    if size(in,'*')==1 then
+      if in<2|in>8 then
+       message('Block must have at least two input ports and at most eight')
+       ok=%f
+      else
+       [model,graphics,ok]=check_io(model,graphics,-[1:in]',0,[],[])
+      end
+    else
+      if size(in,'*')<2| size(in,'*')>8|or(in==0) then
+       message(['Block must have at least two input ports';
+                'and at most eight, and size 0 is not allowed. '])
+       ok=%f
+      else
+       if min(in)<0 then nout=0,else nout=sum(in),end
+       [model,graphics,ok]=check_io(model,graphics,in(:),nout,[],[])
+       if ok then in=size(in,'*'),end
+      end
+    end
+    if ok then
+      graphics.exprs=exprs;model.ipar=in
+      x.graphics=graphics;x.model=model
+      break
+    end
+  end
+ case 'define' then
+  in=2
+  model=scicos_model()
+  model.sim=list('mux',1)
+  model.in=-[1:in]'
+  model.out=0
+  model.ipar=in
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+
+  exprs=string(in)
+  gr_i='xstringb(orig(1),orig(2),''Mux'',sz(1),sz(2),''fill'')'
+  x=standard_define([2 2],model,exprs,gr_i)
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/M_SWITCH.sci b/scilab/modules/scicos_blocks/macros/Branching/M_SWITCH.sci
new file mode 100644 (file)
index 0000000..d279744
--- /dev/null
@@ -0,0 +1,81 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=M_SWITCH(job,arg1,arg2)
+x=[];y=[];typ=[]
+select job
+case 'plot' then
+  standard_draw(arg1)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,nin,base,rule,exprs]=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 then break,end
+    nin=int(nin);base=int(base);
+    if nin<2 then
+      message('Number of inputs must be >=2 ')
+     elseif ~((base==1)|(base==0)) then
+      message('base indexing must be 1 or 0')
+    elseif ~((rule==1)|(rule==0)|(rule==2)|(rule==3)) then
+      message('incorrect rounding rule')
+    else
+      [model,graphics,ok]=check_io(model,graphics,[1;-ones(nin,1)],-1,[],[])
+      if ok then
+       graphics.exprs=exprs;
+       model.ipar=[base;rule],
+       x.graphics=graphics;x.model=model
+       break
+      end
+    end
+  end
+case 'define' then
+  in=[1;-1;-1]
+  ipar=[1;3]
+  nin=2
+  
+  model=scicos_model()
+  model.sim=list('mswitch',4)
+  model.in=in
+  model.out=-1
+  model.ipar=ipar
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  
+  exprs=[string(nin);string(ipar)]
+  
+  gr_i=['d=sz(2)/(1+evstr(arg1.graphics.exprs(1)))';
+   'xsegs([orig(1),orig(1)+sz(1)],[orig(2)+sz(2)-d,orig(2)+sz(2)-d])';
+  'xstringb(orig(1),orig(2)+sz(2)-d,''control'',sz(1),d,''fill'')';
+  'xstringb(orig(1),orig(2),[''M_Port'';''switch''],sz(1),sz(2)-d,''fill'');']
+  x=standard_define([2 2],model,exprs,gr_i)
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/NRMSOM_f.sci b/scilab/modules/scicos_blocks/macros/Branching/NRMSOM_f.sci
new file mode 100644 (file)
index 0000000..3393f7f
--- /dev/null
@@ -0,0 +1,62 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=NRMSOM_f(job,arg1,arg2)
+x=[];y=[];typ=[]
+select job
+case 'plot' then
+  standard_draw(arg1)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,nin,exprs]=getvalue('Set parameters',..
+       ['number of inputs'],list('vec',1),exprs)
+    if ~ok then break,end
+    [model,graphics,ok]=check_io(model,graphics,-ones(nin,1),-1,[],[])
+    if ok then
+      graphics.exprs=exprs;
+      x.graphics=graphics;x.model=model
+      break;
+    end
+  end
+case 'define' then
+  in=[-1;-1]
+  nin=2
+  model=scicos_model()
+  model.sim='junk'
+  model.in=in
+  model.out=-1
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  
+  exprs=[string(nin)]
+  gr_i=' '
+  x=standard_define([.2 2],model,exprs,gr_i)
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/RELAY_f.sci b/scilab/modules/scicos_blocks/macros/Branching/RELAY_f.sci
new file mode 100644 (file)
index 0000000..b301191
--- /dev/null
@@ -0,0 +1,72 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=RELAY_f(job,arg1,arg2)
+x=[];y=[];typ=[]
+select job
+case 'plot' then
+  standard_draw(arg1)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;ipar=model.ipar
+  while %t do
+    [ok,nin,z0,exprs]=getvalue('Set parameters',..
+       ['number of inputs';'initial connected input'],..
+       list('vec',1,'vec',1),exprs)
+    if ~ok then break,end
+    if z0>nin|z0<=0 then
+      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 then
+       graphics.exprs=exprs;
+       model.dstate=z0-1
+       x.graphics=graphics;x.model=model
+       break
+      end
+    end
+  end
+case 'define' then
+  i0=0
+  in=[-1;-1]
+  nin=2
+  model=scicos_model()
+  model.sim=list('relay',2)
+  model.in=in
+  model.out=-1
+  model.evtin=ones(in)
+  model.dstate=i0
+  model.blocktype='c'
+  model.firing=[]
+  model.dep_ut=[%t %t]
+
+  exprs=[string(nin);string(i0+1)]
+  gr_i=['xstringb(orig(1),orig(2),''Relay'',sz(1),sz(2),''fill'');']
+  x=standard_define([2 2],model,exprs,gr_i)
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/SCALAR2VECTOR.sci b/scilab/modules/scicos_blocks/macros/Branching/SCALAR2VECTOR.sci
new file mode 100644 (file)
index 0000000..7cb4fbf
--- /dev/null
@@ -0,0 +1,72 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=SCALAR2VECTOR(job,arg1,arg2)
+  x=[];y=[];typ=[]
+  select job
+   case 'plot' then
+    standard_draw(arg1)
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,nout,exprs]=..
+         getvalue('Set block parameters',..
+                  ['size of output (-1: if don''t know)'],..
+         list('vec',1),exprs)
+      if ~ok then break,end
+      nout=int(nout)
+      if(nout<>-1 & (nout<=0)) then
+       message('size of output must be -1 or >0')
+       ok=%f
+      end
+      if ok then
+       [model,graphics,ok]=check_io(model,graphics,[1],nout,[],[])
+      end         
+      if ok then
+       graphics.exprs=exprs;// Correction ED le 24/11/04
+       x.graphics=graphics;x.model=model
+       break
+      end
+    end
+   case 'define' then
+    nout=-1
+    model=scicos_model()
+    model.sim=list('scalar2vector',4)
+    model.out=nout
+    model.in=1
+    model.blocktype='c'
+    model.dep_ut=[%t %f]
+    
+    exprs=[string([nout])]
+    gr_i=['txt=[''Scalar'';''  to '';''vector''];';
+         'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'')']
+    
+    x=standard_define([2 3],model,exprs,gr_i)
+  end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/SELECT_f.sci b/scilab/modules/scicos_blocks/macros/Branching/SELECT_f.sci
new file mode 100644 (file)
index 0000000..3175a1c
--- /dev/null
@@ -0,0 +1,72 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=SELECT_f(job,arg1,arg2)
+x=[];y=[];typ=[]
+select job
+case 'plot' then
+  standard_draw(arg1)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,nin,z0,exprs]=getvalue('Set parameters',..
+       ['number of inputs';'initial connected input'],..
+       list('vec',1,'vec',1),exprs)
+    if ~ok then break,end
+    if z0>nin|z0<=0 then
+      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 then
+       graphics.exprs=exprs;
+       model.dstate=z0-1,
+       x.graphics=graphics;x.model=model
+       break
+      end
+    end
+  end
+case 'define' then
+  z0=0
+  in=[-1;-1]
+  nin=2
+
+  model=scicos_model()
+  model.sim=list('selector',2)
+  model.in=in
+  model.out=-1
+  model.evtin=ones(in)
+  model.dstate=z0
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  
+  exprs=[string(nin);string(z0+1)]
+  gr_i=['xstringb(orig(1),orig(2),''Selector'',sz(1),sz(2),''fill'');']
+  x=standard_define([2 2],model,exprs,gr_i)
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/SELECT_m.sci b/scilab/modules/scicos_blocks/macros/Branching/SELECT_m.sci
new file mode 100644 (file)
index 0000000..aaaa616
--- /dev/null
@@ -0,0 +1,87 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=SELECT_m(job,arg1,arg2)
+x=[];y=[];typ=[]
+select job
+case 'plot' then
+  standard_draw(arg1)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,typ,nin,z0,exprs]=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 then break,end
+    if z0>nin|z0<=0 then
+      message('initial connected input is not a valid input port number')
+    elseif ((typ<1)|(typ>8)) message("Datatype is not supported");ok=%f;
+    else
+      it=typ*ones(1,nin)
+      ot=typ
+      if ok then
+      in=[-ones(nin,1) -2*ones(nin,1)]
+      out=[-1 -2]
+      [model,graphics,ok]=set_io(model,graphics,list(in,it),list(out,ot),ones(nin,1),[])
+      if ok then
+       graphics.exprs=exprs;
+       model.dstate=z0,
+       x.graphics=graphics;x.model=model
+       break
+      end
+      end
+    end
+  end
+case 'define' then
+  z0=1
+  nin=2
+
+  model=scicos_model()
+  model.sim=list('selector_m',4)
+  model.in=[-1;-1]
+  model.in2=[-2;-2]
+  model.intyp=1
+  model.out=-1
+  model.out2=-2
+  model.outtyp=1
+  model.evtout=[]
+  model.state=[]
+  model.rpar=[]
+  model.ipar=[] 
+  model.firing=[]
+  model.evtin=ones(nin,1)
+  model.dstate=z0
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  
+  exprs=[sci2exp(1);sci2exp(nin);sci2exp(z0)]
+  gr_i=['xstringb(orig(1),orig(2),''Selector'',sz(1),sz(2),''fill'');']
+  x=standard_define([2 2],model,exprs,gr_i)
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/SWITCH2.sci b/scilab/modules/scicos_blocks/macros/Branching/SWITCH2.sci
new file mode 100644 (file)
index 0000000..803d332
--- /dev/null
@@ -0,0 +1,81 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=SWITCH2(job,arg1,arg2)
+  x=[];y=[];typ=[]
+  select job
+   case 'plot' then
+    standard_draw(arg1)
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,rule,thra,nzz,exprs]=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 then break,end
+      rule=int(rule);
+      if (rule<0) then rule=0, end
+      if (rule>2) then rule=2, end
+      graphics.exprs=exprs;
+      model.ipar=rule
+      model.rpar=thra
+      if nzz<>0 then 
+       model.nmode=1
+       model.nzcross=1
+      else
+       model.nmode=0
+       model.nzcross=0
+      end
+      x.graphics=graphics;x.model=model
+      break
+    end
+   case 'define' then
+    in=[-1;1;-1]
+    ipar=[0] // rule
+    nzz=1
+    rpar=0
+    
+    model=scicos_model()
+    model.sim=list('switch2',4)
+    model.in=in
+    model.out=-1
+    model.ipar=ipar
+    model.rpar=rpar
+    model.nzcross=nzz
+    model.nmode=1
+    model.blocktype='c'
+    model.dep_ut=[%t %f]
+    
+    exprs=[string(ipar);string(rpar);string(nzz)]
+    
+    gr_i=['xstringb(orig(1),orig(2),[''switch''],sz(1),sz(2),''fill'');']
+    x=standard_define([2 2],model,exprs,gr_i)
+  end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/SWITCH2_m.sci b/scilab/modules/scicos_blocks/macros/Branching/SWITCH2_m.sci
new file mode 100644 (file)
index 0000000..290744f
--- /dev/null
@@ -0,0 +1,95 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=SWITCH2_m(job,arg1,arg2)
+  x=[];y=[];typ=[]
+  select job
+   case 'plot' then
+    standard_draw(arg1)
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %t do
+      [ok,ot,rule,thra,nzz,exprs]=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 then break,end
+      rule=int(rule);
+      if (rule<0) then rule=0, end
+      if (rule>2) then rule=2, end
+      graphics.exprs=exprs;
+      model.ipar=rule
+      model.rpar=thra
+      if nzz<>0 then 
+       model.nmode=1
+       model.nzcross=1
+      else
+       model.nmode=0
+       model.nzcross=0
+      end
+      if ((ot<1)|(ot>8)) message("Datatype is not supported");ok=%f;end
+      if ok then
+       it(1)=ot;
+       it(2)=1;
+       it(3)=ot;
+        in=[model.in model.in2]
+        out=[model.out model.out2]
+        [model,graphics,ok]=set_io(model,graphics,list(in,it),list(out,ot),[],[])
+      end
+      if ok then
+        x.graphics=graphics;x.model=model
+        break
+      end
+    end
+   case 'define' then
+    ipar=[0] // rule
+    nzz=1
+    rpar=0
+    
+    model=scicos_model()
+    model.sim=list('switch2_m',4)
+    model.in=[-1;1;-1]
+    model.in2=[-2;1;-2]
+    model.intyp=1
+    model.out=-1
+    model.out2=-2
+    model.outtyp=1
+    model.ipar=ipar
+    model.rpar=rpar
+    model.nzcross=nzz
+    model.nmode=1
+    model.blocktype='c'
+    model.dep_ut=[%t %f]
+    
+    exprs=[sci2exp(1);string(ipar);string(rpar);string(nzz)]
+    
+    gr_i=['xstringb(orig(1),orig(2),[''switch''],sz(1),sz(2),''fill'');']
+    x=standard_define([2 2],model,exprs,gr_i)
+  end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/SWITCH_f.sci b/scilab/modules/scicos_blocks/macros/Branching/SWITCH_f.sci
new file mode 100644 (file)
index 0000000..9e5646b
--- /dev/null
@@ -0,0 +1,71 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=SWITCH_f(job,arg1,arg2)
+x=[];y=[];typ=[]
+select job
+case 'plot' then
+  standard_draw(arg1)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;ipar=model.ipar
+  while %t do
+    [ok,nin,z0,exprs]=getvalue('Set switch parameters',..
+       ['number of inputs';'connected input'],..
+       list('vec',1,'vec',1),exprs)
+    if ~ok then break,end
+    if z0>nin|z0<=0 then
+      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 then
+       graphics.exprs=exprs;
+       model.ipar=z0-1
+       x.graphics=graphics;x.model=model
+       break
+      end
+    end
+  end
+case 'define' then
+  i0=0
+  in=[-1;-1]
+  nin=2
+  model=scicos_model()
+  model.sim=list('switchn',2)
+  model.in=in
+  model.out=-1
+  model.ipar=i0
+  model.blocktype='c'
+  model.firing=[]
+  model.dep_ut=[%t %t]
+
+  exprs=[string(nin);string(i0+1)]
+  gr_i=['xstringb(orig(1),orig(2),[''switch'';string(model.ipar+1)],sz(1),sz(2),''fill'');']
+  x=standard_define([2 2],model,exprs,gr_i)
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Branching/buildmacros.sce b/scilab/modules/scicos_blocks/macros/Branching/buildmacros.sce
new file mode 100644 (file)
index 0000000..c474bb1
--- /dev/null
@@ -0,0 +1,26 @@
+//  Scicos
+//
+//  Copyright (C) INRIA - Allan Cornet <allan.cornet@inria.fr>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// See the file ../license.txt
+//
+
+SCI=getenv('SCI'); 
+TMPDIR=getenv('TMPDIR');
+//------------------------------------
+genlib('scsbranchinglib','SCI/macros/scicos_blocks/Branching');
+//------------------------------------
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/CCS.mo b/scilab/modules/scicos_blocks/macros/Electrical/CCS.mo
new file mode 100644 (file)
index 0000000..2a8f9af
--- /dev/null
@@ -0,0 +1,28 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model CCS "controlled voltage source" 
+  Pin p, n;
+  Real Iin;
+equation 
+ Iin = n.i;
+ 0 = p.i + n.i;
+end CCS;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/CCS.sci b/scilab/modules/scicos_blocks/macros/Electrical/CCS.sci
new file mode 100644 (file)
index 0000000..7255a01
--- /dev/null
@@ -0,0 +1,255 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+\r
+function [x,y,typ]=CCS(job,arg1,arg2)\r
+// the automatically generated interface block for Modelica CCS.mo model\r
+//   - avec un dialogue de saisie de parametre\r
+x=[];y=[];typ=[];\r
+select job\r
+case 'plot' then\r
+  standard_draw(arg1,%f,CCS_draw_ports)\r
+case 'getinputs' then\r
+  [x,y,typ]=CCS_inputs(arg1)\r
+case 'getoutputs' then\r
+  [x,y,typ]=CCS_outputs(arg1)\r
+case 'getorigin' then\r
+  [x,y]=standard_origin(arg1)\r
+case 'set' then\r
+  x=arg1;\r
+  graphics=arg1.graphics;exprs=graphics.exprs\r
+  model=arg1.model;\r
+x=arg1\r
+ case 'define' then      \r
+ModelName="CCS"\r
+PrametersValue=[]\r
+ParametersName=[]\r
+model=scicos_model()                  \r
+Typein=[];Typeout=[];MI=[];MO=[]       \r
+P=[2,50,1,0; 70,98,2,0;70,2,-2,0]\r
+\r
+PortName=["Iin";"p";"n"]\r
+\r
+for i=1:size(P,'r')                                             \r
+  if P(i,3)==1  then  Typein= [Typein; 'E'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==2  then  Typein= [Typein; 'I'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==-1 then  Typeout=[Typeout;'E'];MO=[MO;PortName(i)];end\r
+  if P(i,3)==-2 then  Typeout=[Typeout;'I'];MO=[MO;PortName(i)];end\r
+end\r
+model=scicos_model()\r
+mo=modelica()\r
+model.sim=ModelName;\r
+mo.inputs=MI;\r
+mo.outputs=MO;\r
+model.rpar=PrametersValue;\r
+mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));\r
+exprs=[]\r
+gr_i=["";"if orient then";"  xpolys(orig(1)+[0.7142857,0.7142857,0.3714286,0.0571429,0.3714286;0.7142857,0.7142857,0.4285714,0.4142857,0.4285714]*sz(1),orig(2)+[0.7,0,0.53,0.49,0.45;0.98,0.3,0.49,0.49,0.49]*sz(2),[2,2,6,6,6])";"  xstring(orig(1)+0.7714286*sz(1),orig(2)+0.75*sz(2),""CCS"")";"  xpolys(orig(1)+[0.7142857,0.7142857,0.7142857;0.7142857,0.6,0.8285714]*sz(1),orig(2)+[0.35,0.63,0.63;0.63,0.55,0.55]*sz(2),[5,5,5])";"  xrects([orig(1)+0.4285714*sz(1); orig(2)+0.7*sz(2);0.5714286*sz(1);0.4*sz(2)],0)";"else";"  xpolys(orig(1)+[0.2857143,0.2857143,0.6285714,0.9428571,0.6285714;0.2857143,0.2857143,0.5714286,0.5857143,0.5714286]*sz(1),orig(2)+[0.7,0,0.53,0.49,0.45;0.98,0.3,0.49,0.49,0.49]*sz(2),[2,2,6,6,6])";"  xstring(orig(1)+sz(1)-(0.7714286*sz(1)),orig(2)+0.75*sz(2),""CCS"")";"  xpolys(orig(1)+[0.2857143,0.2857143,0.2857143;0.2857143,0.4,0.1714286]*sz(1),orig(2)+[0.35,0.63,0.63;0.63,0.55,0.55]*sz(2),[5,5,5])";"  xrects([orig(1)+0*sz(1); orig(2)+0.7*sz(2);0.5714286*sz(1);0.4*sz(2)],0)";"end"]\r
+model.blocktype='c'                              \r
+model.dep_ut=[%f %t]                               \r
+mo.model=ModelName                                 \r
+model.equations=mo                                 \r
+model.in=ones(size(MI,'*'),1)                    \r
+model.out=ones(size(MO,'*'),1)                   \r
+x=standard_define([2.1,3],model,exprs,list(gr_i,0))  \r
+x.graphics.in_implicit=Typein;                     \r
+x.graphics.out_implicit=Typeout;                   \r
+end\r
+endfunction\r
+//=========================\r
+function CCS_draw_ports(o)\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  xset('pattern',default_color(0))\r
+  // draw input/output ports\r
+  //------------------------\r
+  // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]\r
+P=[2,50,1,0; 70,98,2,0;70,2,-2,0]\r
+\r
+  //============================\r
+  // setting the input/ outputs and direction\r
+  // implicit port: if it's located in the right it's output and while,\r
+  // else black\r
+  // explicit ports:\r
+    \r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  xset('pattern',default_color(1))           \r
+  xset('thickness',1)   \r
+   \r
+  if orient then\r
+    for i=1:size(P,'r')      \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if  P(i,3)==-1 then\r
+       outR=out*R;\r
+       xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)           \r
+      end  \r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       in2R=in2*R;                     \r
+       xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)       \r
+      end\r
+      \r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)     \r
+      end\r
+    end  \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-1 then // explicit\r
+       outR=out*R;\r
+       xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+        in2R=in2*R;                    \r
+          xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)\r
+      end\r
+    end          \r
+  end\r
+endfunction \r
+//=========================\r
+function [x,y,typ]=CCS_inputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  //[orig,sz,orient]=o(2)(1:3);\r
+  inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);\r
+  \r
+  // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]\r
+P=[2,50,1,0; 70,98,2,0;70,2,-2,0]\r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[]\r
+  if orient then\r
+    for i=1:size(P,'r')   \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+     R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
\r
+endfunction\r
+//=========================\r
+function [x,y,typ]=CCS_outputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  out=size(o.model.out,1);clkout=size(o.model.evtout,1);\r
+P=[2,50,1,0; 70,98,2,0;70,2,-2,0]\r
\r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[];\r
+  if orient then\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end \r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];            \r
+      end            \r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end\r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
+endfunction\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/CVS.mo b/scilab/modules/scicos_blocks/macros/Electrical/CVS.mo
new file mode 100644 (file)
index 0000000..e35fa44
--- /dev/null
@@ -0,0 +1,28 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model CVS "controlled voltage source" 
+  Pin p, n;
+  Real vin;
+equation 
+ vin = p.v - n.v;
+ 0 = p.i + n.i;
+end CVS;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/CVS.sci b/scilab/modules/scicos_blocks/macros/Electrical/CVS.sci
new file mode 100644 (file)
index 0000000..1f07633
--- /dev/null
@@ -0,0 +1,254 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+\r
+function [x,y,typ]=CVS(job,arg1,arg2)\r
+// the automatically generated interface block for Modelica CVS.mo model\r
+//   - avec un dialogue de saisie de parametre\r
+x=[];y=[];typ=[];\r
+select job\r
+case 'plot' then\r
+  standard_draw(arg1,%f,CVS_draw_ports)\r
+case 'getinputs' then\r
+  [x,y,typ]=CVS_inputs(arg1)\r
+case 'getoutputs' then\r
+  [x,y,typ]=CVS_outputs(arg1)\r
+case 'getorigin' then\r
+  [x,y]=standard_origin(arg1)\r
+case 'set' then\r
+  x=arg1;\r
+  graphics=arg1.graphics;exprs=graphics.exprs\r
+  model=arg1.model;\r
+x=arg1\r
+ case 'define' then      \r
+ModelName="CVS"\r
+PrametersValue=[]\r
+ParametersName=[]\r
+model=scicos_model()                  \r
+Typein=[];Typeout=[];MI=[];MO=[]       \r
+P=[2,50,1,0; 70,98,2,0;70,2,-2,0]\r
+\r
+PortName=["vin";"p";"n"]\r
+for i=1:size(P,'r')                                             \r
+  if P(i,3)==1  then  Typein= [Typein; 'E'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==2  then  Typein= [Typein; 'I'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==-1 then  Typeout=[Typeout;'E'];MO=[MO;PortName(i)];end\r
+  if P(i,3)==-2 then  Typeout=[Typeout;'I'];MO=[MO;PortName(i)];end\r
+end\r
+model=scicos_model()\r
+mo=modelica()\r
+model.sim=ModelName;\r
+mo.inputs=MI;\r
+mo.outputs=MO;\r
+model.rpar=PrametersValue;\r
+mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));\r
+exprs=[]\r
+gr_i=["";"if orient then";"  xpolys(orig(1)+[0.7142857,0.7142857,0.3714286,0.0571429,0.3714286;0.7142857,0.7142857,0.4285714,0.4142857,0.4285714]*sz(1),orig(2)+[0.7,0,0.54,0.5,0.46;0.98,0.3,0.5,0.5,0.5]*sz(2),[2,2,6,6,6])";"  xstring(orig(1)+0.1428571*sz(1),orig(2)+0.75*sz(2),""CVS"")";"  xrects([orig(1)+0.4285714*sz(1); orig(2)+0.7*sz(2);0.5714286*sz(1);0.4*sz(2)],0)";"  xstring(orig(1)+0.7*sz(1),orig(2)+0.55*sz(2),""+"")";"  xstring(orig(1)+0.7*sz(1),orig(2)+0.35*sz(2),""-"")";"else";"  xpolys(orig(1)+[0.2857143,0.2857143,0.6285714,0.9428571,0.6285714;0.2857143,0.2857143,0.5714286,0.5857143,0.5714286]*sz(1),orig(2)+[0.7,0,0.54,0.5,0.46;0.98,0.3,0.5,0.5,0.5]*sz(2),[2,2,6,6,6])";"  xstring(orig(1)+0.6*sz(1),orig(2)+0.75*sz(2),""CVS"")";"  xrects([orig(1)+0*sz(1); orig(2)+0.7*sz(2);0.5714286*sz(1);0.4*sz(2)],0)";"  xstring(orig(1)+sz(1)-(0.7*sz(1)),orig(2)+0.55*sz(2),""+"")";"  xstring(orig(1)+sz(1)-(0.7*sz(1)),orig(2)+0.35*sz(2),""-"")";"end"]\r
+model.blocktype='c'                              \r
+model.dep_ut=[%f %t]                               \r
+mo.model=ModelName                                 \r
+model.equations=mo                                 \r
+model.in=ones(size(MI,'*'),1)                    \r
+model.out=ones(size(MO,'*'),1)                   \r
+x=standard_define([2.1,3],model,exprs,list(gr_i,0))  \r
+x.graphics.in_implicit=Typein;                     \r
+x.graphics.out_implicit=Typeout;                   \r
+end\r
+endfunction\r
+//=========================\r
+function CVS_draw_ports(o)\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  xset('pattern',default_color(0))\r
+  // draw input/output ports\r
+  //------------------------\r
+  // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]\r
+ P=[2,50,1,0; 70,98,2,0;70,2,-2,0]\r
\r
+  //============================\r
+  // setting the input/ outputs and direction\r
+  // implicit port: if it's located in the right it's output and while,\r
+  // else black\r
+  // explicit ports:\r
+    \r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  xset('pattern',default_color(1))           \r
+  xset('thickness',1)   \r
+   \r
+  if orient then\r
+    for i=1:size(P,'r')      \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if  P(i,3)==-1 then\r
+       outR=out*R;\r
+       xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)           \r
+      end  \r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       in2R=in2*R;                     \r
+       xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)       \r
+      end\r
+      \r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)     \r
+      end\r
+    end  \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-1 then // explicit\r
+       outR=out*R;\r
+       xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+        in2R=in2*R;                    \r
+          xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)\r
+      end\r
+    end          \r
+  end\r
+endfunction \r
+//=========================\r
+function [x,y,typ]=CVS_inputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  //[orig,sz,orient]=o(2)(1:3);\r
+  inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);\r
+  \r
+  // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]\r
+ P=[2,50,1,0; 70,98,2,0;70,2,-2,0]\r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[]\r
+  if orient then\r
+    for i=1:size(P,'r')   \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+     R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
\r
+endfunction\r
+//=========================\r
+function [x,y,typ]=CVS_outputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  out=size(o.model.out,1);clkout=size(o.model.evtout,1);\r
+  P=[2,50,1,0; 70,98,2,0;70,2,-2,0]\r
+  \r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[];\r
+  if orient then\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end \r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];            \r
+      end            \r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end\r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
+endfunction\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Capacitor.mo b/scilab/modules/scicos_blocks/macros/Electrical/Capacitor.mo
new file mode 100644 (file)
index 0000000..ae51ea9
--- /dev/null
@@ -0,0 +1,30 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model Capacitor\r
+       Pin p, n;\r
+       Real v;\r
+       parameter Real C "Capacitance";\r
+equation\r
+       C*der(v) = p.i;\r
+       v = p.v - n.v;\r
+       p.i = -n.i;\r
+end Capacitor;\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Capacitor.sci b/scilab/modules/scicos_blocks/macros/Electrical/Capacitor.sci
new file mode 100644 (file)
index 0000000..875ff4e
--- /dev/null
@@ -0,0 +1,90 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=Capacitor(job,arg1,arg2)
+// exemple d'un bloc implicit, 
+//   -  sans entree ni sortie de conditionnement
+//   -  avec une entree et une sortie de type implicit et de dimension 1
+//   - avec un dialogue de saisie de parametre
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  C=arg1.graphics.exprs(1);
+  standard_draw(arg1,%f)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,C,v,exprs]=getvalue('Set Capacitor block parameter',..
+                          ['C (F)','Initial Voltage'],list('vec',1,'vec',1),exprs)
+    if ~ok then break,end
+    model.rpar=C
+    model.equations.parameters(2)=list(C,v)
+    graphics.exprs=exprs
+    x.graphics=graphics;x.model=model
+    break
+  end
+case 'define' then
+  model=scicos_model()
+  C=0.01,v=0
+  model.rpar=[C;v]
+  model.sim='Capacitor'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+  mo.model='Capacitor'
+  mo.inputs='p';
+  mo.outputs='n';
+  mo.parameters=list(['C','v'],list(C,v),[0,1])
+  model.equations=mo
+  model.in=ones(size(mo.inputs,'*'),1)
+  model.out=ones(size(mo.outputs,'*'),1)
+
+  exprs=string([C;v])
+  gr_i=['xset(''thickness'',2)'
+       'xx=orig(1)+[0 1/3 1/3 1/3 ]*sz(1);';
+       'yy=orig(2)+[1/2 1/2 1 0]*sz(2);';
+       'xpoly(xx,yy);'
+       'xsegs(orig(1)+ sz(1)*2/3*[1 1 1 3/2],orig(2)+(sz(2)*1/2)*[2 0 1 1],0);';
+        'if orient then'
+       '  xrects([orig(1)+sz(1)*1/2;orig(2)+sz(2);sz(1)*1/6;sz(2)],scs_color(33));'
+       '  xstring(orig(1)+sz(1)*1/12,orig(2)+sz(2)*3/4,''+'');';
+       '  xstring(orig(1)+sz(1)*7/8,orig(2)+sz(2)*3/4,''-'');';
+        'else'
+       '  xrects([orig(1)+sz(1)*1/3;orig(2)+sz(2);sz(1)*1/6;sz(2)],scs_color(33));'
+       '  xstring(orig(1)+sz(1)*1/12,orig(2)+sz(2)*3/4,''-'');';
+       '  xstring(orig(1)+sz(1)*7/8,orig(2)+sz(2)*3/4,''+'');';
+       'end'
+       'rect=xstringl(0,0,''C=''+C)'
+        'xstring(orig(1)+(sz(1)-rect(3))/2,orig(2)-rect(4)*1.2,''C= ''+C);'
+       ];
+  x=standard_define([2 1.1],model,exprs,list(gr_i,0))
+  x.graphics.in_implicit=['I']
+  x.graphics.out_implicit=['I']
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/ConstantVoltage.mo b/scilab/modules/scicos_blocks/macros/Electrical/ConstantVoltage.mo
new file mode 100644 (file)
index 0000000..59d48fc
--- /dev/null
@@ -0,0 +1,28 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model ConstantVoltage "Source for constant voltage"
+   Pin p, n;
+   parameter Real V = 1 "Volts";
+equation
+   V = p.v - n.v;
+   p.i + n.i = 0;
+end ConstantVoltage;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/ConstantVoltage.sci b/scilab/modules/scicos_blocks/macros/Electrical/ConstantVoltage.sci
new file mode 100644 (file)
index 0000000..07d213e
--- /dev/null
@@ -0,0 +1,77 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=ConstantVoltage(job,arg1,arg2)
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  standard_draw(arg1,%f) 
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,V,exprs]=getvalue('Set ConstantVoltage block parameter',..
+                          'V (volt)',list('vec',1),exprs)
+    if ~ok then break,end
+    model.rpar=V
+    model.equations.parameters(2)=list(V)
+    graphics.exprs=exprs
+    x.graphics=graphics;x.model=model
+    break
+  end
+
+case 'define' then
+  V=0.01
+
+  model=scicos_model()
+  model.rpar=V
+  model.in=1;model.out=1;
+  model.sim='ConstantVoltage';
+  model.blocktype='c'
+  model.dep_ut=[%f %f]
+  mo=modelica()
+  mo.model='ConstantVoltage';
+  mo.inputs='p';
+  mo.outputs='n';
+  mo.parameters=list('V',list(V))
+  model.equations=mo
+  exprs=string(V)
+
+  gr_i=['xset(''thickness'',2)'
+       'xx=[0 5 5 5]/12;';
+       'if orient then yy=[1 1 2 0]/2;else yy=[2,2,3,1]/4,end'
+       'xpoly(orig(1)+xx*sz(1),orig(2)+yy*sz(2));';
+       'xx=[2 2 2 3]/3;';
+       'if orient then yy=[1,3,2,2]/4;else yy=[0 2 1 1]/2;end'
+       'xpoly(orig(1)+xx*sz(1),orig(2)+yy*sz(2));']
+  
+  x=standard_define([1.5 1.1],model,exprs,list(gr_i,0))
+  x.graphics.in_implicit=['I']
+  x.graphics.out_implicit=['I']  
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/CurrentSensor.mo b/scilab/modules/scicos_blocks/macros/Electrical/CurrentSensor.mo
new file mode 100644 (file)
index 0000000..eb782b8
--- /dev/null
@@ -0,0 +1,31 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model CurrentSensor 
+  Pin p;
+  Pin n;
+  Real i;
+ equation
+    p.v = n.v;
+    p.i = i;
+    n.i = -i;
+ end CurrentSensor; 
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/CurrentSensor.sci b/scilab/modules/scicos_blocks/macros/Electrical/CurrentSensor.sci
new file mode 100644 (file)
index 0000000..e1b11cb
--- /dev/null
@@ -0,0 +1,157 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=CurrentSensor(job,arg1,arg2)
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  standard_draw(arg1,%f,sensor_draw_ports) 
+case 'getinputs' then
+ [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=sensor_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+case 'define' then
+  model=scicos_model()
+  model.in=1;model.out=[1; 1];
+  model.sim='CurrentSensor'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+  mo.model='CurrentSensor'
+  mo.inputs='p';
+  mo.outputs=['n';'i']
+  model.equations=mo
+  exprs=[]
+  gr_i=['xarc(orig(1)+sz(1)*1/8,orig(2)+sz(2)*4.3/5,sz(1)*3/4,sz(2)*3/4,0,360*64);';
+       'xsegs(orig(1)+sz(1)*[0 1/8],orig(2)+sz(2)*[1/2 1/2],0)';
+       'xsegs(orig(1)+sz(1)*[7/8 1],orig(2)+sz(2)*[1/2 1/2],0)';
+       'xsegs(orig(1)+sz(1)*[1.5/8 2.5/8],orig(2)+sz(2)*[1.3/2 1.2/2],0)';
+       'xsegs(orig(1)+sz(1)*[2.5/8 3.2/8],orig(2)+sz(2)*[1.62/2 1.3/2],0)';
+       'xsegs(orig(1)+sz(1)*[1/2 1/2],orig(2)+sz(2)*[4.25/5 1.3/2],0)';
+       'xsegs(orig(1)+sz(1)*[4.9/8 5.5/8],orig(2)+sz(2)*[1.3/2 1.65/2],0)';
+       'xsegs(orig(1)+sz(1)*[5.5/8 6.5/8],orig(2)+sz(2)*[1.2/2 1.32/2],0)';
+       'xsegs(orig(1)+sz(1)*[1/2 4.5/8],orig(2)+sz(2)*[1/2 1.32/2],0) ';
+       'xsegs(orig(1)+sz(1)*[1/2 1/2],orig(2)+sz(2)*[0.9/8 -1/8],0)';
+       'xfarc(orig(1)+sz(1)*0.93/2,orig(2)+sz(2)*1/2,sz(1)*0.2/4,sz(2)*0.2/4,0,360*64);';
+       ' xx=orig(1)+sz(1)*4.2/8+[.9 1 0 .9]*sz(1)/12;';
+       'yy=orig(2)+sz(2)*1.27/2+[0.1 1 0.3 0.1]*sz(2)/7;';
+       'xfpoly(xx,yy);'
+         'xstring(orig(1)+sz(1)/2,orig(2)+sz(2)/5,''A'')']
+  x=standard_define([2 2],model,exprs,list(gr_i,0))
+  x.graphics.in_implicit=['I']
+  x.graphics.out_implicit=['I';'E']
+end
+endfunction
+
+function sensor_draw_ports(o)
+[orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
+    xset('pattern',default_color(0))
+  // draw input/output ports
+  //------------------------
+
+  if orient then  //standard orientation
+    // set port shape
+    out2=[ 0  -1
+          1  -1
+          1   1
+          0   1]*diag([xf/7,yf/14])
+    
+    in2= [-1  -1
+          0  -1
+          0   1
+         -1   1]*diag([xf/7,yf/14])
+    dy=sz(2)/2
+    xset('pattern',default_color(1))
+    xpoly(out2(:,1)+(orig(1)+sz(1)),..
+         out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
+
+
+    dy=sz(2)/2
+    xfpoly(in2(:,1)+orig(1),..
+          in2(:,2)+(orig(2)+sz(2)-dy),1)       
+  else //tilded orientation
+      out2=[0  -1
+          -1  -1
+          -1   1
+           0   1]*diag([xf/7,yf/14])
+      
+      in2= [1  -1
+           0  -1
+           0   1
+           1   1]*diag([xf/7,yf/14])
+
+      
+      dy=sz(2)/2
+      xset('pattern',default_color(1))
+      xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
+           out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)  
+      dy=sz(2)/2
+      xfpoly(in2(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
+            in2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),1) 
+  end
+  // valve command port port
+  //------------------------
+  // set port shape
+
+
+
+  out= [-1  1
+        0  0
+        1  1
+       -1  1]*diag([xf/14,yf/7])
+
+
+
+  dx=sz(1)/2
+
+  xpoly(out(:,1)+ones(4,1)*(orig(1)+dx),..
+        out(:,2)+ones(4,1)*(orig(2)-sz(2)*2/8),"lines",1)
+
+endfunction 
+
+function [x,y,typ]=sensor_outputs(o)
+xf=60
+yf=40
+[orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
+//[orig,sz,orient]=o(2)(1:3);
+  inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);
+
+if orient then
+  x1=orig(1)+sz(1)
+  dx1=-xf/7
+  x2=orig(1)
+  dx2=xf/7
+else
+  x1=orig(1)
+  dx1=yf/7
+  x2=orig(1)+sz(1)
+  dx2=-xf/7
+end
+
+y=[orig(2)+sz(2)-(sz(2)/2) ,orig(2)-sz(2)*2/8]
+x=[(x1+dx2)  orig(1)+sz(1)/2]
+typ=[2 1]
+
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Diode.mo b/scilab/modules/scicos_blocks/macros/Electrical/Diode.mo
new file mode 100644 (file)
index 0000000..dda05c2
--- /dev/null
@@ -0,0 +1,39 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model Diode "Simple diode" \r
+   Pin p, n;\r
+    parameter Real Ids=1.e-6 "Saturation current";\r
+    parameter Real Vt=0.04   "Voltage equivalent of temperature (kT/qn)";\r
+    parameter Real Maxexp=15 "Max. exponent for linear continuation";\r
+    parameter Real R=1.e8 "Parallel ohmic resistance";\r
+    Real v;\r
+  equation \r
+   v = p.v - n.v;\r
+\r
+   p.i = if noEvent(v/Vt > Maxexp) then \r
+       Ids*(Modelica.Math.exp(Maxexp)*(1 + v/Vt - Maxexp) - 1) + v/R \r
+  else \r
+       Ids*(Modelica.Math.exp(v/Vt) - 1) + v/R;\r
+\r
+   p.i = -n.i;\r
+\r
+  end Diode;\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Diode.sci b/scilab/modules/scicos_blocks/macros/Electrical/Diode.sci
new file mode 100644 (file)
index 0000000..95f171a
--- /dev/null
@@ -0,0 +1,81 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=Diode(job,arg1,arg2)
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  standard_draw(arg1,%f) 
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,Ids,Vt,Maxexp,R,exprs]=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 then break,end
+    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
+  end
+case 'define' then
+  Ids=1.e-6; Vt=0.04; Maxexp=15; R=1.e8;
+  model=scicos_model()
+  model.rpar=[Ids;Vt;Maxexp;R]
+
+  model.in=1;model.out=1;
+  model.sim='Diode';
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+  mo.model='Diode';
+  mo.inputs='p';
+  mo.outputs='n';
+  mo.parameters=list(['Ids','Vt','Maxexp','R'],list(Ids,Vt,Maxexp,R))
+
+  model.equations=mo
+  exprs=string([Ids;Vt;Maxexp;R])
+  gr_i=['xset(''thickness'',2)'
+       'if orient then'
+       '  xx=orig(1)+[0,1,1,2,2,2,2,3,2,1,1,2]*(sz(1)/3);';
+       '  yy=orig(2)+[2,2,3,2,3,1,2,2,2,1,2,2]*(sz(2)/4);';
+       'else'     
+       '  xx=orig(1)+[0,1,1,1,1,2,2,3.06,2,2,1,2]*(sz(1)/3);';
+       '  yy=orig(2)+[2,2,3,1,2,3,2,2,2,1,2,2]*(sz(2)/4);';
+       'end'
+       'xpoly(xx,yy);'] 
+  x=standard_define([2 1],model,exprs,list(gr_i,0))
+  x.graphics.in_implicit=['I']
+  x.graphics.out_implicit=['I']  
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/ExternFunction.mo b/scilab/modules/scicos_blocks/macros/Electrical/ExternFunction.mo
new file mode 100644 (file)
index 0000000..e6bffcf
--- /dev/null
@@ -0,0 +1,26 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+function ExternFunction "external function ExternFunction"\r
+       input Real u "1 Real input";\r
+       output Real y "1 Real output";\r
+external;\r
+end ExternFunction;\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Ground.mo b/scilab/modules/scicos_blocks/macros/Electrical/Ground.mo
new file mode 100644 (file)
index 0000000..7a87358
--- /dev/null
@@ -0,0 +1,26 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model Ground "Ground"\r
+       Pin p;\r
+equation\r
+       p.v = 0;\r
+end Ground;\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Ground.sci b/scilab/modules/scicos_blocks/macros/Electrical/Ground.sci
new file mode 100644 (file)
index 0000000..11dd0bf
--- /dev/null
@@ -0,0 +1,83 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=Ground(job,arg1,arg2)
+// exemple d'un bloc implicit, 
+//   -  sans entree ni sortie de conditionnement
+//   -  avec une entree et une sortie de type implicit et de dimension 1
+//   - avec un dialogue de saisie de parametre
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+   standard_draw(arg1,%f,ground_draw_ports)
+case 'getinputs' then
+  xf=60
+  yf=40
+  orig=arg1.graphics.orig;sz=arg1.graphics.sz;
+  x=orig(1)+(sz(1)/2)
+  y=(orig(2)+yf/7+sz(2))
+  typ=2
+  case 'getoutputs' then
+  x=[];y=[],typ=[]
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+case 'define' then
+  model=scicos_model()
+  model.in=[1];
+  model.out=[];
+  model.sim='Ground'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+  mo.model='Ground'
+  mo.inputs='p';
+  model.equations=mo
+  exprs=''
+  gr_i=['xset(''thickness'',3)';
+      'xsegs(orig(1)+sz(1)*[1/2 1/2],orig(2)+sz(2)*[1 1/2],0);';
+      'xsegs(orig(1)+sz(1)*[0 1],orig(2)+sz(2)*[1/2 1/2],0);';
+      'xsegs(orig(1)+sz(1)*[2/8 6/8],orig(2)+sz(2)*[1/4 1/4],0);';
+      'xsegs(orig(1)+sz(1)*[3/8 5/8],orig(2)+sz(2)*[0 0],0);']
+  x=standard_define([1 1],model,exprs,list(gr_i,0))
+  x.graphics.in_implicit=['I']
+  x.graphics.out_implicit=['I']
+end
+endfunction
+
+function ground_draw_ports(o)
+[orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
+xset('pattern',default_color(0))
+// draw input ports
+//------------------------
+
+//------------------------
+// set port shape
+
+in= 0.8*[ -1  -1
+    1  -1
+    1   1
+    -1   1]*diag([xf/14,yf/7])  
+
+ xfpoly(in(:,1)+ones(4,1)*(orig(1)+sz(1)/2),..
+      in(:,2)+ones(4,1)*(orig(2)+sz(2)+yf/14),1)
+endfunction 
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Gyrator.mo b/scilab/modules/scicos_blocks/macros/Electrical/Gyrator.mo
new file mode 100644 (file)
index 0000000..de787ff
--- /dev/null
@@ -0,0 +1,42 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model Gyrator "Gyrator" \r
+  parameter Real G1=1 "Gyration conductance";\r
+  parameter Real G2=1 "Gyration conductance";\r
+\r
+  Pin p1,n1,p2,n2;    \r
+  Real v2,v1,i1,i2;\r
+\r
+equation \r
+\r
+  v1=p1.v-n1.v;\r
+  0=p1.i+n1.i;\r
+  i1=p1.i;\r
+\r
+  v2=p2.v-n2.v;\r
+  0=p2.i+n2.i;\r
+  i2=p2.i;\r
+\r
+  i1 = G2*v2;\r
+  i2 = -G1*v1;\r
+\r
+end Gyrator;\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Gyrator.sci b/scilab/modules/scicos_blocks/macros/Electrical/Gyrator.sci
new file mode 100644 (file)
index 0000000..fd184ca
--- /dev/null
@@ -0,0 +1,261 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+\r
+function [x,y,typ]=Gyrator(job,arg1,arg2)\r
+// the automatically generated interface block for Modelica Gyrator.mo model\r
+//   - avec un dialogue de saisie de parametre\r
+x=[];y=[];typ=[];\r
+select job\r
+case 'plot' then\r
+  standard_draw(arg1,%f,Gyrator_draw_ports)\r
+case 'getinputs' then\r
+  [x,y,typ]=Gyrator_inputs(arg1)\r
+case 'getoutputs' then\r
+  [x,y,typ]=Gyrator_outputs(arg1)\r
+case 'getorigin' then\r
+  [x,y]=standard_origin(arg1)\r
+case 'set' then\r
+  x=arg1;\r
+  graphics=arg1.graphics;exprs=graphics.exprs\r
+  model=arg1.model;\r
+x=arg1\r
+exprs=x.graphics.exprs\r
+while %t do\r
+  [ok,G1,G2,exprs]=getvalue(["Set Gyrator block parameters:";"";"G1: Gyration conductance";"G2: Gyration conductance"],["G1";"G2"],list("vec",1,"vec",1),exprs)\r
+  if ~ok then break,end\r
+  x.model.equations.parameters(2)=list(G1,G2)\r
+  x.graphics.exprs=exprs\r
+  break\r
+end\r
+ case 'define' then      \r
+ModelName="Gyrator"\r
+PrametersValue=[1;1]\r
+ParametersName=["G1";"G2"]\r
+model=scicos_model()                  \r
+Typein=[];Typeout=[];MI=[];MO=[]       \r
+P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]\r
+PortName=["p1";"n1";"p2";"n2"]\r
+for i=1:size(P,'r')                                             \r
+  if P(i,3)==1  then  Typein= [Typein; 'E'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==2  then  Typein= [Typein; 'I'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==-1 then  Typeout=[Typeout;'E'];MO=[MO;PortName(i)];end\r
+  if P(i,3)==-2 then  Typeout=[Typeout;'I'];MO=[MO;PortName(i)];end\r
+end\r
+model=scicos_model()\r
+mo=modelica()\r
+model.sim=ModelName;\r
+mo.inputs=MI;\r
+mo.outputs=MO;\r
+model.rpar=PrametersValue;\r
+mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));\r
+exprs=["1";"1"]\r
+gr_i=["";"if orient then";"  xrects([orig(1)+0.2*sz(1); orig(2)+1*sz(2);0.6*sz(1);1*sz(2)],0)";"  xpolys(orig(1)+[0.02,0.02,0.8,0.8,0.3,0.395;0.2,0.2,0.98,0.98,0.7,0.595]*sz(1),orig(2)+[0.9166667,0.0833333,0.9166667,0.0833333,0.75,0.3166667;0.9166667,0.0833333,0.9166667,0.0833333,0.75,0.3166667]*sz(2),[2,2,2,2,2,2])";"  xset(''color'',[0,0])";"  xfpolys(orig(1)+[0.65,0.35;0.7,0.4;0.65,0.4;0.65,0.35]*sz(1),orig(2)+[0.7833333,0.3166667;0.75,0.35;0.7166667,0.2833333;0.7833333,0.3166667]*sz(2),[2,2])";"  xpolys(orig(1)+[0.48,0.515,0.46;0.47,0.505,0.535]*sz(1),orig(2)+[0.5416667,0.5416667,0.5416667;0.4583333,0.4583333,0.5416667]*sz(2),[6,6,6])";"else";"  xrects([orig(1)+0.2*sz(1); orig(2)+1*sz(2);0.6*sz(1);1*sz(2)],0)";"  xpolys(orig(1)+[0.98,0.98,0.2,0.2,0.7,0.605;0.8,0.8,0.02,0.02,0.3,0.405]*sz(1),orig(2)+[0.9166667,0.0833333,0.9166667,0.0833333,0.75,0.3166667;0.9166667,0.0833333,0.9166667,0.0833333,0.75,0.3166667]*sz(2),[2,2,2,2,2,2])";"  xset(''color'',[0,0])";"  xfpolys(orig(1)+[0.35,0.65;0.3,0.6;0.35,0.6;0.35,0.65]*sz(1),orig(2)+[0.7833333,0.3166667;0.75,0.35;0.7166667,0.2833333;0.7833333,0.3166667]*sz(2),[2,2])";"  xpolys(orig(1)+[0.52,0.485,0.54;0.53,0.495,0.465]*sz(1),orig(2)+[0.5416667,0.5416667,0.5416667;0.4583333,0.4583333,0.5416667]*sz(2),[6,6,6])";"end";"  xstring(orig(1)+0.35*sz(1),orig(2)+0.5*sz(2),""G1"")";"  xstring(orig(1)+0.35*sz(1),orig(2)+0.0833333*sz(2),""G2"")"]\r
+model.blocktype='c'                              \r
+model.dep_ut=[%f %t]                               \r
+mo.model=ModelName                                 \r
+model.equations=mo                                 \r
+model.in=ones(size(MI,'*'),1)                    \r
+model.out=ones(size(MO,'*'),1)                   \r
+x=standard_define([3,1.8],model,exprs,list(gr_i,0))  \r
+x.graphics.in_implicit=Typein;                     \r
+x.graphics.out_implicit=Typeout;                   \r
+end\r
+endfunction\r
+//=========================\r
+function Gyrator_draw_ports(o)\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  xset('pattern',default_color(0))\r
+  // draw input/output ports\r
+  //------------------------\r
+  // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]\r
+  P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]\r
+\r
+  //============================\r
+  // setting the input/ outputs and direction\r
+  // implicit port: if it's located in the right it's output and while,\r
+  // else black\r
+  // explicit ports:\r
+    \r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  xset('pattern',default_color(1))           \r
+  xset('thickness',1)   \r
+   \r
+  if orient then\r
+    for i=1:size(P,'r')      \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if  P(i,3)==-1 then\r
+       outR=out*R;\r
+       xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)           \r
+      end  \r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       in2R=in2*R;                     \r
+       xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)       \r
+      end\r
+      \r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)     \r
+      end\r
+    end  \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-1 then // explicit\r
+       outR=out*R;\r
+       xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+        in2R=in2*R;                    \r
+          xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)\r
+      end\r
+    end          \r
+  end\r
+endfunction \r
+//=========================\r
+function [x,y,typ]=Gyrator_inputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  //[orig,sz,orient]=o(2)(1:3);\r
+  inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);\r
+  \r
+  // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]\r
+  P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]\r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[]\r
+  if orient then\r
+    for i=1:size(P,'r')   \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+     R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
\r
+endfunction\r
+//=========================\r
+function [x,y,typ]=Gyrator_outputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  out=size(o.model.out,1);clkout=size(o.model.evtout,1);\r
+  P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]\r
\r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[];\r
+  if orient then\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end \r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];            \r
+      end            \r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end\r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
+endfunction\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/IdealTransformer.mo b/scilab/modules/scicos_blocks/macros/Electrical/IdealTransformer.mo
new file mode 100644 (file)
index 0000000..9e88110
--- /dev/null
@@ -0,0 +1,46 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model IdealTransformer "Transformer with two ports" \r
+  parameter Real N=1 "Transformer turn ration N1/N2";  \r
+  Pin p1, n1, p2, n2;    \r
+  Real v2,v1,i1,i2;\r
+\r
+equation \r
+  v1=p1.v-n1.v;\r
+  0=p1.i+n1.i;\r
+  i1=p1.i;\r
+\r
+  v2=p2.v-n2.v;\r
+  0=p2.i+n2.i;\r
+  i2=p2.i;\r
+\r
+/*  v1 = L1*der(i1) + M*der(i2); \r
+  v2 = M*der(i1) + L2*der(i2);\r
+    Results very often in high index\r
+  problem not handled in Scicos /Masoud\r
+*/\r
+\r
+v1=N*v2;\r
+i2=-N*i1;\r
+\r
+end IdealTransformer;\r
+\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/IdealTransformer.sci b/scilab/modules/scicos_blocks/macros/Electrical/IdealTransformer.sci
new file mode 100644 (file)
index 0000000..be9298a
--- /dev/null
@@ -0,0 +1,262 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+\r
+function [x,y,typ]=IdealTransformer(job,arg1,arg2)\r
+// the automatically generated interface block for Modelica Transformer.mo model\r
+//   - avec un dialogue de saisie de parametre\r
+x=[];y=[];typ=[];\r
+select job\r
+case 'plot' then\r
+  standard_draw(arg1,%f,trns_draw_ports)\r
+case 'getinputs' then\r
+  [x,y,typ]=trns_inputs(arg1)\r
+case 'getoutputs' then\r
+  [x,y,typ]=trns_outputs(arg1)\r
+case 'getorigin' then\r
+  [x,y]=standard_origin(arg1)\r
+case 'set' then\r
+  x=arg1;\r
+  graphics=arg1.graphics;exprs=graphics.exprs\r
+  model=arg1.model;\r
+x=arg1\r
+exprs=x.graphics.exprs\r
+while %t do\r
+  [ok,N,exprs]=getvalue(["Set Transformer block parameters:";"";"N:"+...\r
+                   " Turn ratio (N1/N2)"],["N"],list("vec",1),exprs)\r
+  if ~ok then break,end\r
+  x.model.equations.parameters(2)=list(N)\r
+  x.graphics.exprs=exprs\r
+  break\r
+end\r
+ case 'define' then      \r
+ModelName="IdealTransformer"\r
+PrametersValue=[1]\r
+ParametersName=["N"]\r
+model=scicos_model()                  \r
+Typein=[];Typeout=[];MI=[];MO=[]       \r
+P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]\r
+PortName=["p1";"n1";"p2";"n2"]\r
+for i=1:size(P,'r')                                             \r
+  if P(i,3)==1  then  Typein= [Typein; 'E'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==2  then  Typein= [Typein; 'I'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==-1 then  Typeout=[Typeout;'E'];MO=[MO;PortName(i)];end\r
+  if P(i,3)==-2 then  Typeout=[Typeout;'I'];MO=[MO;PortName(i)];end\r
+end\r
+model=scicos_model()\r
+mo=modelica()\r
+model.sim=ModelName;\r
+mo.inputs=MI;\r
+mo.outputs=MO;\r
+model.rpar=PrametersValue;\r
+mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));\r
+exprs=["1";"1";"1"]\r
+gr_i=["";"if orient then";"  xarcs([orig(1)+[0.275,0.275,0.275,0.275]*sz(1); orig(2)+[0.2916667,0.5,0.7083333,0.9166667]*sz(2);[0.125,0.125,0.125,0.125]*sz(1);[0.2083333,0.2083333,0.2083333,0.2083333]*sz(2);[-5760,-5760,-5760,-5760];[11520,11520,11520,11520]],[2,2,2,2])";"  xpolys(orig(1)+[0.02,0.02;0.34,0.34]*sz(1),orig(2)+[0.9166667,0.0833333;0.9166667,0.0833333]*sz(2),[2,2])";"  xarcs([orig(1)+[0.6,0.6,0.6,0.6]*sz(1); orig(2)+[0.2916667,0.5,0.7083333,0.9166667]*sz(2);[0.125,0.125,0.125,0.125]*sz(1);[0.2083333,0.2083333,0.2083333,0.2083333]*sz(2);[5760,5760,5760,5760];[11520,11520,11520,11520]],[2,2,2,2])";"  xpolys(orig(1)+[0.66,0.66;0.98,0.98]*sz(1),orig(2)+[0.9166667,0.0833333;0.9166667,0.0833333]*sz(2),[2,2])";"else";"  xarcs([orig(1)+[0.6,0.6,0.6,0.6]*sz(1); orig(2)+[0.2916667,0.5,0.7083333,0.9166667]*sz(2);[0.125,0.125,0.125,0.125]*sz(1);[0.2083333,0.2083333,0.2083333,0.2083333]*sz(2);[5760,5760,5760,5760];[11520,11520,11520,11520]],[2,2,2,2])";"  xpolys(orig(1)+[0.98,0.98;0.66,0.66]*sz(1),orig(2)+[0.9166667,0.0833333;0.9166667,0.0833333]*sz(2),[2,2])";"  xarcs([orig(1)+[0.275,0.275,0.275,0.275]*sz(1); orig(2)+[0.2916667,0.5,0.7083333,0.9166667]*sz(2);[0.125,0.125,0.125,0.125]*sz(1);[0.2083333,0.2083333,0.2083333,0.2083333]*sz(2);[-5760,-5760,-5760,-5760];[11520,11520,11520,11520]],[2,2,2,2])";"  xpolys(orig(1)+[0.34,0.34;0.02,0.02]*sz(1),orig(2)+[0.9166667,0.0833333;0.9166667,0.0833333]*sz(2),[2,2])";"end"]\r
+model.blocktype='c'                              \r
+model.dep_ut=[%f %t]                               \r
+mo.model=ModelName                                 \r
+model.equations=mo                                 \r
+model.in=ones(size(MI,'*'),1)                    \r
+model.out=ones(size(MO,'*'),1)                   \r
+x=standard_define([2,2],model,exprs,list(gr_i,0))  \r
+x.graphics.in_implicit=Typein;                     \r
+x.graphics.out_implicit=Typeout;                   \r
+end\r
+endfunction\r
+//=========================\r
+function trns_draw_ports(o)\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  xset('pattern',default_color(0))\r
+  // draw input/output ports\r
+  //------------------------\r
+  // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]\r
+  P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]\r
+\r
+  //============================\r
+  // setting the input/ outputs and direction\r
+  // implicit port: if it's located in the right it's output and while,\r
+  // else black\r
+  // explicit ports:\r
+    \r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  xset('pattern',default_color(1))           \r
+  xset('thickness',1)   \r
+   \r
+  if orient then\r
+    for i=1:size(P,'r')      \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if  P(i,3)==-1 then\r
+       outR=out*R;\r
+       xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)           \r
+      end  \r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       in2R=in2*R;                     \r
+       xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)       \r
+      end\r
+      \r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)     \r
+      end\r
+    end  \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-1 then // explicit\r
+       outR=out*R;\r
+       xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+        in2R=in2*R;                    \r
+          xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)\r
+      end\r
+    end          \r
+  end\r
+endfunction \r
+//=========================\r
+function [x,y,typ]=trns_inputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  //[orig,sz,orient]=o(2)(1:3);\r
+  inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);\r
+  \r
+  // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]\r
+  P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]\r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[]\r
+  if orient then\r
+    for i=1:size(P,'r')   \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+     R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
\r
+endfunction\r
+//=========================\r
+function [x,y,typ]=trns_outputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  out=size(o.model.out,1);clkout=size(o.model.evtout,1);\r
+  P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]\r
\r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[];\r
+  if orient then\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end \r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];            \r
+      end            \r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end\r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
+endfunction\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/InPutPort.mo b/scilab/modules/scicos_blocks/macros/Electrical/InPutPort.mo
new file mode 100644 (file)
index 0000000..766c18a
--- /dev/null
@@ -0,0 +1,27 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model InPutPort
+  Real vo;
+  input Real vi;
+ equation
+    vi=vo;
+end InPutPort;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Inductor.mo b/scilab/modules/scicos_blocks/macros/Electrical/Inductor.mo
new file mode 100644 (file)
index 0000000..a4b90e3
--- /dev/null
@@ -0,0 +1,32 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model Inductor "Ideal electrical inductor"\r
+       Pin p, n;\r
+       Real v;\r
+       Real i;\r
+       parameter Real L "Inductance";\r
+equation\r
+       v = L*der(i);\r
+       v = p.v - n.v;\r
+       0 = p.i + n.i;\r
+       i = p.i;\r
+end Inductor;\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Inductor.sci b/scilab/modules/scicos_blocks/macros/Electrical/Inductor.sci
new file mode 100644 (file)
index 0000000..ecb8e02
--- /dev/null
@@ -0,0 +1,80 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=Inductor(job,arg1,arg2)
+x=[];y=[];typ=[];
+select job
+  case 'plot' then
+  L=arg1.graphics.exprs;
+  standard_draw(arg1,%f)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,L,exprs]=getvalue('Set Inductor block parameter',..
+                          'L (H)',list('vec',1),exprs)
+    if ~ok then break,end
+    model.rpar=L
+    model.equations.parameters(2)=list(L)
+    graphics.exprs=exprs
+    x.graphics=graphics;x.model=model
+    break
+  end
+case 'define' then
+  model=scicos_model()
+  model.in=[1];
+  model.out=[1];
+  L=1.d-5
+  model.rpar=L
+  model.sim='Inductor'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica();
+  mo.model='Inductor'
+  mo.inputs='p';
+  mo.outputs='n';
+  mo.parameters=list('L',list(L))
+  model.equations=mo;
+  exprs=string(L)
+
+  gr_i=['tt=linspace(0.04,0.96,100)'';'
+       'xpoly(tt*sz(1)+orig(1),+orig(2)+abs(sin(18*(tt-0.04)))*sz(2),""lines"");';
+       'xx=orig(1)+[0 0.04 0.04 0.04 0]*sz(1);';
+       'yy=orig(2)+[1/2 1/2 0  1/2 1/2]*sz(2);';
+       'xpoly(xx,yy) ';
+       'xx=orig(1)+[0.96 0.96 1   0.96 0.96 ]*sz(1);';
+       'yy=orig(2)+[abs(sin(18*0.92))   1/2   1/2 1/2 abs(sin(18*0.92))]*sz(2);';
+       'xpoly(xx,yy) ';
+       'rect=xstringl(0,0,''L=''+L)'
+       'xstring(orig(1)+(sz(1)-rect(3))/2,orig(2)-rect(4)*1.2,''L=''+L)' ] 
+  x=standard_define([2 0.9],model,exprs,list(gr_i,0))
+  x.graphics.in_implicit=['I']
+  x.graphics.out_implicit=['I']
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/MOTOR.sci b/scilab/modules/scicos_blocks/macros/Electrical/MOTOR.sci
new file mode 100644 (file)
index 0000000..8444e5d
--- /dev/null
@@ -0,0 +1,150 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=MOTOR(job,arg1,arg2)
+// exemple d'un bloc implicit, 
+//   -  sans entree ni sortie de conditionnement
+//   -  avec deux entrees et une sortie de type implicit et de dimension 1
+//   -  avec des ports disposes en des positions non standard
+
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  standard_draw(arg1,%f,motor_draw_ports)
+case 'getinputs' then
+  [x,y,typ]=motor_inputs(arg1)
+//[x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=motor_outputs(arg1)
+// [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+case 'define' then
+  model=scicos_model()
+  model.out=[1;1]
+  model.in=[1];
+  model.sim='motor'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]  
+  gr_i=['xrects([orig(1)+sz(1)/3;orig(2)+sz(2);sz(1)/3;sz(2)],scs_color(32))';
+'xrects([orig(1)+2*sz(1)/3;orig(2)+0.87*sz(2);sz(1)/6;0.74*sz(2)],scs_color(33))';
+'xrects([orig(1)+sz(1)/3-sz(1)/6;orig(2)+0.87*sz(2);sz(1)/6;0.74*sz(2)],scs_color(33))';
+'xrects([orig(1)+5*sz(1)/6;orig(2)+(0.5+1/20)*sz(2);sz(1)/6;sz(2)/10],scs_color(33))';
+'xrects([orig(1);orig(2)+(0.5+1/20)*sz(2);sz(1)/6;sz(2)/10],scs_color(33))'];
+
+
+  exprs=''
+  x=standard_define([2 2],model,exprs,gr_i)
+  x.graphics.out_implicit=['I';'I']
+  x.graphics.in_implicit=['I']
+end
+endfunction
+function motor_draw_ports(o)
+[orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
+
+
+    xset('pattern',default_color(0));xset('thickness',1)
+  // draw input/output ports
+  //------------------------
+
+  if orient then  //standard orientation
+    // set port shape
+    out2=[ 0  -1
+          1  -1
+          1   1
+          0   1]*diag([xf/7,yf/14])
+    
+    dy=sz(2)/2
+    xset('pattern',default_color(1))
+    xpoly(out2(:,1)+(orig(1)+sz(1)),..
+         out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
+
+  else //tilded orientation
+      out2=[0  -1
+          -1  -1
+          -1   1
+           0   1]*diag([xf/7,yf/14])
+      
+      dy=sz(2)/2
+      xset('pattern',default_color(1))
+      xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
+           out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)  
+
+  end
+  // motor command  ports
+  //------------------------
+  // set port shape
+
+
+
+  up= [-1  1
+       -1  0
+        1  0
+        1  1]*diag([xf/14,yf/7])
+
+  down= [-1  0
+        -1 -1
+         1 -1
+         1  0]*diag([xf/14,yf/7])
+
+
+  dx=sz(1)/2
+
+  xpoly(up(:,1)+ones(4,1)*(orig(1)+dx),..
+        up(:,2)+ones(4,1)*(orig(2)+sz(2)),"lines",1)
+
+  xfpoly(down(:,1)+ones(4,1)*(orig(1)+dx),..
+          down(:,2)+ones(4,1)*orig(2),1)
+
+
+endfunction 
+
+function [x,y,typ]=motor_inputs(o)
+xf=60
+yf=40
+orig=o.graphics.orig
+sz=o.graphics.sz
+
+x=orig(1)+sz(1)/2
+y=orig(2)-yf/7
+typ=2
+endfunction
+function [x,y,typ]=motor_outputs(o)
+xf=60
+yf=40
+
+[orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
+if orient then
+  xo=orig(1)+sz(1)
+  dx=xf/7
+else
+  xo=orig(1)
+  dx=-xf/7
+end
+y=[orig(2)+sz(2)-sz(2)/2 orig(2)+yf/7+sz(2)]
+x=[xo+dx orig(1)+sz(1)/2]
+typ=[2 2]
+
+
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Maths.mo b/scilab/modules/scicos_blocks/macros/Electrical/Maths.mo
new file mode 100644 (file)
index 0000000..dcab39c
--- /dev/null
@@ -0,0 +1,68 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+package Modelica
+package Math
+  function sin
+    input Real u;
+    output Real y;
+  external "builtin";
+  end sin;
+
+  function cos
+    input Real u;
+    output Real y;
+  external "builtin";
+  end cos;
+
+  function tan
+    input Real u;
+    output Real y;
+  external "builtin";
+  end tan;
+
+  function tanh
+    input Real u;
+    output Real y;
+  external "builtin";
+  end tanh;
+
+  function exp
+    input Real u;
+    output Real y;
+  external "builtin";
+  end exp;
+
+  function sqrt
+    input Real u;
+    output Real y;
+  external "builtin";
+  end sqrt;
+
+  function log
+    input Real u;
+    output Real y;
+  external "builtin";
+  end log;
+
+end Math;
+end Modelica;
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/NMOS.mo b/scilab/modules/scicos_blocks/macros/Electrical/NMOS.mo
new file mode 100644 (file)
index 0000000..0f0b685
--- /dev/null
@@ -0,0 +1,64 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+class NMOS "Simple MOS Transistor" 
+  parameter Real W=20.e-6 "Width";
+  parameter Real L=6.e-6 "Length";
+  parameter Real Beta=0.041e-3    "Transconductance parameter";
+  parameter Real Vt=0.8 "Zero bias threshold voltage";
+  parameter Real K2=1.144 "Bulk threshold parameter";
+  parameter Real K5= 0.7311"Reduction of pinch-off region";
+  parameter Real dW=-2.5e-6 "narrowing of channel";
+  parameter Real dL= -1.5e-6"shortening of channel";
+  parameter Real RDS=1.e+7 "Drain-Source-Resistance";
+
+  Pin D "Drain";
+  Pin G "Gate";
+  Pin S "Source";
+  Pin B "Bulk";
+
+  Real v;
+  Real uds;
+  Real ubs;
+  Real ugst;
+  Real ud;
+  Real us;
+  Real id,gds;
+equation  
+    //assert (L + dL > 0, "Effective length must be positive");
+    //assert (W + dW > 0, "Effective width  must be positive");
+
+  gds = if noEvent(RDS < 1.e-20 and RDS > -1.e-20) then 1.e20 else 1/RDS;
+  v = Beta*(W + dW)/(L + dL);
+  ud = if noEvent(D.v < S.v) then S.v else D.v;
+  us = if noEvent(D.v < S.v) then D.v else S.v;
+  uds = ud - us;
+  ubs = if noEvent(B.v > us) then 0 else B.v - us;
+  ugst = (G.v - us - Vt + K2*ubs)*K5;
+  id = if noEvent(ugst <= 0) then uds*gds else if noEvent(ugst > uds) then v*uds*(ugst
+     - uds/2) + uds*gds else v*ugst*ugst/2 + uds*gds;
+  G.i = 0;
+  D.i = if noEvent(D.v < S.v) then -id else id;
+  S.i = -D.i;
+  B.i = 0;
+end NMOS;
+
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/NMOS.sci b/scilab/modules/scicos_blocks/macros/Electrical/NMOS.sci
new file mode 100644 (file)
index 0000000..d26a650
--- /dev/null
@@ -0,0 +1,110 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=NMOS(job,arg1,arg2)
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+standard_draw(arg1,%f) 
+
+case 'getinputs' then
+   [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+   [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs]=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 then break,end
+    model.equations.parameters(2)=list(W,L,Beta,Vt,K2,K5,dW,dL,RDS)
+    graphics.exprs=exprs
+    x.graphics=graphics;x.model=model
+    break
+  end
+case 'define' then
+  model=scicos_model()
+  W=20.e-6;
+  L=6.e-6;
+  Beta=0.041e-3;
+  Vt=0.8;
+  K2=1.144;
+  K5= 0.7311;
+  dW=-2.5e-6;
+  dL= -1.5e-6;
+  RDS=1.e+7;
+    
+  model.sim='NMOS'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+  mo.model='NMOS';
+  mo.outputs=['D';'B';'S']
+  mo.inputs='G';
+  mo.parameters=list(['W';'L';'Beta';'Vt';'K2';'K5';'dW';'dL';'RDS'],[W;L;Beta;Vt;K2;K5;dW;dL;RDS])
+  model.equations=mo
+  model.in=ones(size(mo.inputs,'*'),1)
+  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=[' Thick=xget(''thickness'');xset(''thickness'',2);';\r
+  'if orient then,';
+        'x1=orig(1)+  [0, 15,15,15]*(sz(1)/32);';
+               'x2=orig(1)+[17,17,19,19,32,19,19,17]*(sz(1)/32);';
+               'x3=orig(1)+  [17,17,19,19,21,26,26,32,26,26,21,19,19,17]*(sz(1)/32);';
+               'x4=orig(1)+[17,17,19,19,32,19,19,17]*(sz(1)/32);';
+    'else,';
+        'x1=orig(1)+  [32, 17,17,17]*(sz(1)/32);';
+               'x2=orig(1)+[15,15,13,13,0,13,13,15]*(sz(1)/32);';
+               'x3=orig(1)+  [15,15,13,13,11, 6, 6, 0, 6, 6,11,13,13,15]*(sz(1)/32);';
+               'x4=orig(1)+[15,15,13,13,0,13,13,15]*(sz(1)/32);';
+    'end;'\r
+       'y1=orig(2)+5+[27,27,48,27]*(sz(2)/70);';\r
+       'y2=orig(2)+5+[48,40,40,44,44,44,48,48]*(sz(2)/70);';\r
+       'y3=orig(2)+5+[30,23,23,27,27, 31,27,27,27,23,27,27,30,30]*(sz(2)/70);';\r
+       'y4=orig(2)+5+[16,7,7, 11,11, 11, 16,16]*(sz(2)/70);';\r
+       'xpoly(x1,y1);';\r
+       'xpoly(x2,y2);';\r
+       'xpoly(x3,y3);';\r
+       'xpoly(x4,y4);';\r
+       'xset(''thickness'',Thick);'
+       ]
+    
+  x=standard_define([2 2],model,exprs,gr_i)
+  x.graphics.in_implicit=['I']
+  x.graphics.out_implicit=['I';'I';'I']
+end
+endfunction
+
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/NPN.mo b/scilab/modules/scicos_blocks/macros/Electrical/NPN.mo
new file mode 100644 (file)
index 0000000..4e9aa0b
--- /dev/null
@@ -0,0 +1,89 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model NPN "Simple BJT according to Ebers-Moll" 
+  parameter Real Bf=50 "Forward beta";
+  parameter Real Br=0.1 "Reverse beta";
+  parameter Real Is=1.e-16 "Transport saturation current";
+  parameter Real Vak=0.02 "Early voltage (inverse), 1/Volt";
+  parameter Real Tauf=0.12e-9 "Ideal forward transit time";
+  parameter Real Taur=5e-9 "Ideal reverse transit time";
+  parameter Real Ccs=1e-12 "Collector-substrat(ground) cap.";
+  parameter Real Cje=0.4e-12 "Base-emitter zero bias depletion cap.";
+  parameter Real Cjc=0.5e-12 "Base-coll. zero bias depletion cap.";
+  parameter Real Phie=0.8 "Base-emitter diffusion voltage";
+  parameter Real Me=0.4 "Base-emitter gradation exponent";
+  parameter Real Phic=0.8 "Base-collector diffusion voltage";
+  parameter Real Mc=0.333 "Base-collector gradation exponent";
+  parameter Real Gbc=1e-15 "Base-collector conductance";
+  parameter Real Gbe=1e-15 "Base-emitter conductance";
+  parameter Real Vt=0.02585 "Voltage equivalent of temperature";
+  parameter Real EMinMax=40 "if x > EMax, the exp(x) function is linearized";
+  Real vbc;
+  Real vbe;
+  Real qbk;
+  Real ibc;
+  Real ibe;
+  Real cbc;
+  Real cbe;
+  Real ExMin;
+  Real ExMax;
+  Real Capcje;
+  Real Capcjc;
+  Real EMax;
+  Real EMin;
+
+  Pin C "Collector";
+  Pin B "Base";
+  Pin E "Emitter";
+equation 
+  EMax=EMinMax;
+  EMin=-2*EMinMax;
+  ExMin = Modelica.Math.exp(EMin);
+  ExMax = Modelica.Math.exp(EMax);
+  vbc = B.v - C.v;
+  vbe = B.v - E.v;
+  qbk = 1 - vbc*Vak;
+  
+  ibc = if noEvent(vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc*Gbc
+     else if noEvent(vbc/Vt > EMax) then Is*(ExMax*(vbc/Vt - EMax + 1) - 1) + vbc*Gbc
+     else Is*(Modelica.Math.exp(vbc/Vt) - 1) + vbc*Gbc;
+
+  ibe = if noEvent(vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe*Gbe
+     else if noEvent(vbe/Vt > EMax) then Is*(ExMax*(vbe/Vt - EMax + 1) - 1) + vbe*Gbe
+     else Is*(Modelica.Math.exp(vbe/Vt) - 1) + vbe*Gbe;
+
+  Capcjc = if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*(1 - vbc/Phic);
+  Capcje = if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*(1 - vbe/Phie);
+
+  cbc = if noEvent(vbc/Vt < EMin) then Taur*Is/Vt*ExMin*(vbc/Vt - EMin + 1) + Capcjc
+     else if noEvent(vbc/Vt > EMax) then Taur*Is/Vt*ExMax*(vbc/Vt - EMax + 1) + Capcjc
+     else Taur*Is/Vt*Modelica.Math.exp(vbc/Vt) + Capcjc;
+
+  cbe = if noEvent(vbe/Vt < EMin) then Tauf*Is/Vt*ExMin*(vbe/Vt - EMin + 1) + Capcje
+     else if noEvent(vbe/Vt > EMax) then Tauf*Is/Vt*ExMax*(vbe/Vt - EMax + 1) + Capcje
+     else Tauf*Is/Vt*Modelica.Math.exp(vbe/Vt) + Capcje;
+
+  C.i = (ibe - ibc)*qbk - ibc/Br - cbc*der(vbc) + Ccs*der(C.v);
+  B.i = ibe/Bf + ibc/Br + cbc*der(vbc) + cbe*der(vbe);
+  E.i = -B.i - C.i + Ccs*der(C.v);
+end NPN;
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/NPN.sci b/scilab/modules/scicos_blocks/macros/Electrical/NPN.sci
new file mode 100644 (file)
index 0000000..585948c
--- /dev/null
@@ -0,0 +1,261 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+\r
+function [x,y,typ]=NPN(job,arg1,arg2)\r
+// the automatically generated interface block for Modelica NPN.mo model\r
+//   - avec un dialogue de saisie de parametre\r
+x=[];y=[];typ=[];\r
+select job\r
+case 'plot' then\r
+  standard_draw(arg1,%f,NPN_draw_ports)\r
+case 'getinputs' then\r
+  [x,y,typ]=NPN_inputs(arg1)\r
+case 'getoutputs' then\r
+  [x,y,typ]=NPN_outputs(arg1)\r
+case 'getorigin' then\r
+  [x,y]=standard_origin(arg1)\r
+case 'set' then\r
+  x=arg1;\r
+  graphics=arg1.graphics;exprs=graphics.exprs\r
+  model=arg1.model;\r
+x=arg1\r
+exprs=x.graphics.exprs\r
+while %t do\r
+  [ok,Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax,exprs]=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)\r
+  if ~ok then break,end\r
+  x.model.equations.parameters(2)=list(Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax)\r
+  x.graphics.exprs=exprs\r
+  break\r
+end\r
+ case 'define' then      \r
+ModelName="NPN"\r
+PrametersValue=[50;0.1;0;0.02;1.200D-10;5.000D-09;1.000D-12;4.000D-13;5.000D-13;0.8;0.4;0.8;0.333;1.000D-15;1.000D-15;0.02585;40]\r
+ParametersName=["Bf";"Br";"Is";"Vak";"Tauf";"Taur";"Ccs";"Cje";"Cjc";"Phie";"Me";"Phic";"Mc";"Gbc";"Gbe";"Vt";"EMinMax"]\r
+model=scicos_model()                  \r
+Typein=[];Typeout=[];MI=[];MO=[]       \r
+P=[100,90,-2,0; 0,50,2,0; 100,10,-2,0]\r
+PortName=["C";"B";"E"]\r
+for i=1:size(P,'r')                                             \r
+  if P(i,3)==1  then  Typein= [Typein; 'E'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==2  then  Typein= [Typein; 'I'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==-1 then  Typeout=[Typeout;'E'];MO=[MO;PortName(i)];end\r
+  if P(i,3)==-2 then  Typeout=[Typeout;'I'];MO=[MO;PortName(i)];end\r
+end\r
+model=scicos_model()\r
+mo=modelica()\r
+model.sim=ModelName;\r
+mo.inputs=MI;\r
+mo.outputs=MO;\r
+model.rpar=PrametersValue;\r
+mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));\r
+exprs=["50";"0.1";"1.e-16";"0.02";"0.12e-9";"5e-9";"1e-12";"0.4e-12";"0.5e-12";"0.8";"0.4";"0.8";"0.333";"1e-15";"1e-15";"0.02585";"40"]\r
+gr_i=["";"if orient then";"  xpolys(orig(1)+[0.45,0.45,0.65,0.45,0.65,1;0.45,0,0.45,0.65,1,0.65]*sz(1),orig(2)+[0.8333333,0.5,0.9166667,0.4166667,0.0833333,0.9166667;0.1666667,0.5,0.5833333,0.0833333,0.0833333,0.9166667]*sz(2),[1,1,1,1,1,1])";"  xset(''color'',0)";"  xfpolys(orig(1)+[0.65;0.62;0.58;0.65]*sz(1),orig(2)+[0.0833333;0.2;0.1333333;0.0833333]*sz(2),2)";"else";"  xpolys(orig(1)+[0.55,0.55,0.35,0.55,0.35,0;0.55,1,0.55,0.35,0,0.35]*sz(1),orig(2)+[0.8333333,0.5,0.9166667,0.4166667,0.0833333,0.9166667;0.1666667,0.5,0.5833333,0.0833333,0.0833333,0.9166667]*sz(2),[1,1,1,1,1,1])";"  xset(''color'',0)";"  xfpolys(orig(1)+[0.35;0.38;0.42;0.35]*sz(1),orig(2)+[0.0833333;0.2;0.1333333;0.0833333]*sz(2),2)";"end"]\r
+model.blocktype='c'                              \r
+model.dep_ut=[%f %t]                               \r
+mo.model=ModelName                                 \r
+model.equations=mo                                 \r
+model.in=ones(size(MI,'*'),1)                    \r
+model.out=ones(size(MO,'*'),1)                   \r
+x=standard_define([2,1.2],model,exprs,list(gr_i,0))  \r
+x.graphics.in_implicit=Typein;                     \r
+x.graphics.out_implicit=Typeout;                   \r
+end\r
+endfunction\r
+//=========================\r
+function NPN_draw_ports(o)\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  xset('pattern',default_color(0))\r
+  // draw input/output ports\r
+  //------------------------\r
+  // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]\r
+  P=[100,90,-2,0;0,50,2,0;100,10,-2,0]\r
+\r
+  //============================\r
+  // setting the input/ outputs and direction\r
+  // implicit port: if it's located in the right it's output and while,\r
+  // else black\r
+  // explicit ports:\r
+    \r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  xset('pattern',default_color(1))           \r
+  xset('thickness',1)   \r
+   \r
+  if orient then\r
+    for i=1:size(P,'r')      \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if  P(i,3)==-1 then\r
+       outR=out*R;\r
+       xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)           \r
+      end  \r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       in2R=in2*R;                     \r
+       xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)       \r
+      end\r
+      \r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)     \r
+      end\r
+    end  \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-1 then // explicit\r
+       outR=out*R;\r
+       xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+        in2R=in2*R;                    \r
+          xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)\r
+      end\r
+    end          \r
+  end\r
+endfunction \r
+//=========================\r
+function [x,y,typ]=NPN_inputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  //[orig,sz,orient]=o(2)(1:3);\r
+  inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);\r
+  \r
+  // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]\r
+  P=[100,90,-2,0;0,50,2,0;100,10,-2,0]\r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[]\r
+  if orient then\r
+    for i=1:size(P,'r')   \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+     R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
\r
+endfunction\r
+//=========================\r
+function [x,y,typ]=NPN_outputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  out=size(o.model.out,1);clkout=size(o.model.evtout,1);\r
+  P=[100,90,-2,0;0,50,2,0;100,10,-2,0]\r
\r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[];\r
+  if orient then\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end \r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];            \r
+      end            \r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end\r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
+endfunction\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/OpAmp.mo b/scilab/modules/scicos_blocks/macros/Electrical/OpAmp.mo
new file mode 100644 (file)
index 0000000..d432c97
--- /dev/null
@@ -0,0 +1,36 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+class OpAmp 
+//  parameter Real OLGain=1000 "Open Loop gain";
+//  parameter Real SatH=10  "Positive saturation voltage";
+//  parameter Real SatL=-10 "Negative Saturation voltage";
+  Pin in_p "Positive pin of the input port";
+  Pin in_n "Negative pin of the input port";
+  Pin out "Output pin";
+equation 
+  in_p.i = 0;
+  in_n.i = 0;
+  in_p.v - in_n.v=0;
+end OpAmp;
+  
+
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/OpAmp.sci b/scilab/modules/scicos_blocks/macros/Electrical/OpAmp.sci
new file mode 100644 (file)
index 0000000..fe3c5d7
--- /dev/null
@@ -0,0 +1,89 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=OpAmp(job,arg1,arg2)
+  x=[];y=[];typ=[]
+  select job
+   case 'plot' then
+    standard_draw(arg1,%f) 
+   case 'getinputs' then
+    [x,y,typ]=standard_inputs(arg1)
+   case 'getoutputs' then
+    [x,y,typ]=standard_outputs(arg1)
+   case 'getorigin' then
+    [x,y]=standard_origin(arg1)
+   case 'set' then
+    x=arg1;
+    graphics=arg1.graphics;exprs=graphics.exprs
+    model=arg1.model;
+    while %f do
+     [ok,OLGain,SatH,SatL,exprs]=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 then break,end
+    model.equations.parameters(2)=list(OLGain,SatH,SatL)
+    graphics.exprs=exprs
+    x.graphics=graphics;x.model=model
+    break
+  end
+case 'define' then
+//  OLGain=1000;
+//  SatH=10;
+ // SatL=-10;
+ // S=['OLGain';'SatH';'SatL'];
+ // Z=eval(S);
+  S=[];
+  Z=[];
+  model=scicos_model();
+  model.sim='OpAmp';
+  model.blocktype='c';
+  model.dep_ut=[%t %f];
+  mo=modelica();
+  mo.model=model.sim;
+  mo.inputs=['in_p';'in_n'];
+  mo.outputs=['out'];
+  mo.parameters=list(S,Z);
+  model.equations=mo;
+  model.in=ones(size(mo.inputs,'*'),1);
+  model.out=ones(size(mo.outputs,'*'),1);
+  model.rpar=Z;
+  exprs=string(Z);
+  gr_i=['';
+      'if orient then';
+      '  xx=orig(1)+[30,28,08,08,00,08,08,00,08,08,28,28]*(sz(1)/32);';
+      '  xstring(orig(1)+10*(sz(1)/32),orig(2)+24*(sz(2)/70),''-'');';
+      '  xstring(orig(1)+10*(sz(1)/32),orig(2)+46*(sz(2)/70),''+'');';
+    'else';
+      '  xx=orig(1)+[02,04,24,24,32,24,24,32,24,24,04,04]*(sz(1)/32);';
+      '  xstring(orig(1)+20*(sz(1)/32),orig(2)+24*(sz(2)/70),''-'');';
+      '  xstring(orig(1)+20*(sz(1)/32),orig(2)+46*(sz(2)/70),''+'');';
+    'end';
+    'yy=orig(2)+[35,35,12,24,24,24,48,48,48,60,35,35]*(sz(2)/70);';
+    'xpoly(xx,yy);';
+    'xstring(orig(1)+13*(sz(1)/32),orig(2)+30*(sz(2)/70),''OP'');';
+       ''];
+  x=standard_define([2 2],model,exprs,gr_i)
+  x.graphics.in_implicit=['I';'I']
+  x.graphics.out_implicit=['I']
+  end
+endfunction
+// OpAmp
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/OutPort.mo b/scilab/modules/scicos_blocks/macros/Electrical/OutPort.mo
new file mode 100644 (file)
index 0000000..3019512
--- /dev/null
@@ -0,0 +1,24 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model OutPort
+  output Real v;
+end OutPort;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/OutPutPort.mo b/scilab/modules/scicos_blocks/macros/Electrical/OutPutPort.mo
new file mode 100644 (file)
index 0000000..936910e
--- /dev/null
@@ -0,0 +1,29 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+
+  model OutPutPort
+    output Real vo;
+    Real vi;
+   equation
+    vi = vo;
+  end OutPutPort;
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/PMOS.mo b/scilab/modules/scicos_blocks/macros/Electrical/PMOS.mo
new file mode 100644 (file)
index 0000000..df67d1f
--- /dev/null
@@ -0,0 +1,60 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+class PMOS "Simple MOS Transistor" 
+  parameter Real W=50.0e-6 "Width";
+  parameter Real L=6.0e-6 "Length";
+  parameter Real Beta=0.0105e-3 "Transconductance parameter";
+  parameter Real Vt=-1 "Zero bias threshold voltage";
+  parameter Real K2=0.41 "Bulk threshold parameter";
+  parameter Real K5=0.839 "Reduction of pinch-off region";
+  parameter Real dW=-2.5e-6 "Narrowing of channel";
+  parameter Real dL=-2.1e-6 "Shortening of channel";
+  parameter Real RDS=1.e+7 "Drain-Source-Resistance";
+
+  Pin D "Drain";
+  Pin G "Gate";
+  Pin S "Source";
+  Pin B "Bulk";
+
+  Real v;
+  Real uds;
+  Real ubs;
+  Real ugst;
+  Real ud;
+  Real us;
+  Real id,gds;
+equation 
+  gds = 1/RDS;//if (RDS < 1.e-20 and RDS > -1.e-20) then 1.e20 else 1/RDS;
+  v = Beta*(W + dW)/(L + dL);
+  ud = if noEvent(D.v > S.v) then S.v else D.v;
+  us = if noEvent(D.v > S.v) then D.v else S.v;
+  uds = ud - us;
+  ubs = if noEvent(B.v < us) then 0 else B.v - us;
+  ugst = (G.v - us - Vt + K2*ubs)*K5;
+  id = if noEvent(ugst >= 0) then uds*gds else if noEvent(ugst < uds) then -v*uds*(
+    ugst - uds/2) + uds*gds else -v*ugst*ugst/2 + uds*gds;
+  G.i = 0;
+  D.i = if noEvent(D.v > S.v) then -id else id;
+  S.i = -D.i;
+  B.i = 0;
+end PMOS;
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/PMOS.sci b/scilab/modules/scicos_blocks/macros/Electrical/PMOS.sci
new file mode 100644 (file)
index 0000000..b23b7c8
--- /dev/null
@@ -0,0 +1,109 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=PMOS(job,arg1,arg2)
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+standard_draw(arg1,%f) 
+
+case 'getinputs' then
+   [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+   [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs]=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 then break,end
+    model.equations.parameters(2)=list(W,L,Beta,Vt,K2,K5,dW,dL,RDS)
+    graphics.exprs=exprs
+    x.graphics=graphics;x.model=model
+    break
+  end
+case 'define' then
+  model=scicos_model()
+   W=50.0e-6;
+   L=6.0e-6;
+   Beta=0.0105e-3;
+   Vt=-1;
+   K2=0.41;
+   K5=0.839;
+   dW=-2.5e-6;
+   dL=-2.1e-6;
+   RDS=1.e+7;
+  model.sim='PMOS'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+  mo.model='PMOS';
+  mo.outputs=['D';'B';'S']
+  mo.inputs='G';
+  mo.parameters=list(['W';'L';'Beta';'Vt';'K2';'K5';'dW';'dL';'RDS'],[W;L;Beta;Vt;K2;K5;dW;dL;RDS])
+  model.equations=mo
+  model.in=ones(size(mo.inputs,'*'),1)
+  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=[' Thick=xget(''thickness'');xset(''thickness'',2);';\r
+    'if orient then,'; 
+        'x1=orig(1)+  [0, 15,15,15]*(sz(1)/32);';
+               'x2=orig(1)+[17,17,19,19,32,19,19,17]*(sz(1)/32);';
+               'x3=orig(1)+  [17,17,19,19,22, 22,27,32,27,22,22,19,19,17]*(sz(1)/32);';
+               'x4=orig(1)+[17,17,19,19,32,19,19,17]*(sz(1)/32);';
+    'else,';
+        'x1=orig(1)+  [32, 17,17,17]*(sz(1)/32);';
+               'x2=orig(1)+[15,15,13,13,0,13,13,15]*(sz(1)/32);';
+               'x3=orig(1)+  [15,15,13,13,10, 10, 5, 0,05,10,10,13,13,15]*(sz(1)/32);';
+               'x4=orig(1)+[15,15,13,13,0,13,13,15]*(sz(1)/32);';
+    'end,'
+       'y1=orig(2)+5+[27,27,48,27]*(sz(2)/70);';\r
+       'y2=orig(2)+5+[48,40,40,44,44,44,48,48]*(sz(2)/70);';\r
+       'y3=orig(2)+5+[30,23,23,27,27, 31,27,27,27,23,27,27,30,30]*(sz(2)/70);';\r
+       'y4=orig(2)+5+[16,7,7, 11,11, 11, 16,16]*(sz(2)/70);';\r
+       'xpoly(x1,y1);';\r
+       'xpoly(x2,y2);';\r
+       'xpoly(x3,y3);';\r
+       'xpoly(x4,y4);';\r
+       'xset(''thickness'',Thick);'\r
+       ]
+    
+  x=standard_define([2 2],model,exprs,gr_i)
+  x.graphics.in_implicit=['I']
+  x.graphics.out_implicit=['I';'I';'I']
+end
+endfunction
+
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/PNP.mo b/scilab/modules/scicos_blocks/macros/Electrical/PNP.mo
new file mode 100644 (file)
index 0000000..399b221
--- /dev/null
@@ -0,0 +1,91 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+class PNP "Simple BJT according to Ebers-Moll" 
+  parameter Real Bf=50 "Forward beta";
+  parameter Real Br=0.1 "Reverse beta";
+  parameter Real Is=1.e-16 "Transport saturation current";
+  parameter Real Vak=0.02 "Early voltage (inverse), 1/Volt";
+  parameter Real Tauf=0.12e-9 "Ideal forward transit time";
+  parameter Real Taur=5e-9 "Ideal reverse transit time";
+  parameter Real Ccs=1e-12 "Collector-substrat(ground) cap.";
+  parameter Real Cje=0.4e-12 "Base-emitter zero bias depletion cap.";
+  parameter Real Cjc=0.5e-12 "Base-coll. zero bias depletion cap.";
+  parameter Real Phie=0.8 "Base-emitter diffusion voltage";
+  parameter Real Me=0.4 "Base-emitter gradation exponent";
+  parameter Real Phic=0.8 "Base-collector diffusion voltage";
+  parameter Real Mc=0.333 "Base-collector gradation exponent";
+  parameter Real Gbc=1e-15 "Base-collector conductance";
+  parameter Real Gbe=1e-15 "Base-emitter conductance";
+  parameter Real Vt=0.02585 "Voltage equivalent of temperature";
+  parameter Real EMinMax=40 "if x < EMin, the exp(x) function is linearized";
+  Real vbc;
+  Real vbe;
+  Real qbk;
+  Real ibc;
+  Real ibe;
+  Real cbc;
+  Real cbe;
+  Real ExMin;
+  Real ExMax;
+  Real Capcje;
+  Real Capcjc;
+  Real EMax;
+  Real EMin;
+
+  Pin C "Collector";
+  Pin B "Base";
+  Pin E "Emitter";
+equation 
+  EMax=EMinMax;
+  EMin=-2*EMinMax;
+  ExMin = Modelica.Math.exp(EMin);
+  ExMax = Modelica.Math.exp(EMax);
+  vbc = C.v - B.v;
+  vbe = E.v - B.v;
+  qbk = 1 - vbc*Vak;
+  
+  ibc = if noEvent(vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc*
+    Gbc else if noEvent(vbc/Vt > EMax) then Is*(ExMax*(vbc/Vt - EMax + 1) - 1) + 
+    vbc*Gbc else Is*(Modelica.Math.exp(vbc/Vt) - 1) + vbc*Gbc;
+  
+  ibe = if noEvent(vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe*
+    Gbe else if noEvent(vbe/Vt > EMax) then Is*(ExMax*(vbe/Vt - EMax + 1) - 1) + 
+    vbe*Gbe else Is*(Modelica.Math.exp(vbe/Vt) - 1) + vbe*Gbe;
+  
+  Capcjc = if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*pow(1 - 
+    vbc/Phic, -Mc);
+  Capcje = if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*pow(1 - 
+    vbe/Phie, -Me);
+
+  cbc = if noEvent(vbc/Vt < EMin) then Taur*Is/Vt*ExMin*(vbc/Vt - EMin + 1) + 
+    Capcjc else if noEvent(vbc/Vt > EMax) then Taur*Is/Vt*ExMax*(vbc/Vt - EMax + 1)
+     + Capcjc else Taur*Is/Vt*Modelica.Math.exp(vbc/Vt) + Capcjc;
+  cbe = if noEvent(vbe/Vt < EMin) then Tauf*Is/Vt*ExMin*(vbe/Vt - EMin + 1) + 
+    Capcje else if noEvent(vbe/Vt > EMax) then Tauf*Is/Vt*ExMax*(vbe/Vt - EMax + 1)
+     + Capcje else Tauf*Is/Vt*Modelica.Math.exp(vbe/Vt) + Capcje;
+
+  C.i = -((ibe - ibc)*qbk - ibc/Br - cbc*der(vbc) + Ccs*der(C.v));
+  B.i = -(ibe/Bf + ibc/Br + cbe*der(vbe) + cbc*der(vbc));
+  E.i = -B.i - C.i - Ccs*der(C.v);
+end PNP;
+
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/PNP.sci b/scilab/modules/scicos_blocks/macros/Electrical/PNP.sci
new file mode 100644 (file)
index 0000000..731f33a
--- /dev/null
@@ -0,0 +1,262 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+\r
+function [x,y,typ]=PNP(job,arg1,arg2)\r
+// the automatically generated interface block for Modelica PNP.mo model\r
+//   - avec un dialogue de saisie de parametre\r
+x=[];y=[];typ=[];\r
+select job\r
+case 'plot' then\r
+  standard_draw(arg1,%f,PNP_draw_ports)\r
+case 'getinputs' then\r
+  [x,y,typ]=PNP_inputs(arg1)\r
+case 'getoutputs' then\r
+  [x,y,typ]=PNP_outputs(arg1)\r
+case 'getorigin' then\r
+  [x,y]=standard_origin(arg1)\r
+case 'set' then\r
+  x=arg1;\r
+  graphics=arg1.graphics;exprs=graphics.exprs\r
+  model=arg1.model;\r
+x=arg1\r
+exprs=x.graphics.exprs\r
+while %t do\r
+  [ok,Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax,exprs]=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)\r
+  if ~ok then break,end\r
+  x.model.equations.parameters(2)=list(Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax)\r
+  x.graphics.exprs=exprs\r
+  break\r
+end\r
\r
+ case 'define' then      \r
+ModelName="PNP"\r
+PrametersValue=[50;0.1;0;0.02;1.200D-10;5.000D-09;1.000D-12;4.000D-13;5.000D-13;0.8;0.4;0.8;0.333;1.000D-15;1.000D-15;0.02585;40]\r
+ParametersName=["Bf";"Br";"Is";"Vak";"Tauf";"Taur";"Ccs";"Cje";"Cjc";"Phie";"Me";"Phic";"Mc";"Gbc";"Gbe";"Vt";"EMinMax"]\r
+model=scicos_model()                  \r
+Typein=[];Typeout=[];MI=[];MO=[]       \r
+P=[100,90,-2,0;0,50,2,0;100,10,-2,0]\r
+PortName=["C";"B";"E"]\r
+for i=1:size(P,'r')                                             \r
+  if P(i,3)==1  then  Typein= [Typein; 'E'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==2  then  Typein= [Typein; 'I'];MI=[MI;PortName(i)];end\r
+  if P(i,3)==-1 then  Typeout=[Typeout;'E'];MO=[MO;PortName(i)];end\r
+  if P(i,3)==-2 then  Typeout=[Typeout;'I'];MO=[MO;PortName(i)];end\r
+end\r
+model=scicos_model()\r
+mo=modelica()\r
+model.sim=ModelName;\r
+mo.inputs=MI;\r
+mo.outputs=MO;\r
+model.rpar=PrametersValue;\r
+mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));\r
+exprs=["50";"0.1";"1.e-16";"0.02";"0.12e-9";"5e-9";"1e-12";"0.4e-12";"0.5e-12";"0.8";"0.4";"0.8";"0.333";"1e-15";"1e-15";"0.02585";"40"]\r
+gr_i=["";"if orient then";"  xpolys(orig(1)+[0.45,0.45,1,0.65,0.45,0.65;0.45,0.005,0.65,0.45,0.65,0.995]*sz(1),orig(2)+[0.8333333,0.5,0.9166667,0.9166667,0.4166667,0.0833333;0.1666667,0.5,0.9166667,0.5833333,0.0833333,0.0833333]*sz(2),[1,1,1,1,1,1])";"  xset(''color'',0)";"  xfpolys(orig(1)+[0.45;0.525;0.485;0.45]*sz(1),orig(2)+[0.4166667;0.3583333;0.2916667;0.4166667]*sz(2),2)";"else";"  xpolys(orig(1)+[0.55,0.55,0,0.35,0.55,0.35;0.55,0.995,0.35,0.55,0.35,0.005]*sz(1),orig(2)+[0.8333333,0.5,0.9166667,0.9166667,0.4166667,0.0833333;0.1666667,0.5,0.9166667,0.5833333,0.0833333,0.0833333]*sz(2),[1,1,1,1,1,1])";"  xset(''color'',0)";"  xfpolys(orig(1)+[0.55;0.475;0.515;0.55]*sz(1),orig(2)+[0.4166667;0.3583333;0.2916667;0.4166667]*sz(2),2)";"end"]\r
+model.blocktype='c'                              \r
+model.dep_ut=[%f %t]                               \r
+mo.model=ModelName                                 \r
+model.equations=mo                                 \r
+model.in=ones(size(MI,'*'),1)                    \r
+model.out=ones(size(MO,'*'),1)                   \r
+x=standard_define([2,1.2],model,exprs,list(gr_i,0))  \r
+x.graphics.in_implicit=Typein;                     \r
+x.graphics.out_implicit=Typeout;                   \r
+end\r
+endfunction\r
+//=========================\r
+function PNP_draw_ports(o)\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  xset('pattern',default_color(0))\r
+  // draw input/output ports\r
+  //------------------------\r
+  // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]\r
+  P=[100,90,-2,0;0,50,2,0;100,10,-2,0]\r
+\r
+  //============================\r
+  // setting the input/ outputs and direction\r
+  // implicit port: if it's located in the right it's output and while,\r
+  // else black\r
+  // explicit ports:\r
+    \r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  xset('pattern',default_color(1))           \r
+  xset('thickness',1)   \r
+   \r
+  if orient then\r
+    for i=1:size(P,'r')      \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if  P(i,3)==-1 then\r
+       outR=out*R;\r
+       xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)           \r
+      end  \r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       in2R=in2*R;                     \r
+       xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)       \r
+      end\r
+      \r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)     \r
+      end\r
+    end  \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      \r
+      if P(i,3)==1 then // explicit\r
+       inR=in*R;\r
+       xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-1 then // explicit\r
+       outR=out*R;\r
+       xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      \r
+      if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+        in2R=in2*R;                    \r
+          xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)      \r
+      end\r
+      if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.\r
+       out2R=out2*R;\r
+       xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, 'lines',1)\r
+      end\r
+    end          \r
+  end\r
+endfunction \r
+//=========================\r
+function [x,y,typ]=PNP_inputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  //[orig,sz,orient]=o(2)(1:3);\r
+  inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);\r
+  \r
+  // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]\r
+  P=[100,90,-2,0;0,50,2,0;100,10,-2,0]\r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[]\r
+  if orient then\r
+    for i=1:size(P,'r')   \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+     R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==1 then // explicit_input\r
+       inR=in($,:)*R;\r
+         x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];\r
+        y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];\r
+        typ=[typ,1];\r
+      end\r
+      if(P(i,3)==2) then  // implicit\r
+       in2R=in2($,:)*R; \r
+       x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
\r
+endfunction\r
+//=========================\r
+function [x,y,typ]=PNP_outputs(o)\r
+// Copyright INRIA\r
+  xf=60\r
+  yf=40\r
+  [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)\r
+  out=size(o.model.out,1);clkout=size(o.model.evtout,1);\r
+  P=[100,90,-2,0;0,50,2,0;100,10,-2,0]\r
\r
+  in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle  \r
+  out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle  \r
+  in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])\r
+  out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])\r
+  \r
+  x=[];y=[];typ=[];\r
+  if orient then\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end \r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];            \r
+      end            \r
+    end      \r
+  else\r
+    for i=1:size(P,'r')     \r
+      theta=P(i,4)*%pi/180;\r
+      R=[cos(theta),sin(theta);sin(-theta),cos(theta)];\r
+      if (P(i,3))==-1 then // explicit_output\r
+       outR=out($,:)*R;\r
+       x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,1];\r
+      end\r
+      if(P(i,3)==-2) then  // implicit\r
+       out2R=out2($,:)*R;\r
+       x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];\r
+       y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];\r
+       typ=[typ,2];\r
+      end\r
+    end            \r
+  end\r
+  \r
+endfunction\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Pin.mo b/scilab/modules/scicos_blocks/macros/Electrical/Pin.mo
new file mode 100644 (file)
index 0000000..4352a92
--- /dev/null
@@ -0,0 +1,25 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+connector Pin\r
+       Real v;\r
+       flow Real i;\r
+end Pin;\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/PotentialSensor.mo b/scilab/modules/scicos_blocks/macros/Electrical/PotentialSensor.mo
new file mode 100644 (file)
index 0000000..2076290
--- /dev/null
@@ -0,0 +1,29 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model PotentialSensor 
+  Pin p;
+  Real v;
+ equation
+    p.i = 0;
+    v = p.v;
+ end PotentialSensor;
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/PotentialSensor.sci b/scilab/modules/scicos_blocks/macros/Electrical/PotentialSensor.sci
new file mode 100644 (file)
index 0000000..a030aac
--- /dev/null
@@ -0,0 +1,70 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]= PotentialSensor(job,arg1,arg2)
+// exemple d'un bloc implicit, 
+//   -  sans entree ni sortie de conditionnement
+//   -  avec une entree et une sortie de type implicit et de dimension 1
+//   - avec un dialogue de saisie de parametre
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  standard_draw(arg1,%f)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+case 'define' then
+  model=scicos_model()
+  model.in=[1];
+  model.out=[1];
+  model.rpar=[]
+  model.sim='PotentialSensor'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+  mo.model='PotentialSensor'
+  mo.inputs='p';
+  mo.outputs=['v']
+  model.equations=mo
+  gr_i=['xarc(orig(1)+sz(1)*1/8,orig(2)+sz(2)*4.3/5,sz(1)*3/4,sz(2)*3/4,0,360*64);';
+       'xsegs(orig(1)+sz(1)*[0 1/8],orig(2)+sz(2)*[1/2 1/2],0)';
+       ' xsegs(orig(1)+sz(1)*[7/8 1],orig(2)+sz(2)*[1/2 1/2],0)';
+       'xsegs(orig(1)+sz(1)*[1.5/8 2.5/8],orig(2)+sz(2)*[1.3/2 1.2/2],0)';
+       'xsegs(orig(1)+sz(1)*[2.5/8 3.2/8],orig(2)+sz(2)*[1.62/2 1.3/2],0)';
+       'xsegs(orig(1)+sz(1)*[1/2 1/2],orig(2)+sz(2)*[4.25/5 1.3/2],0)';
+       'xsegs(orig(1)+sz(1)*[4.9/8 5.5/8],orig(2)+sz(2)*[1.3/2 1.65/2],0)';
+       'xsegs(orig(1)+sz(1)*[5.5/8 6.5/8],orig(2)+sz(2)*[1.2/2 1.32/2],0)';
+       'xsegs(orig(1)+sz(1)*[1/2 4.5/8],orig(2)+sz(2)*[1/2 1.32/2],0) ';
+       'xfarc(orig(1)+sz(1)*0.93/2,orig(2)+sz(2)*1/2,sz(1)*0.2/4,sz(2)*0.2/4,0,360*64);';
+       ' xx=orig(1)+sz(1)*4.2/8+[.9 1 0 .9]*sz(1)/12;';
+       'yy=orig(2)+sz(2)*1.27/2+[0.1 1 0.3 0.1]*sz(2)/7;';
+       'xfpoly(xx,yy);']
+
+  x=standard_define([2 2],model,'',list(gr_i,0))
+  x.graphics.in_implicit=['I']
+  x.graphics.out_implicit=['E']
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Resistor.mo b/scilab/modules/scicos_blocks/macros/Electrical/Resistor.mo
new file mode 100644 (file)
index 0000000..daa9e87
--- /dev/null
@@ -0,0 +1,30 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model Resistor\r
+       Pin p, n;\r
+       parameter Real R "Resistance";\r
+\r
+equation\r
+       R*p.i = p.v - n.v;\r
+       p.i = -n.i;\r
+\r
+end Resistor;\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Resistor.sci b/scilab/modules/scicos_blocks/macros/Electrical/Resistor.sci
new file mode 100644 (file)
index 0000000..c1cb36a
--- /dev/null
@@ -0,0 +1,77 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=Resistor(job,arg1,arg2)
+// exemple d'un bloc implicit, 
+//   -  sans entree ni sortie de conditionnement
+//   -  avec une entree et une sortie de type implicit et de dimension 1
+//   - avec un dialogue de saisie de parametre
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  R=arg1.graphics.exprs;
+  standard_draw(arg1,%f)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,R,exprs]=getvalue('Set Resistor block parameter',..
+                          'R (ohm)',list('vec',1),exprs)
+    if ~ok then break,end
+    model.rpar=R
+    model.equations.parameters(2)=list(R)
+    graphics.exprs=exprs
+    x.graphics=graphics;x.model=model
+    break
+  end
+case 'define' then
+  model=scicos_model()
+  R=0.01
+  model.rpar=R
+  model.sim='resistor'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+    mo.model='Resistor'
+    mo.inputs='p';
+    mo.outputs='n';
+    mo.parameters=list('R',list(R))
+  model.equations=mo
+  model.in=ones(size(mo.inputs,'*'),1)
+  model.out=ones(size(mo.outputs,'*'),1)
+  exprs=string(R)
+  gr_i=[ 'xx=[0,1,1,7,7,8,7,7,1,1]/8;';
+        'yy=[1,1,0,0,1,1,1,2,2,1]/2;';
+        'xpoly(orig(1)+xx*sz(1),orig(2)+yy*sz(2)); '
+        'rect=xstringl(0,0,''R=''+R)'
+        'xstring(orig(1)+(sz(1)-rect(3))/2,orig(2)-rect(4)*1.2,''R=''+R);']  
+  x=standard_define([2 0.18],model,exprs,list(gr_i,0))
+  x.graphics.in_implicit=['I']
+  x.graphics.out_implicit=['I']
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/SineVoltage.mo b/scilab/modules/scicos_blocks/macros/Electrical/SineVoltage.mo
new file mode 100644 (file)
index 0000000..8bc6512
--- /dev/null
@@ -0,0 +1,39 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model SineVoltage "Sine voltage source" \r
+  parameter Real V=1 "Amplitude of sine wave";\r
+  parameter Real phase=0 "Phase of sine wave";\r
+  parameter Real freqHz=1 "Frequency of sine wave";\r
+  parameter Real offset=0 "Offset volatge of sine wave";\r
+  parameter Real startTime=0 "sine wave start time";\r
+  parameter Real PI=3.141592653589793;\r
+  Pin p, n;\r
+  Real v;\r
+  \r
+equation\r
+\r
+  v = offset + (if time < startTime then 0 else V*Modelica.Math.sin(2*PI*freqHz*(time - startTime) +phase));\r
+  v= p.v - n.v;        \r
+  0 = p.i + n.i;\r
+end SineVoltage;\r
+\r
+\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/SineVoltage.sci b/scilab/modules/scicos_blocks/macros/Electrical/SineVoltage.sci
new file mode 100644 (file)
index 0000000..64b4664
--- /dev/null
@@ -0,0 +1,86 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]= SineVoltage(job,arg1,arg2)
+// exemple d'un bloc implicit, 
+//   -  sans entree ni sortie de conditionnement
+//   -  avec une entree et une sortie de type implicit et de dimension 1
+//   - avec un dialogue de saisie de parametre
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  standard_draw(arg1,%f)
+case 'getinputs' then
+  [x,y,typ]=standard_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,V,ph,frq,offset,start,exprs]=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 then break,end
+    model.rpar=[V;ph;frq;offset;start]
+    model.equations.parameters(2)=list(V,ph,frq,offset,start)
+    graphics.exprs=exprs
+    x.graphics=graphics;x.model=model
+    break
+  end
+case 'define' then
+  model=scicos_model()
+  model.in=[1];
+  model.out=[1];
+  V=1
+  ph=0
+  frq=1
+  offset=0
+  start=0
+  model.rpar=[V;ph;frq;offset;start]
+  model.sim='SineVoltage'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+  mo.model='SineVoltage'
+  mo.inputs='p';
+  mo.outputs='n';
+  mo.parameters=list(['V';'phase';'freqHz';'offset';'startTime'],list(V,ph,frq,offset,start))
+  model.equations=mo
+  
+  exprs=[string(V);string(ph);string(frq);string(offset);string(start)]
+  
+  gr_i=['xarc(orig(1)+sz(1)*1/8,orig(2)+sz(2)*4.3/5,sz(1)*3/4,sz(2)*3/4,0,360*64);';
+       'xsegs(orig(1)+sz(1)*[0 1/8],orig(2)+sz(2)*[1/2 1/2],0)';
+       'xsegs(orig(1)+sz(1)*[7/8 1],orig(2)+sz(2)*[1/2 1/2],0)';
+       'V=string(model.rpar(1));'
+       'xstringb(orig(1),orig(2)+sz(2)*0.2,''~'',sz(1),sz(2)*0.3,''fill'')'
+       'xstringb(orig(1),orig(2)+sz(2)*0.5,V,sz(1),sz(2)*0.3,''fill'')']
+  
+  
+  x=standard_define([2 2],model,exprs,gr_i)
+  x.graphics.in_implicit=['I']
+  x.graphics.out_implicit=['I']
+end
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Switch.mo b/scilab/modules/scicos_blocks/macros/Electrical/Switch.mo
new file mode 100644 (file)
index 0000000..684f9c2
--- /dev/null
@@ -0,0 +1,32 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+class Switch\r
+  parameter Real Ron=0.01 "Resistance when the Switch is closed";\r
+  parameter Real Roff=1e5  "Resistance when the switch is open";\r
+  Pin p,n;\r
+  Real inp,Rx;\r
+equation\r
+  Rx*p.i= p.v - n.v;\r
+  p.i = -n.i;\r
+  Rx=if inp >0 then Ron        \r
+              else Roff;\r
+end Switch;\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Switch.sci b/scilab/modules/scicos_blocks/macros/Electrical/Switch.sci
new file mode 100644 (file)
index 0000000..554abd4
--- /dev/null
@@ -0,0 +1,163 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=Switch(job,arg1,arg2)
+// exemple d'un bloc implicit, 
+//   -  sans entree ni sortie de conditionnement
+//   -  avec une entree et une sortie de type implicit et de dimension 1
+//   - avec un dialogue de saisie de parametre
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  R=arg1.graphics.exprs;
+  standard_draw(arg1,%f,VR_draw_ports)  
+case 'getinputs' then
+  [x,y,typ]=VR_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,Ron,Roff,exprs]=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 then break,end  
+    model.equations.parameters(2)=list(Ron,Roff)
+    graphics.exprs=exprs
+    x.graphics=graphics;x.model=model
+    break
+  end
+case 'define' then
+  model=scicos_model()
+  Ron=0.01;
+  Roff=1e5;
+  S=['Ron';'Roff'];
+  Z=eval(S);
+  model.sim='Switch'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+  mo.model=model.sim
+  mo.inputs=['p';'inp'];
+  mo.outputs='n';
+  mo.parameters=list(S,Z);
+  model.equations=mo
+  model.in=ones(size(mo.inputs,'*'),1)
+  model.out=ones(size(mo.outputs,'*'),1)
+  model.rpar=Z;
+  exprs=string(Z);
+    gr_i=[' Thick=xget(''thickness'');xset(''thickness'',2);';\r
+    'x=orig(1)+[0,3,5.0]*sz(1)/8;';\r
+       'y=orig(2)+[1,1,2.5]*sz(2)/2;';
+       'xpoly(x,y,''lines'',0);';
+       'xpoly(orig(1)+3*sz(1)/8,orig(2)+1*sz(2)/2,''marks'',1);'; 
+       'x=orig(1)+[5,8]*sz(1)/8;';
+       'y=orig(2)+[1,1]*sz(2)/2;';
+       'xpoly(x,y,''lines'',0);';
+       'xstring(orig(1)+3,orig(2)+1.8,''sw'');';\r
+       'xset(''thickness'',Thick)'];
+  x=standard_define([2 0.18],model,exprs,list(gr_i,0))
+  x.graphics.in_implicit=['I';'E']
+  x.graphics.out_implicit=['I']
+end
+endfunction
+// Switch
+
+function VR_draw_ports(o)
+[orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
+    xset('pattern',default_color(0))
+    dy=sz(2)/2
+  // draw input/output ports
+  //------------------------
+  xset('pattern',default_color(1))
+  if orient then  //standard orientation
+    // set port shape
+    out2=[ 0  -1
+          1  -1
+          1   1
+          0   1]*diag([xf/7,yf/14])
+    
+    in2= [-1  -1
+          0  -1
+          0   1
+         -1   1]*diag([xf/7,yf/14])
+
+
+    xpoly(out2(:,1)+(orig(1)+sz(1)),..
+         out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
+
+    xfpoly(in2(:,1)+orig(1),..
+          in2(:,2)+(orig(2)+sz(2)-dy),1)       
+  else //tilded orientation
+      out2=[0  -1
+          -1  -1
+          -1   1
+           0   1]*diag([xf/7,yf/14])
+      
+      in2= [1  -1
+           0  -1
+           0   1
+           1   1]*diag([xf/7,yf/14])
+
+      
+      xset('pattern',default_color(1))
+      xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
+           out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)  
+
+      xfpoly(in2(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
+            in2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),1) 
+  end
+
+  // set port shape
+
+  in= [-1/14  1/7
+       0      0
+       1/14   1/7
+       -1/14  1/7]*diag([xf,yf])
+
+
+  dx=sz(1)/2
+    xfpoly(in(:,1)+ones(4,1)*(orig(1)+dx),..
+          in(:,2)+ones(4,1)*(orig(2)+sz(2)),1)
+
+
+endfunction 
+
+function [x,y,typ]=VR_inputs(o)
+  xf=60;yf=40
+  graphics=o.graphics
+  orig=graphics.orig;sz=graphics.sz;
+  if graphics.flip then
+    xo=orig(1);dx=-xf/7
+  else
+    xo=orig(1)+sz(1);dx=yf/7
+  end
+  y=orig(2)+sz(2)/2
+  x=(xo+dx)*ones(y)
+  
+  x=[x,orig(1)+(sz(1)/2)]
+  y=[y,orig(2)+yf/7+sz(2)]
+  typ=[2 1]
+endfunction
+
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/VVsourceAC.mo b/scilab/modules/scicos_blocks/macros/Electrical/VVsourceAC.mo
new file mode 100644 (file)
index 0000000..45669bb
--- /dev/null
@@ -0,0 +1,32 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model VVsourceAC "Sin-wave voltage source"\r
+       Pin p, n;\r
+       Real v;\r
+       Real VA "voltage";\r
+       parameter Real f = 50 "Frequency";\r
+       parameter Real PI=3.141592653589793;\r
+equation\r
+       v = VA*Modelica.Math.sin(2*PI*f*time);\r
+       v = p.v - n.v;\r
+       0 = p.i + n.i;\r
+end VVsourceAC;\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/VVsourceAC.sci b/scilab/modules/scicos_blocks/macros/Electrical/VVsourceAC.sci
new file mode 100644 (file)
index 0000000..ba3be3a
--- /dev/null
@@ -0,0 +1,157 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=VVsourceAC(job,arg1,arg2)
+// exemple d'un bloc implicit, 
+//   -  sans entree ni sortie de conditionnement
+//   -  avec une entree et une sortie de type implicit et de dimension 1
+//   - avec un dialogue de saisie de parametre
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  standard_draw(arg1,%f,VVac_draw_ports)
+case 'getinputs' then
+  [x,y,typ]=VVac_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+  graphics=arg1.graphics;exprs=graphics.exprs
+  model=arg1.model;
+  while %t do
+    [ok,FR,exprs]=getvalue('Set voltage source parameter',..
+                          ['Frequency (Hz)'],..
+                             list('vec',-1),exprs)
+    if ~ok then break,end
+    model.rpar=[FR]
+    model.equations.parameters(2)=list(FR)
+    graphics.exprs=exprs
+    x.graphics=graphics;x.model=model
+    break
+  end
+case 'define' then
+  model=scicos_model()
+  model.in=[1;1];
+  model.out=[1];
+  VA=220
+  FR=50
+  model.rpar=[FR]
+  model.sim='VVsourceAC'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+  mo.model='VVsourceAC'
+  mo.inputs=['p','VA'];
+  mo.outputs='n';
+  mo.parameters=list(['f'],list(FR))
+  model.equations=mo
+  
+  exprs=[string(FR)]
+  gr_i=['xarc(orig(1)+sz(1)*1/8,orig(2)+sz(2)*4.3/5,sz(1)*3/4,sz(2)*3/4,0,360*64);';
+       'xsegs(orig(1)+sz(1)*[0 1/8],orig(2)+sz(2)*[1/2 1/2],0)';
+       'xsegs(orig(1)+sz(1)*[7/8 1],orig(2)+sz(2)*[1/2 1/2],0)';
+       'V=string(model.rpar(1));'
+       'xstringb(orig(1),orig(2)+sz(2)*0.2,''~'',sz(1),sz(2)*0.3,''fill'')'
+       'xstringb(orig(1),orig(2)+sz(2)*0.5,V,sz(1),sz(2)*0.3,''fill'')']
+  x=standard_define([2 2],model,exprs,list(gr_i,0))
+  x.graphics.in_implicit=['I','E']
+  x.graphics.out_implicit=['I']
+end
+endfunction
+function VVac_draw_ports(o)
+[orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
+    xset('pattern',default_color(0))
+    dy=sz(2)/2
+  // draw input/output ports
+  //------------------------
+  xset('pattern',default_color(1))
+  if orient then  //standard orientation
+    // set port shape
+    out2=[ 0  -1
+          1  -1
+          1   1
+          0   1]*diag([xf/7,yf/14])
+    
+    in2= [-1  -1
+          0  -1
+          0   1
+         -1   1]*diag([xf/7,yf/14])
+
+
+    xpoly(out2(:,1)+(orig(1)+sz(1)),..
+         out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
+
+    xfpoly(in2(:,1)+orig(1),..
+          in2(:,2)+(orig(2)+sz(2)-dy),1)       
+  else //tilded orientation
+      out2=[0  -1
+          -1  -1
+          -1   1
+           0   1]*diag([xf/7,yf/14])
+      
+      in2= [1  -1
+           0  -1
+           0   1
+           1   1]*diag([xf/7,yf/14])
+
+      
+      xset('pattern',default_color(1))
+      xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
+           out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)  
+
+      xfpoly(in2(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
+            in2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),1) 
+  end
+
+  // set port shape
+
+  in= [-1/14  1/7
+       0      0
+       1/14   1/7
+       -1/14  1/7]*diag([xf,yf])
+
+
+  dx=sz(1)/2
+    xfpoly(in(:,1)+ones(4,1)*(orig(1)+dx),..
+          in(:,2)+ones(4,1)*(orig(2)+sz(2)),1)
+
+
+endfunction 
+
+function [x,y,typ]=VVac_inputs(o)
+  xf=60;yf=40
+  graphics=o.graphics
+  orig=graphics.orig;sz=graphics.sz;
+  if graphics.flip then
+    xo=orig(1);dx=-xf/7
+  else
+    xo=orig(1)+sz(1);dx=yf/7
+  end
+  y=orig(2)+sz(2)/2
+  x=(xo+dx)*ones(y)
+  
+  x=[x,orig(1)+(sz(1)/2)]
+  y=[y,orig(2)+yf/7+sz(2)]
+  typ=[2 1]
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/VariableResistor.mo b/scilab/modules/scicos_blocks/macros/Electrical/VariableResistor.mo
new file mode 100644 (file)
index 0000000..6292851
--- /dev/null
@@ -0,0 +1,28 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *\r
+ * See the file ../license.txt\r
+*/\r
+
+model VariableResistor\r
+       Pin p, n;\r
+       Real R "Resistance";\r
+equation\r
+       R*p.i = p.v - n.v;\r
+       p.i = -n.i;\r
+end VariableResistor;\r
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/VariableResistor.sci b/scilab/modules/scicos_blocks/macros/Electrical/VariableResistor.sci
new file mode 100644 (file)
index 0000000..02cab6b
--- /dev/null
@@ -0,0 +1,136 @@
+//  Scicos\r
+//\r
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+//\r
+// This program is free software; you can redistribute it and/or modify\r
+// it under the terms of the GNU General Public License as published by\r
+// the Free Software Foundation; either version 2 of the License, or\r
+// (at your option) any later version.\r
+//\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software\r
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+//\r
+// See the file ../license.txt\r
+//\r
+
+function [x,y,typ]=VariableResistor(job,arg1,arg2)
+// exemple d'un bloc implicit, 
+//   -  sans entree ni sortie de conditionnement
+//   -  avec une entree et une sortie de type implicit et de dimension 1
+//   - avec un dialogue de saisie de parametre
+x=[];y=[];typ=[];
+select job
+case 'plot' then
+  R=arg1.graphics.exprs;
+  standard_draw(arg1,%f,VR_draw_ports)
+case 'getinputs' then
+  [x,y,typ]=VR_inputs(arg1)
+case 'getoutputs' then
+  [x,y,typ]=standard_outputs(arg1)
+case 'getorigin' then
+  [x,y]=standard_origin(arg1)
+case 'set' then
+  x=arg1;
+case 'define' then
+  model=scicos_model()
+  model.sim='VariableResistor'
+  model.blocktype='c'
+  model.dep_ut=[%t %f]
+  mo=modelica()
+    mo.model='VariableResistor'
+    mo.inputs=['p','R'];
+    mo.outputs='n';
+  model.equations=mo
+  model.in=ones(size(mo.inputs,'*'),1)
+  model.out=ones(size(mo.outputs,'*'),1)
+  exprs=[]
+  gr_i=[ 'xx=[0,1,1,7,7,8,7,7,1,1]/8;';
+        'yy=[1,1,0,0,1,1,1,2,2,1]/2;';
+        'xpoly(orig(1)+xx*sz(1),orig(2)+yy*sz(2)); ']  
+  x=standard_define([2 0.18],model,exprs,list(gr_i,0))
+  x.graphics.in_implicit=['I','E']
+  x.graphics.out_implicit=['I']
+end
+endfunction
+function VR_draw_ports(o)
+[orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
+    xset('pattern',default_color(0))
+    dy=sz(2)/2
+  // draw input/output ports
+  //------------------------
+  xset('pattern',default_color(1))
+  if orient then  //standard orientation
+    // set port shape
+    out2=[ 0  -1
+          1  -1
+          1   1
+          0   1]*diag([xf/7,yf/14])
+    
+    in2= [-1  -1
+          0  -1
+          0   1
+         -1   1]*diag([xf/7,yf/14])
+
+
+    xpoly(out2(:,1)+(orig(1)+sz(1)),..
+         out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
+
+    xfpoly(in2(:,1)+orig(1),..
+          in2(:,2)+(orig(2)+sz(2)-dy),1)       
+  else //tilded orientation
+      out2=[0  -1
+          -1  -1
+          -1   1
+           0   1]*diag([xf/7,yf/14])
+      
+      in2= [1  -1
+           0  -1
+           0   1
+           1   1]*diag([xf/7,yf/14])
+
+      
+      xset('pattern',default_color(1))
+      xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
+           out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)  
+
+      xfpoly(in2(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
+            in2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),1) 
+  end
+
+  // set port shape
+
+  in= [-1/14  1/7
+       0      0
+       1/14   1/7
+       -1/14  1/7]*diag([xf,yf])
+
+
+  dx=sz(1)/2
+    xfpoly(in(:,1)+ones(4,1)*(orig(1)+dx),..
+          in(:,2)+ones(4,1)*(orig(2)+sz(2)),1)
+
+
+endfunction 
+
+function [x,y,typ]=VR_inputs(o)
+  xf=60;yf=40
+  graphics=o.graphics
+  orig=graphics.orig;sz=graphics.sz;
+  if graphics.flip then
+    xo=orig(1);dx=-xf/7
+  else
+    xo=orig(1)+sz(1);dx=yf/7
+  end
+  y=orig(2)+sz(2)/2
+  x=(xo+dx)*ones(y)
+  
+  x=[x,orig(1)+(sz(1)/2)]
+  y=[y,orig(2)+yf/7+sz(2)]
+  typ=[2 1]
+endfunction
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/VoltageSensor.mo b/scilab/modules/scicos_blocks/macros/Electrical/VoltageSensor.mo
new file mode 100644 (file)
index 0000000..2d439c0
--- /dev/null
@@ -0,0 +1,31 @@
+/*  Scicos\r
+ *\r
+ *  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+&