I need some help converting function block diagram to sturctured text.
My function program.
PROGRAMMP_Linje_4VARÂ Â MP_Linje_4:FbMpBusMaster;Â Â MPBus:typMpBus;Â Â ErrorMasterLinje4:BYTE;Â Â MP_Adr_Linje_4:FbMpBusAddressing;Â Â L4_Address:BYTE;Â Â L4_Set:BOOL;Â Â L4_SetSerialNo:typSerialNo;Â Â L4_Adr_Ready:BOOL;Â Â L4_Adr_Error:BYTE;Â Â L4_Learn:BOOL;Â Â TILLUFT_MAX_POS_L4:REAL;Â Â AVTREKK_MAX_POS_L4:REAL;Â Â MP_Node_1_READY:BOOL;Â Â X360_005_SQ52093A:FbMpBusVav;Â Â X360_005_SQ52093A_ERROR:BYTE;Â Â X360_005_SQ52093A_POS:REAL;Â Â X360_005_SQ52093A_VOL_PERC:REAL;Â Â X360_005_SQ52093A_VOL_M3H:REAL;Â Â X360_005_SQ52093A_CRI:BOOL;Â Â X360_005_SQ52093A_MOL:BOOL;Â Â X360_005_SQ52093A_AH:BOOL;END_VAR
Please helpe me with some examples on how I can do thise.
Espen
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
make a new function block with name mp_linje_ST for example (type obvious ST)
now copy all vars into the new FB
get to line 1 in program:
press F2 and find the FB MP_Linje_4 (I just saw that you have a program and a FB with same name (dont do it, it is confusing the compiler, every name should be unique, i use prgprogramname fbfunctionblockname etc. There is a naming convention in the helpfile.
change the name of the block to same as you gave it in the FBprogram.
go to the first := and fill in the variable also with F2
the := are inputs and the >= are outputs.
rung 3 is complicated to make in ST but possible.
use tabs to get all aligned.
the functions work by using a var:=FuBACNETPV_TO_BOOL(bacnet.BY....);
btw i would use some smaller var names who is calling a function block X360_005_SQ52093A.
(above you see the convention Fu)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
(*MP_Linje_1*)FbMpBusMaster(  bModule_750_643:=1,  typMpBus:=MPBus,  bError=>ErrorMasterLinje1);(*MP_Adr_Linje_1*)FbMpBusAddressing(  bAddress:=L1_Address,  xSet:=L1_Set,  xGetSerialNo:=,  typINSerialNo:=L1_SetSerialNo,  tMaxLearnTime:=t#60s,  xLearn:=L1_Learn,  typMpBus:=MPBus,  xReady=>L1_Adr_Ready,  bError=>,  typOUTSerialNo=>);(*Program before xEnable*)MOpen:=FuBACnetBinaryPV_to_BOOL(BACnet.BY2200_360_005_SQ52070_MOpen.Present_Value)  EnableMP1:=var1ANDSFC_MP_L1.EnableMP_L1MClose:=FuBACnetBinaryPV_to_BOOL(BACnet.BY2200_360_005_SQ52070_MClose.Present_Value)  EnableMP2:=var2ANDSFC_MP_L1.EnableMP_L1    xEnable:=SFC_MP_L1.Node1ORvar4ORvar5(*Program before rAirVolum*)MPmax:=FuBACnetBinaryPV_to_BOOL(BACnet.BY2200_360_005_MPMAX.Present_Value)  AirVolum:=SEL(MPmax,BACnet.BY2200_570_205_RY62070_VENT_OP.Present_Value,100);(*Program before rAirVolum*)Reset:=FuBACnetBinaryPV_to_BOOL(BACnet.BY2200_360_005_SQ52070_Reset.Present_Value)(*X360_005_SQ52070*)FbMpBusVav(  xEnable:=xEnable,  tCycleTime:=t#3s,  bAddress:=1,  rAirVolume:=MPmax,  rMinAirVolume:=,  rMaxAirVolume:=,  xSet:=,  xRead:=,  bSensorType:=0,  xManualOpen:=MOpen,  xManualClose:=MClose,  xReset:=Reset,  typMpBus:=MPBus,  xReady=>MP_Node_1_READY,  bError=>X360_005_SQ52070_ERROR,  rOutPosition=>X360_005_SQ52070_POS,  rOutAirVolume_perc=>X360_005_SQ52070_VOL_PERC,  rOutAirVolume_m3_h=>X360_005_SQ52070_VOL_M3H,  wSensorValue=>,  rVmin=>,  rVmax=>,  xControlRangeIncreased=>X360_005_SQ52070_CRI,  xMecanicalOverload=>X360_005_SQ52070_MOL,  xActuatorHunting=>X360_005_SQ52070_AH,  xSensorError=>);
Is there a better way to do it? Maby with less new varibels?
I get an error
'FBMPBUSMASTER' is no function
Is it somthing wrong in the libary?
Thanks for all comments, first priority is and convert the Function block program to Structure text. Then I will look at youre advise on naming the varibel.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
did you copy all variables and FB calls in the VAR block?
and i see not enough ; in your program at a quick look.
all FB need to be declared in the VAR list, see the original.
and yes you can use lesser variables, however the program gets very complicated, FBD is very good in this as you have noticed, CFC is even better for this type of things, but is not easy for old LD programmers.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
PROGRAMPLC_PRG_testVARÂ Â MP_Linje_1:FbMpBusMaster;Â Â MPBus:typMpBus;Â Â ErrorMasterLinje1:BYTE;Â Â MP_Adr_Linje_1:FbMpBusAddressing;Â Â L1_Address:BYTE;Â Â L1_Set:BOOL;Â Â L1_SetSerialNo:typSerialNo;Â Â L1_Adr_Ready:BOOL;Â Â L1_Adr_Error:BYTE;Â Â L1_Learn:BOOL;Â Â Â Â MP_Node_1_READY:BOOL;(*Node1*)Â Â X360_005_SQ52070:FbMpBusVav;Â Â X360_005_SQ52070_ERROR:BYTE;Â Â X360_005_SQ52070_POS:REAL;Â Â X360_005_SQ52070_VOL_PERC:REAL;Â Â X360_005_SQ52070_VOL_M3H:REAL;Â Â X360_005_SQ52070_CRI:BOOL;Â Â X360_005_SQ52070_MOL:BOOL;Â Â X360_005_SQ52070_AH:BOOL;(*Convertsignals*)Â Â MOpen:BOOL;Â Â EnableMP1:BOOL;Â Â MClose:BOOL;Â Â EnableMP2:BOOL;Â Â xEnable:BOOL;Â Â MPmax:BOOL;Â Â AirVolum:BOOL;Â Â Reset:BOOL;END_VAR
Program
(*MP_Linje_1*)(* Is it rigth to use the variabel name to get the funksjon? *)MP_Linje_1(  bModule_750_643:=1,  typMpBus:=MPBus,  bError=>ErrorMasterLinje1);(*MP_Adr_Linje_1*)(* Is it rigth to use the variabel name to get the funksjon? *)MP_Adr_Linje_1(  bAddress:=L1_Address,  xSet:=L1_Set,  xGetSerialNo:=,  typINSerialNo:=L1_SetSerialNo,  tMaxLearnTime:=t#60s,  xLearn:=L1_Learn,  typMpBus:=MPBus,  xReady=>L1_Adr_Ready,  bError=>,  typOUTSerialNo=>);(*Program before xEnable*)MOpen:=FuBACnetBinaryPV_to_BOOL(BACnet.BY2200_360_005_SQ52070_MOpen.Present_Value);(* ; after every line? *)  EnableMP1:=MOpenANDSFC_MP_L1.EnableMP_L1; (* ; after every line? *)MClose:=FuBACnetBinaryPV_to_BOOL(BACnet.BY2200_360_005_SQ52070_MClose.Present_Value); (* ; after every line? *)  EnableMP2:=MCloseANDSFC_MP_L1.EnableMP_L1; (* ; after every line? *)    xEnable:=SFC_MP_L1.Node1OREnableMP1OREnableMP1; (* ; after every line? *)(*Program before rAirVolum*)MPmax:=FuBACnetBinaryPV_to_BOOL(BACnet.BY2200_360_005_MPMAX.Present_Value);  AirVolum:=SEL(MPmax,BACnet.BY2200_570_205_RY62070_VENT_OP.Present_Value,100);(*Program before rAirVolum*)Reset:=FuBACnetBinaryPV_to_BOOL(BACnet.BY2200_360_005_SQ52070_Reset.Present_Value);(*X360_005_SQ52070*)(* Is it rigth to use the variabel name to get the funksjon? *)X360_005_SQ52070(  xEnable:=xEnable,  tCycleTime:=t#3s,  bAddress:=1,  rAirVolume:=MPmax,  rMinAirVolume:=,  rMaxAirVolume:=,  xSet:=,  xRead:=,  bSensorType:=0,  xManualOpen:=MOpen,  xManualClose:=MClose,  xReset:=Reset,  typMpBus:=MPBus,  xReady=>MP_Node_1_READY,  bError=>X360_005_SQ52070_ERROR,  rOutPosition=>X360_005_SQ52070_POS,  rOutAirVolume_perc=>X360_005_SQ52070_VOL_PERC,  rOutAirVolume_m3_h=>X360_005_SQ52070_VOL_M3H,  wSensorValue=>,  rVmin=>,  rVmax=>,  xControlRangeIncreased=>X360_005_SQ52070_CRI,  xMecanicalOverload=>X360_005_SQ52070_MOL,  xActuatorHunting=>X360_005_SQ52070_AH,  xSensorError=>);
Is it rigth to use the variabel name to get the funksjon?
; after every line?
Yes FBD is very good and easy to understand. But I'm trying to find a faster way to do it, when I'm going to controll many hundres og VAV/CAV. Today we are copy and pasting names in FB. Hoping to find a faster way of doing it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How does it compile now?
what errors do you get
and yes the name above the FB should be in front of the Function Block in ST.
The functions dont need it, as you can see in MOpen
i dont see the AND and OR back in the program
Make for every function or Block a ST Line then you can follow what happens.
esspecially in the beginning to find errors.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Had a look at thise today.
Looks like everything is working.
Thanks for the help shooter.
I have used digital inputs insted of bacnet variabels.
MP_Linje_1(PRG-ST)PROGRAMMP_Linje_1VARÂ Â MP_Linje_1:FbMpBusMaster;Â Â MPBus:typMpBus;Â Â ErrorMasterLinje1:BYTE;Â Â MP_Adr_Linje_1:FbMpBusAddressing;Â Â L1_Address:BYTE;Â Â L1_Set:BOOL;Â Â L1_SetSerialNo:typSerialNo;Â Â L1_Adr_Ready:BOOL;Â Â L1_Adr_Error:BYTE;Â Â L1_Learn:BOOL;Â Â TILLUFT_MAX_POS_L1:REAL;Â Â AVTREKK_MAX_POS_L1:REAL;Â Â MP_Node_1_READY:BOOL;(*GlobalvariableDI1-DI8andDO1-DO8*)(*Â Â Â Â Â Â MClose:=DI1;Â Â Â Â Â Â MPmax:=DI2;Â Â Â Â Â Â Reset:=DI3;Â Â Â Â *)(*Â Â VirtueloutREAL*)Â Â REAL1:REAL;(*Node1*)Â Â X360_005_SQ52070:FbMpBusVav;Â Â X360_005_SQ52070_ERROR:BYTE;Â Â X360_005_SQ52070_POS:REAL;Â Â X360_005_SQ52070_VOL_PERC:REAL;Â Â X360_005_SQ52070_VOL_M3H:REAL;Â Â X360_005_SQ52070_CRI:BOOL;Â Â X360_005_SQ52070_MOL:BOOL;Â Â X360_005_SQ52070_AH:BOOL;Â Â MOpen:BOOL;Â Â EnableMP1:BOOL;Â Â MClose:BOOL;Â Â EnableMP2:BOOL;Â Â xEnable:BOOL;Â Â MPmax:BOOL;Â Â AirVolum:REAL;Â Â Reset:BOOL;END_VAR
(*MP_Linje_1*)MP_Linje_1(  bModule_750_643:=1,  typMpBus:=MPBus,  bError=>ErrorMasterLinje1);(*MP_Adr_Linje_1*)MP_Adr_Linje_1(  bAddress:=L1_Address,  xSet:=L1_Set,  xGetSerialNo:=,  typINSerialNo:=L1_SetSerialNo,  tMaxLearnTime:=t#60s,  xLearn:=L1_Learn,  typMpBus:=MPBus,  xReady=>L1_Adr_Ready,  bError=>,  typOUTSerialNo=>);(*Program before xEnable*)  MOpen:=DI4;    EnableMP1:=MOpenANDSFC_MP_L1.EnableMP_L1;  MClose:=DI1;    EnableMP2:=MCloseANDSFC_MP_L1.EnableMP_L1;      xEnable:=SFC_MP_L1.Node1OREnableMP1OREnableMP1;(*Program before rAirVolum*)  MPmax:=DI2;  AirVolum:=SEL(MPmax,REAL1,100);(*Program before rAirVolum *)Reset:=DI3;(*X360_005_SQ52070*)X360_005_SQ52070(  xEnable:=xEnable,  tCycleTime:=t#3s,  bAddress:=1,  rAirVolume:=AirVolum,  rMinAirVolume:=,  rMaxAirVolume:=,  xSet:=,  xRead:=,  bSensorType:=0,  xManualOpen:=MOpen,  xManualClose:=MClose,  xReset:=Reset,  typMpBus:=MPBus,  xReady=>MP_Node_1_READY,  bError=>X360_005_SQ52070_ERROR,  rOutPosition=>X360_005_SQ52070_POS,  rOutAirVolume_perc=>X360_005_SQ52070_VOL_PERC,  rOutAirVolume_m3_h=>X360_005_SQ52070_VOL_M3H,  wSensorValue=>,  rVmin=>,  rVmax=>,  xControlRangeIncreased=>X360_005_SQ52070_CRI,  xMecanicalOverload=>X360_005_SQ52070_MOL,  xActuatorHunting=>X360_005_SQ52070_AH,  xSensorError=>);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
I need some help converting function block diagram to sturctured text.
My function program.
Please helpe me with some examples on how I can do thise.
Espen
make a new function block with name mp_linje_ST for example (type obvious ST)
now copy all vars into the new FB
get to line 1 in program:
press F2 and find the FB MP_Linje_4 (I just saw that you have a program and a FB with same name (dont do it, it is confusing the compiler, every name should be unique, i use prgprogramname fbfunctionblockname etc. There is a naming convention in the helpfile.
change the name of the block to same as you gave it in the FBprogram.
go to the first := and fill in the variable also with F2
the := are inputs and the >= are outputs.
rung 3 is complicated to make in ST but possible.
use tabs to get all aligned.
the functions work by using a var:=FuBACNETPV_TO_BOOL(bacnet.BY....);
btw i would use some smaller var names who is calling a function block X360_005_SQ52093A.
(above you see the convention Fu)
Hello.
I have tride to convert the program.
Is there a better way to do it? Maby with less new varibels?
I get an error
'FBMPBUSMASTER' is no function
Is it somthing wrong in the libary?
Thanks for all comments, first priority is and convert the Function block program to Structure text. Then I will look at youre advise on naming the varibel.
did you copy all variables and FB calls in the VAR block?
and i see not enough ; in your program at a quick look.
all FB need to be declared in the VAR list, see the original.
and yes you can use lesser variables, however the program gets very complicated, FBD is very good in this as you have noticed, CFC is even better for this type of things, but is not easy for old LD programmers.
My var block:
Program
Is it rigth to use the variabel name to get the funksjon?
; after every line?
Yes FBD is very good and easy to understand. But I'm trying to find a faster way to do it, when I'm going to controll many hundres og VAV/CAV. Today we are copy and pasting names in FB. Hoping to find a faster way of doing it.
How does it compile now?
what errors do you get
and yes the name above the FB should be in front of the Function Block in ST.
The functions dont need it, as you can see in MOpen
i dont see the AND and OR back in the program
Make for every function or Block a ST Line then you can follow what happens.
esspecially in the beginning to find errors.
Had a look at thise today.
Looks like everything is working.
Thanks for the help shooter.
I have used digital inputs insted of bacnet variabels.