Simulator DC short cirquit current

I would like to create a simulator for a DC short cirquit using an analog output with a 2152 cpu.
Is this at all possible I need to create an exponentional output signal that would rise from 1 to 10 V in a timespan of 20ms folowing an exponential curve.
When a short-circuit occurs across the terminals of a DC circuit, the current rises from the load current (y In) to the short-circuit current Isc over a period of time that depends on the value of the resistance R and inductance L of the short-circuited loop.
The equation determining the current in the loop is:
U = Ri + L Di/Dt
The curve of I versus time is defined by the equation:
I= In+Isc (1 - exp(t/tau))
where tau = L/R is the time constant for the rise to Isc.
Practically speaking, after a time t = 3tau, the short-circuit is considered to be established, because the value of exp(-3) = 0.05 is negligible compared to 1
The lower the time constant the shorter the time required for the current to rise to Isc.
L/R = 5 ms, fast short-circuit
L/R = 15 ms, standardised value used in standard IEC 60947-2
L/R = 30 ms, slow short-circuit.
Is there a way to create an output signal that folows this cure on a ms base? At aprox 60ms the we aproach the max value.
0WRTqVFPOt.pngIs this at all possible or is the cycle time to big to achieve this?

Hi Wim
Since you are working with a 2152 the minimum task cycle time is 1ms, see: PLCnext Control features
So I created a 1ms cyclic task and a program that calculates the current according to „I = In+Isc (1 - exp(t/tau))“. I’m not sure if I interpreted everything correctly. Is it possible that there is a minus missing, and it’s supposed to be
I = In+Isc (1 - exp(- t/tau))
This is the used code:
image.png

IF xInit THEN
     rTime := rTime + 1;
  IF rTime > 60 THEN
    rTime := 0;
  END_IF
   
  rNatExp := EXP(-rTime/15);
  rCurrent := 300 + (2505 * (1 - rNatExp));
   
END_IF  

So every cycle (1ms) , rTime is increased, at 60 it’s set back to 0 again. This to get a cycle of the first 60 ms. Adding the variables to the logic analyser, it would look like this:
This is what it looks like using the ms of the local clock:
image.pngimage.png
Is this the answer you were looking for? I’m not sure what you will measure if you connect it to an 0-10V output.

BR
Mathieu

Thanks for you’re input. This seems to be working.
There is indeed a minus missing in the equation.
I would like to use the Analog Output of the PLC to create/simulate a short cirquit current to test a DC protection relay that should react on the di/dt of the curve. This output will be connected to a measuring input of the relay.