//This file was generated by the LASAL2 CodeGenerator  -- 
//Please, do not edit this file (it might be overwritten by the next generator run)
//{{LSL_DECLARATION

(*!
<Class
	Name               = "_LMCRefBase"
	Revision           = "1.11"
	GUID               = "{DDA02D7F-AF14-499F-90C1-3DCEBCBDC4D9}"
	RealtimeTask       = "false"
	CyclicTask         = "false"
	BackgroundTask     = "false"
	Sigmatek           = "true"
	OSInterface        = "false"
	HighPriority       = "false"
	Automatic          = "false"
	UpdateMode         = "Prescan"
	IconPath           = ".\Class\_LMCRefBase\AxisRef.ico"
	SharedCommandTable = "true"
	Objectsize         = "(284,120)">
	<Channels>
		<Server Name="RefInput" GUID="{DDD0F2C7-31E3-4572-97EE-F88907467619}" Visualized="true" Initialize="false" WriteProtected="false" Retentive="false" Comment="This server is an object channel and serves as an interface for the class &#13;&#10;_LMCAxisBase over the client &quot;LMCReference&quot;"/>
	</Channels>
	<RevDoku>
		<Owner Company="Sigmatek"/>
		<Dokumentation Revision="1.11" Date="2015-09-25" Author="FucHer" Company="Sigmatek" Description="1. add some comments"/>
		<Dokumentation Revision="1.10" Date="2014-07-07" Author="HasHan" Company="Sigmatek" Description="creation"/>
		<Dokumentation Revision="1.0" Date="2012-09-27" Company="Sigmatek" Description="creation"/>
	</RevDoku>
</Class>
*)
_LMCRefBase : CLASS
	TYPE
#pragma pack(push, 1)
	  _LMCAXIS_REFDATA : STRUCT  //! <Type Public="true" Name="_LMCAXIS_REFDATA"/>
	    Status : iprStates;
	    Velocity : DINT;  //! <Type Comment="Reference speed. Set by _LMCAxisRef::control(). [Internal Units/s]" Name="_LMCAXIS_REFDATA.Velocity"/>
	    Acc : DINT;  //! <Type Comment="Reference acceleration [Internal Units/sē]" Name="_LMCAXIS_REFDATA.Acc"/>
	    vSetRef1 : DINT;  //! <Type Comment="Approach speed to switch [Internal Units/s]" Name="_LMCAXIS_REFDATA.vSetRef1"/>
	    vSetRef2 : DINT;  //! <Type Comment="Departure speed from switch [Internal Units/s]" Name="_LMCAXIS_REFDATA.vSetRef2"/>
	    PosWindow : DINT;  //! <Type Comment="Position window for the Z-signal [Internal Units]" Name="_LMCAXIS_REFDATA.PosWindow"/>
	    LatchPosRef : DINT;
	    Speed : DINT;  //! <Type Comment="Actual set speed. Set by _LMCAxisBase::ReferenceAxis(). [Internal Units/tick]" Name="_LMCAXIS_REFDATA.Speed"/>
	  END_STRUCT;
