-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new SCALE function block for signal processing
Created a new XML file defining the SCALE function block for scaling input values to desired output range in the signal processing library.
- Loading branch information
1 parent
496a475
commit 5aef5b0
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Function Name="SCALE" Comment="Scaling Function Block"> | ||
<Identification Standard="61499-1" Description="Copyright (c) 2024 HR Agrartechnik GmbH This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at https://www.eclipse.org/legal/epl-2.0/ SPDX-License-Identifier: EPL-2.0 was inspired by this Video: EP2 - CODESYS: Create Scaling Function Block https://www.youtube.com/watch?v=Ir6QAxxDarI" > | ||
</Identification> | ||
<VersionInfo Organization="HR Agrartechnik GmbH" Version="1.0" Author="Franz Höpfinger" Date="2024-09-19"> | ||
</VersionInfo> | ||
<CompilerInfo packageName="signalprocessing"> | ||
</CompilerInfo> | ||
<InterfaceList> | ||
<EventInputs> | ||
<Event Name="REQ" Type="Event" Comment=""> | ||
<With Var="IN"/> | ||
<With Var="MAX1"/> | ||
<With Var="MIN1"/> | ||
<With Var="MAX2"/> | ||
<With Var="MIN2"/> | ||
</Event> | ||
</EventInputs> | ||
<EventOutputs> | ||
<Event Name="CNF" Type="Event" Comment=""> | ||
<With Var=""/> | ||
</Event> | ||
</EventOutputs> | ||
<InputVars> | ||
<VarDeclaration Name="IN" Type="REAL" Comment="Input to be Scaled"/> | ||
<VarDeclaration Name="MAX1" Type="REAL" Comment="Maximum Input"/> | ||
<VarDeclaration Name="MIN1" Type="REAL" Comment="Minimum Input"/> | ||
<VarDeclaration Name="MAX2" Type="REAL" Comment="Maximum Ouput"/> | ||
<VarDeclaration Name="MIN2" Type="REAL" Comment="Minimum Output"/> | ||
</InputVars> | ||
<OutputVars> | ||
<VarDeclaration Name="" Type="REAL" Comment=""/> | ||
</OutputVars> | ||
</InterfaceList> | ||
<FunctionBody> | ||
<ST><![CDATA[PACKAGE signalprocessing; | ||
(* Scaling Function Block *) | ||
FUNCTION SCALE : REAL | ||
VAR_INPUT | ||
IN : REAL; // Input to be Scaled | ||
MAX1 : REAL; // Maximum Input | ||
MIN1 : REAL; // Minimum Input | ||
MAX2 : REAL; // Maximum Ouput | ||
MIN2 : REAL; // Minimum Output | ||
END_VAR | ||
SCALE := (IN - MIN1) * (MAX2 - MIN2) / (MAX1 - MIN1) + MIN2; | ||
END_FUNCTION | ||
]]></ST> | ||
</FunctionBody> | ||
</Function> |