Merge pull request #5 from EuropeanSpallationSource/federicor/prog-for-cabinet-config
Federicor/prog for cabinet config
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<TcSmItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.beckhoff.com/schemas/2012/07/TcSmProject" TcSmVersion="1.0" TcVersion="3.1.4024.62" ClassName="CNestedPlcProjDef">
|
||||
<Project GUID="{FB261665-FD20-4BF2-97F8-2854C82B752D}" Name="tc_project_app" PrjFilePath="..\..\tc_project_app\tc_project_app.plcproj" TmcFilePath="..\..\tc_project_app\tc_project_app.tmc" ReloadTmc="true" AmsPort="852" FileArchiveSettings="#x000e" ClearInvalidPersist="true" SymbolicMapping="true">
|
||||
<Instance Id="#x08502040" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcPath="tc_project_app\tc_project_app.tmc" TmcHash="{2DD05E89-3C9F-970A-3886-19B31EB4CDD4}">
|
||||
<Instance Id="#x08502040" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcPath="tc_project_app\tc_project_app.tmc" TmcHash="{C4BD3855-3315-D1A6-F8E7-1C5E39A5801C}">
|
||||
<Name>tc_project_app Instance</Name>
|
||||
<CLSID ClassFactory="TcPlc30">{08500001-0000-0000-F000-000000000064}</CLSID>
|
||||
<Vars VarGrpType="1">
|
||||
|
||||
@@ -10,6 +10,12 @@ END_VAR
|
||||
VAR_GLOBAL CONSTANT
|
||||
nAXIS_NUM: UINT := 0; //Specifies the total of axes in the system
|
||||
nPNEUMATIC_AXIS_NUM: UINT := 0; //Specifies the total number of pneumatic axes in the system
|
||||
|
||||
//Pneumatic air pressure groups high and low limits
|
||||
fLOW_LIMIT_AIR_PRESSURE1: REAL := 0; //User defined value in bar for low limit air pressure value for pneumatic axes group 1
|
||||
fHIGH_LIMIT_AIR_PRESSURE1: REAL := 0; //User defined value in bar for high limit air pressure value for pneumatic axes group 1
|
||||
fLOW_LIMIT_AIR_PRESSURE2: REAL := 0; //User defined value in bar for low limit air pressure value for pneumatic axes group 2
|
||||
fHIGH_LIMIT_AIR_PRESSURE2: REAL := 0; //User defined value in bar for high limit air pressure value for pneumatic axes group 2
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
</GVL>
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
<Declaration><![CDATA[PROGRAM Cabinet_Configuration
|
||||
VAR
|
||||
//fbCabinetMonitoring: FB_ESSMonitoringMCU5001a; FB_ESSMonitoringMCU5001b; FB_ESSMonitoringMCU6001a; FB_ESSMonitoringMCU6001b; FB_ESSMonitoringMCU5002; FB_ESSMonitoringMCU5003;
|
||||
fScaledAirPressureGroup1: REAL;
|
||||
fScaledAirPressureGroup2: REAL;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[(*
|
||||
fbCabinetMonitoring(
|
||||
<ST><![CDATA[//Cabinet monitoring
|
||||
(*fbCabinetMonitoring(
|
||||
nEcMasterNetId:= , //AMS NetId of Device (EtherCAT) from I/Os
|
||||
aErrorID=> ,
|
||||
aErrorMsg=> ,
|
||||
@@ -18,14 +20,34 @@ fbCabinetMonitoring(
|
||||
nAlarmGrpBitNumber=> );
|
||||
*)
|
||||
|
||||
//Define pressure limits for pneumatic pressure group 1
|
||||
//GVL.fHighLimitAirPressureGroup1 := 0.0;
|
||||
//GVL.fLowLimitAirPressureGroup1 := 0.0;
|
||||
|
||||
//Define pressure limits for pneumatic pressure group 2
|
||||
//GVL.fHighLimitAirPressureGroup2 := 0.0;
|
||||
//GVL.fLowLimitAirPressureGroup2 := 0.0;
|
||||
//Scale pressure sensor group 1 and 2
|
||||
fScaledAirPressureGroup1 := mScaledPressureValue(nRawValue:=GVL.nAirPressureSensorGroup1);
|
||||
fScaledAirPressureGroup2 := mScaledPressureValue(nRawValue:=GVL.nAirPressureSensorGroup2);
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="mScaledPressureValue" Id="{3a9ac7a5-453e-098d-2143-f7d60168bb86}">
|
||||
<Declaration><![CDATA[METHOD PUBLIC mScaledPressureValue : REAL
|
||||
VAR_INPUT
|
||||
nRawValue: INT; //Raw value from the Terminal
|
||||
END_VAR
|
||||
VAR
|
||||
rGradient: REAL; //Internal variable to calculate gradient of the slope
|
||||
rOffset: REAL; //Internal variable to calculate the offset value
|
||||
|
||||
fRawHigh: REAL := 30518.0; //Highest value for the Raw value
|
||||
fRawLow: REAL := 0.0; //Lowest value for the Raw value
|
||||
fScaledHigh: REAL := 10.0; //Highest value for the Scaled value 10 bar
|
||||
fScaledLow: REAL := 0.0; //Lowest value for the Scaled value 0 bar
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[rGradient:= (fScaledHigh - fScaledLow)/(fRawHigh - fRawLow);
|
||||
rOffset:= fScaledHigh - rGradient * fRawHigh;
|
||||
mScaledPressureValue:= rGradient * nRawValue + rOffset;
|
||||
|
||||
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
@@ -132,6 +132,7 @@ Axis_Template();
|
||||
//Pneumatics_Template();
|
||||
|
||||
//Application program calls
|
||||
Cabinet_Configuration();
|
||||
Application_Template();
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
|
||||
Reference in New Issue
Block a user