#pragma pack(pop)
	  _LMCREF_READPARAMETER :  //! <Type Public="true" Name="_LMCREF_READPARAMETER"/>
	  (
	    ZPULSE_DIST  //! <Type Comment="read the distance from refswitch to zpulse" Name="_LMCREF_READPARAMETER.ZPULSE_DIST"/>
	  )$UDINT;
	END_TYPE
  //Servers:
	RefInput 	: SvrChCmd_DINT;
  //Clients:
  //Variables:
  //Functions:
				//! <Function Comment="Receives the information in which reference mode the _LMCAxis is running.&#13;&#10;Controls the reference signals inputs and also the ref. steps." Name="control"/>
	FUNCTION VIRTUAL GLOBAL control
		VAR_INPUT
			Mode 	: _LMCAXIS_REFMODE;			//! <Variable Comment="Adjusted mode of the reference-run: see _LMCAXIS_REFMODE" Name="control.Mode"/>
			RefStatus 	: ^_LMCAXIS_REFDATA;			//! <Variable Comment="Pointer to the datastructure of the adjusted mode of a reference-run: see: _LMCAXIS_REFDATA" Name="control.RefStatus"/>
			Pos 	: ^DINT;			//! <Variable Comment="Pointer to a physical position" Name="control.Pos"/>
			StartRef 	: DINT;			//! <Variable Comment="StartRef is set to &quot;1&quot; to kickk off the reference-run" Name="control.StartRef"/>
		END_VAR;
	
	FUNCTION VIRTUAL GLOBAL WriteConstant
		VAR_INPUT
			Resolution 	: DINT;			//! <Variable Comment="Internal resolution factor" Name="WriteConstant.Resolution"/>
			Timebase 	: DINT;			//! <Variable Comment="Number of cycles per second" Name="WriteConstant.Timebase"/>
			vMax 	: DINT;
			aMax 	: DINT;
		END_VAR;
	
	FUNCTION VIRTUAL GLOBAL SetAxisFlgs
		VAR_INPUT
			pAxisStatus 	: ^_LMCAXIS_STATUS;
			pAxisError 	: ^_LMCAXIS_ERROR;
		END_VAR
		VAR_OUTPUT
			Result 	: DINT;
		END_VAR;
				//! <Function Comment="this function returns true, when&#13;&#10;something is connected" Name="CheckConnection"/>
	FUNCTION VIRTUAL GLOBAL CheckConnection
		VAR_OUTPUT
			RetCode 	: BOOL;			//! <Variable Comment="true  ... something connected&#13;&#10;false ... nothing connected" Name="CheckConnection.RetCode"/>
		END_VAR;
				//! <Function Comment="Reads the software parameters." Name="ReadParameter"/>
	FUNCTION VIRTUAL GLOBAL ReadParameter
		VAR_INPUT
			ParNr 	: _LMCREF_READPARAMETER;			//! <Variable Comment="Parameter number" Name="ReadParameter.ParNr"/>
		END_VAR
		VAR_OUTPUT
			Result 	: DINT;			//! <Variable Comment="parameter" Name="ReadParameter.Result"/>
		END_VAR;
  //Tables:
	FUNCTION @STD
		VAR_OUTPUT
			ret_code	: CONFSTATES;
		END_VAR;
	FUNCTION GLOBAL TAB @CT_;
END_CLASS;

//}}LSL_DECLARATION


FUNCTION GLOBAL TAB _LMCRefBase::@CT_
0$UINT,
2#0100000000000000$UINT, //TY__LMCREFBASE
1$UINT, 11$UINT, (SIZEOF(::_LMCRefBase))$UINT, 
1$UINT, 0$UINT, 0$UINT, 
TO_UDINT(1736530975), "_LMCRefBase", //Class
TO_UDINT(0), 0, 0$UINT, 0$UINT, //Baseclass
//Servers:
(::_LMCRefBase.RefInput.pMeth)$UINT, _CH_CMD$UINT, 2#0000000000000000$UINT, TO_UDINT(1414373127), "RefInput", 
//Clients:
END_FUNCTION


#define USER_CNT__LMCRefBase 5

TYPE
	_LSL_STD_VMETH	: STRUCT
			CmdTable	: CMDMETH;
			UserFcts	: ARRAY[0..USER_CNT__LMCRefBase] OF ^Void;
	END_STRUCT;
END_TYPE

