Shunt with Conveyer and control in the C script


Schematic

CASPOC Schematic

Components

Questions and remarks

A position control is made for theis conveyer, where the position is the input for hte Cscript.


The code for the Cscript block is given below.




int v;

main()
{
if(state==0)
{v=10;
if(b>8)state=1;
}

if(state==1)
{v=-10;
if(b<2)state=0;
}


return(v);
}


If the position b (second input of the block) crosses 2 or 8, the state of the control toggles, as indicated by the two lights. During the animation of this circuit, you will see the load on the conveyer moving and the lights signals the state of the control.

The controlling voltage for the voltage source is returned in the variable v.

The state of the control is exported from the Cscript using the block Cvar, which directly drives one of the lights.


SCOPE2:
Scope output




SCOPE1:
Scope output




SCOPE3:
Scope output




SCOPE4:
Scope output




Circuit information

File name = shunt_conveyorcscript.csi
Tscreen = 8.000
Integration stepsize = 1000.000u
Number of blocks = 15
Number of circuit nodes + voltage sources = 2

General information


Visit Caspoc.com