Simulating Digital Output XVALS

Using PAC Control with SoftPAC for Simulation…

It appears that commands that manipulate the XVAL of a digital output won’t work with Simulation, because I don’t have the physical rack of I/O attached, specifically “Start On-Pulse”.

So I’ve just written some code into my Simulation that mimics the code that turns on the Digital Output, which is annoying.

To give you the example, I’m simulating a temperature (analog input) increasing by a couple degrees whenever the digital pulse to the SSR on the heater is fired (digital output). The digital output is not turning on with the Start On-Pulse command.

Has anyone figured this out? Thanks!

Hi, for any simulations without the actual i/o connected you have to use variables as outputs or inputs, eventually when you finish testing/simulating and you connect the actual i/o just move the varaibles into the i/o in the startup chart or any other chart. I have used this method in countless projects with no issues and actually helps a lot if any external issue with sensors or digital signals.

Thanks for your response!

When you say you “move the variables into the I/O”, does that mean in your final version you keep a variable for every single I/O point you have? Are you using memory addresses to map them all or something? Or do you have to continually read/write the variable values to the I/O points? I can see where it would be handy for troubleshooting.

That seems really cumbersome in the code… (we have about 1000 I/O points). For Inputs, there are a bunch of Simulation commands, so you don’t really need an extra layer of code for those, you just write to the IVAL. And I’ve never had a problem with Outputs, until this one stupid command that writes to the XVAL (e.g. “TurnOn” works but “Start On-Pulse” does not). It would kind of work to create a variable in between, but I was trying to write the Simulation as a separate chart without changing any of the original code (it doesn’t really belong to me, I’m helping out on someone else’s project). Also, the Start On-Pulse would not work with a variable either, so to get the same functionality, I’d have to create a timer as well, and all the code to manipulate the timer.

Hi, oh boy… if you have 1000 + i/o will be a pain to do. We do this when coding from scratch so we can test and simulate all we want, at the end all we do is add ex: DO_motor_3 = n_motor3_output;.
I will not venture doing so in your particular situation, if done from the beginning it helps a lot if any issues with i/o.

:laughing: Yeah, it’s a pilot plant, and it’s quite large and well-instrumented. Thanks for your thoughts and for replying, though! I do really appreciate it. I will keep that in mind for future, smaller installations.

If anyone else has ways to trick the Start On-Pulse command in Simulation, please let me know!

Hi, any update on this? I tried some things but no good results yet. Beno, help!

No update. My simulation still just turns on the output for me (instead of letting the code do it). Not good for testing code, but works for operator training purposes. TY_101 is the digital output; TE_101 is the thermocouple (AI, °C); TEC_101_Alm is 0 if there are no alarms and non-zero if there are; TEC_SP_101 is the setpoint for the heater (°C).

TY_101 = (TE_101 <= TEC_SP_101);

// If heater is disabled, decrease temperature down to 40°C	
If (TEC_101_Alm <> 0) Then
    IvalSetAnalogPoint(Max(40, TE_101 - 1), TE_101);	
Else // Increase temperature when TY is on, up to setpoint
	IvalSetAnalogPoint(Max(40, TE_101 + AbsoluteValue(TY_101*2)), TE_101);