FUNCTION _LMCRefBase::@STD
	VAR_OUTPUT
		ret_code	: CONFSTATES;
	END_VAR
	VAR
		vmt	: _LSL_STD_VMETH;
	END_VAR

	//Command Methods
	InitCmdTable (nCmd := nSTDCMD + USER_CNT__LMCRefBase, pCmd := #vmt.CmdTable);
	vmt.CmdTable.Write		:= #M_WR_DIRECT();
#pragma warning (disable : 74)
	vmt.UserFcts[0]		:= #control();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[1]		:= #WriteConstant();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[2]		:= #SetAxisFlgs();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[3]		:= #CheckConnection();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[4]		:= #ReadParameter();

#pragma warning (default : 74)
	RefInput.pMeth		:= StoreCmd (pCmd := #vmt.CmdTable, SHARED);

	IF RefInput.pMeth THEN
		ret_code	:= C_OK;
	ELSE
		ret_code	:= C_OUTOF_NEAR;
		RETURN;
	END_IF;

END_FUNCTION

//{{LSL_IMPLEMENTATION
//{{LSL_ENCRYPTION 16#800
FA7DE4EBF342212FF2412A957A14F995FD2BF4DCC60489FB057BBD64AE9658712B003B9AE3C280B7FC3A1FDF1DFA8DAABD45B8658D6060CCE5486CADA12DCA1D57EE1E90474659C5650F58C43517D11DEB1B3CD7CD1F30217BE485308868CBAB295284E0
295699C00B36C096D0BC17E53A7FB93C4B6CBE3B8BDFC805418C441B78343F74B48DD0798F6C1C7D9521BD350AE5DCDF1EDBA8401A2381B158F826B52F5B532BF567B9E3C464FD32EDA0EE35A0C4568FDEEF2167A321CFA3586950783F01597780929E36
3079171620BBC9E5842BD5C964E69DEAB6015A39ECB189C052B91B63DAD0DFF7B65A5ECAF0B21A62CB70745F25D2E4932DB8DE5C28621F45F6AB10FE0B14DA71938DD24372BD65D40437BE3A6B67003D930E307C0AE2F8F2134C5E56DADA25F12389A0C5
C1FC278B2A942F278B86EF79DFEF691C422F95640ADF096F3C4F4632DB51C07E043DDA849D864DA9886B3AA5AE69BDD037B379C2BD62AF1205709F2EE53F180D00D4D3FFF182D51CAD5952BF524347E06A039F9BD417EDF6BD1D3EB4E7AD88122F0B6C18
EB464FDBAE5B251E6913445CFD373ACE892EBD4ED1269B4C27DEADE709CF0B8D89A7D75467D713638A85C6C9224EFFAE87D593181025DEE34C1D1E2943450334CB22B454C6F7FEDA1167D5E003C712533887678F1EA3DC36D9992602149CACB94CE97EF6
CB4169A3CA1607B7A82F8FD039366B0611734100552C2AF4A7137E0F7D0B72CBA4C0312FFC748AA951A7BD0F92EADE527D9A3747DA2AF7AE2957557D0ACDC9F09BF9C6BB7930BE53171A145FF631B055F54CF61BC6F6376FC0381FF14B7932E80E00D806
358D947B3DDA9145EF9BF5D1F309979AE8E63DA2FB526E34C42E5F0680F313BCDEA7ED70FA58699AB4C05DEF7C8706AC70AF2D36C298D75BBE3B899A88DA6364437138090972D66DE8C61B62B49DDE434A380AD9A59DE64B2C351EE9397019022143BAD3
B62C20166AA3547E310CB0E53328E6299D09EB1A5B42E8CF3CF70D9ADFFA6D37DCDB57D38F23C6A7BD441788D75A1BE34CE6293E148B570FB6C7CE063C2E4456C83C8592C94C62B838CE4B6A6127C53146F3AC85D3DBC8F9E0B96C0F1FCDFBF9D319B8EC
76C1EC63CFE6024C8363A797AF8311A29E37CA858DA9821F29E91DA73D97CC0036C93C58C54C668EC255BC8D8636B8D9D92EBEAB79EB14D573E37C490F1ABD76812DB7CF132FFC90E0F7F9A963BE94DBD3C26920E6008FFDA91A727D61FD83155FAE6E79
496FD7D81F8A9407D2817CF5D44126327F3A2BA63E6AA29CD84043056308D47D81D9EE1F5A3EF4594730A81CC8555CF5D8F9F10FB802D2AD4EEC84410F191783DF2563BDA41342F26DD26603A27C33AE736A1353E0C56D998577C650AE09382B0264541E
F10CCD8DA045D9992D9D2BAA2EFF269CCACDB1735AD92EB31DC83A65F8A6C28EA8ADCADC0825D9931EBA77CF6D0A35CE273DDBE2C4791A867B95DB68EF5FC4A50FAB028EE0DF428A41AC53753ABC254216D310F0E04760836ECEDA9E43C0CAD86D263F13
A994E9219C25D29171E8253E4C8D9D4089B5B50328942206266A8DC9FB85A3B0DF774C76B4EDDDE664A0C4108EEE40D6B4D5EF1A170A31910E906F88BF363EFCA037C1343695DB779EE3B0BE36045E6F35A9B7CEC6430A7369F1CC78620BF8F6AEA72D11
