Unity Pro XL simulating Analog input Point connected Card

hesham3mara

Member
Join Date
Oct 2018
Location
alexandria
Posts
1
1)Is there a way to simulate Analog input instead of a instrument in the simulator mode to test the software? like plcsim in Siemens you are capable simulating an input with simulator program
2)how to force an analog input point every time i force a variable the card input overrides my forcing value
 
This is one reason I like IO Mapping. You can set up your tags in a Structured Text routine and then when you need to force it, you can comment it out and the input won't overwrite the tag.

Analog_In1 := "Physical Input";

To comment it out,

(*Analog_In1 := "Physical Input";*)
 
I remember reading in the help that there is a function for this.
I like rankhornjp's way better.
I'd love to have a 4-20ma generator. I heard that you can get one on the cheap, if that is an option.
I created my own dfb for scaling analogs. It is basically the formula copied straight out of the AB help for the Scaling function + some wiz bang stuff like limits, forcing, et al.

I'm at home, so this is an older version. I'm sure it could be enhanced.

Code:
(* convert the inputs to floats *)
input_real:= raw_real;
input_min:= raw_min_real;
input_max:= raw_max_real;
scaled_min:= eu_min_real;
scaled_max:= eu_max_real;

(* calculates the slope or rate; i.e. rise over the run *)
If ((input_max - input_min) <> 0.0) Then
  rate:= (scaled_max - scaled_min) / (input_max - input_min);
Else
  rate:= 0.0;
End_if;


(* calculates the offset *)
offset:= scaled_min - (input_min * rate);

(* performs the scaling calculation; i.e. y = mx+b *)
output_real:= (input_real * rate) + offset;


(* If the "Limit_En" flag is set then limit the output to within the scaling parameters *)
IF limit_overflow THEN
	IF output_real > scaled_max THEN
		output_real:= scaled_max;
		fail:= true;
	ELSIF output_real < scaled_min THEN
		output_real:= scaled_min;
		fail:= true;
	else
		fail:= false;
	END_IF;
else
	fail:= false;
END_IF;

If fail_hi & fail then
	output_real:= scaled_max;
elsif fail then
	output_real:= scaled_min;
end_if;

scaled_out:= output_real;
 
Last edited:

Similar Topics

Hi Everyone, As part of FAT testing, I am looking to test the PLC logic by simulating the analog inputs. Is there any way to feed analog input...
Replies
3
Views
2,817
Hello, I am using Unity pro V15. I have Quantum CPU 671 and Ethernet NOE 77101 configured. I have configured IO scanning on NOE. I have attached...
Replies
5
Views
137
HELLO MY FRİENDS ı have problem. ı tought you can solved thıs problem for me. First of all When I checked all the cable connections of the...
Replies
0
Views
381
Hi All, I haven't installed Unity Pro in years and needed to install it recently. I initially tried installing Version 11.1 and the whole...
Replies
3
Views
631
Hello i want to implement a Read_var / Write_var functions to communicate with a modbus tcp device at the moment i use the unity simulator at the...
Replies
4
Views
1,852
Back
Top Bottom