Thanks for all the responses. Your suggestions work and are for sure a workaround - however I wonder how codesys has done it and, whether its possible to replicate for user functions. I pass a REAL to SQRT() and receive a REAL, I pass a LREAL to SQRT and receive a LREAL. It looks like there is some hidden type-deduction going on. Something like: FUNCTION SQ : TYPE_OF(x) VAR_INPUT x : ANY_REAL; END_VAR ============================================== SQ := x*x;
Thanks for all the responses. Your suggestions work and are for sure a workaround - however I wonder how codesys has done it and, whether its possible to replicate for user functions. I pass a REAL to SQRT() and receive a REAL, I pass a LREAL to SQRT and receive a LREAL. It looks like there is some hidden type-deduction going on. Something like FUNCTION SQ : TYPE_OF(x) VAR_IN x : ANY_REAL; END_VAR ============================================== SQ := x*x;
Hello, I am trying to understand if it's possible to do function overloading in codesys. Simple example: I want to create a function SQ(x) to calculate the square of x (x*x). I could create a SQ_INT, SQ_REAL, SQ_LREAL, ... for every needed datatype - a very ineffiecient way which would flood my project with many unneccessary functions that I would have to maintain. My investigations lead me to the ANY_-types like ANY_NUM and ANY_REAL. Correct me if I am wrong: 1) I can use them to pass values of...
Hello, I am trying to depict the state of a machine with lines in a web-visualization. The lines symbolise arm-parts of a roboter - by passing relative offsets I move those arm-parts. The following images show a MWE of what I am attempting to do: tmp1 is used to move the lower point of a line on the horizontal axis: With an offset of 0, the line is perfectly vertically aligned: After setting the offset to 5, the line appears to be cut: Refreshing the vizualization (reloading page in browser) leads...
Hello, I am trying to depict the state of a machine with lines in a web-visualization. The lines symbolise arm-parts of a roboter - by passing relative offsets I move those arm-parts. The following images show a MWE of what I am attempting to do: tmp1 is used to move the lower point of a line on the horizontal axis: With an offset of 0, the line is perfectly vertically aligned: After setting the offset to 5, the line appears to be cut: Refreshing the vizualization (reloading page in browser) leads...
Hello, I am trying to depict the state of a machine with lines in a web-visualization. The lines symbolise arm-parts of a roboter - by passing relative offsets I move those arm-parts. The following images show a MWE of what I am attempting to do: tmp1 is used to move the lower point of a line on the horizontal axis: With an offset of 0, the line is perfectly vertically aligned: After setting the offset to 5, the line appears to be cut: Refreshing the vizualization (reloading page in browser) leads...
Hello, I am trying to depict the state of a machine with lines in a web-visualization. The lines symbolise arm-parts of a roboter - by passing relative offsets I move those arm-parts. The following images show a MWE of what I am attempting to do: tmp1 is used to move the lower point of a line on the horizontal axis: With an offset of 0, the line is perfectly vertically aligned: After setting the offset to 5, the line appears to be cut: Refreshing the vizualization (reloading page in browser) leads...
Hello, I am trying to depict the state of a machine with lines in a web-visualization. The lines symbolise arm-parts of a roboter - by passing relative offsets I move those arm-parts. The following images show a MWE of what I am attempting to do: tmp1 is used to move the lower point of a line on the horizontal axis: With an offset of 0, the line is perfectly vertically aligned: After setting the offset to 5, the line appears to be cut: Refreshing the vizualization (reloading page in browser) leads...