closed loop cooling fan PWM control - feature request

General support questions and announcements for MS3. See also MS3 manuals.

Moderators: jsmcortina, muythaibxr

ca434sbc4
Experienced MS/Extra'er
Posts: 363
Joined: Sun May 02, 2004 8:39 am
Location: Calgary Alberta Canada

closed loop cooling fan PWM control - feature request

Post by ca434sbc4 »

I'm running a cooling fan out of a Ford Crown Vic. The later designs used a PWM power controller (DC in, PWM +12 out, control input PWM 0 - 100%) to control the fan speed.

Can a closed loop PWM be added to the fan control based on the CLT sensor and a logic input to run at a higher speed ( possibly an adder the the PWM value) when the A/C is turned on?
arran
Master MS/Extra'er
Posts: 617
Joined: Mon Oct 29, 2012 2:34 am
Location: Brisbane Australia
Contact:

Re: closed loop cooling fan PWM control - feature request

Post by arran »

Have you checked out Generic PWM under Advance Engine menu?
RX7 Series 2 13B Turbo. Megasquirt 3 with 3X Expander and V3 CPU. Firmware 1.4.1
Knock module, twin EGT, real time clock, WBO2, full sequential fuel and spark
http://web.aanet.com.au/arran
ca434sbc4
Experienced MS/Extra'er
Posts: 363
Joined: Sun May 02, 2004 8:39 am
Location: Calgary Alberta Canada

Re: closed loop cooling fan PWM control - feature request

Post by ca434sbc4 »

I did look at it, I may be missing how the clt sensor feedback is converted from temp (*F) into the load axis scaling from 0-100?

The manuals are a bit light on this. An example would go a long way to understanding the setup process.
arran
Master MS/Extra'er
Posts: 617
Joined: Mon Oct 29, 2012 2:34 am
Location: Brisbane Australia
Contact:

Re: closed loop cooling fan PWM control - feature request

Post by arran »

Something like this maybe,
coolant pwmJPG.JPG
coolant pwmJPG.JPG (119.09 KiB) Viewed 1673 times
RX7 Series 2 13B Turbo. Megasquirt 3 with 3X Expander and V3 CPU. Firmware 1.4.1
Knock module, twin EGT, real time clock, WBO2, full sequential fuel and spark
http://web.aanet.com.au/arran
ca434sbc4
Experienced MS/Extra'er
Posts: 363
Joined: Sun May 02, 2004 8:39 am
Location: Calgary Alberta Canada

Re: closed loop cooling fan PWM control - feature request

Post by ca434sbc4 »

pwmb.png
pwmb.png (49.28 KiB) Viewed 1635 times
When I try to duplicate - in offline mode, the load axis scaling is still not setting up to the clt sensor range nor label is the load axis label updating to coolant.

So I'm still missing a step.
arran
Master MS/Extra'er
Posts: 617
Joined: Mon Oct 29, 2012 2:34 am
Location: Brisbane Australia
Contact:

Re: closed loop cooling fan PWM control - feature request

Post by arran »

Dude hit the three dots button top right hand side and the table will be shown
RX7 Series 2 13B Turbo. Megasquirt 3 with 3X Expander and V3 CPU. Firmware 1.4.1
Knock module, twin EGT, real time clock, WBO2, full sequential fuel and spark
http://web.aanet.com.au/arran
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: closed loop cooling fan PWM control - feature request

Post by elaw »

And if you hit the button with the three dots at the upper left of the graph, there are options there for scaling the axes.

The labels do not update... they always say "load" for whatever reason. But the PWM will use the parameter you select from the dropdown in spite of how the graph and table are labeled.
Eric Law
1990 Audi 80 quattro with AAN turbo engine: happily running on MS3+MS3X
2012 Audi A4 quattro, desperately in need of tweaking

Be alert! America needs more lerts.
ca434sbc4
Experienced MS/Extra'er
Posts: 363
Joined: Sun May 02, 2004 8:39 am
Location: Calgary Alberta Canada

Re: closed loop cooling fan PWM control - feature request

Post by ca434sbc4 »

That makes sense. Thanks.

The one item missing is the ability to goto a high PWM value is the A/C pressure switch goes -> high pressure cutout >> which requires additional air flow to correct.
goodysgotacuda
Helpful MS/Extra'er
Posts: 125
Joined: Sun Oct 05, 2014 5:07 pm

Re: closed loop cooling fan PWM control - feature request

Post by goodysgotacuda »

ca434sbc4 wrote:That makes sense. Thanks.

The one item missing is the ability to goto a high PWM value is the A/C pressure switch goes -> high pressure cutout >> which requires additional air flow to correct.

was this ever figured out? I am trying to figure out how to PWM my fan but still ramp-up with a/c on. I would really hate to go to an aftermarket controller to manage this, my MS3 knows the ECT and a/c status already.
1972 Plymouth 'Cuda - 5.7L Hemi w/T56 Magnum

MS3 Gold Box, TunerStudio MS/MegaLogViewerHD user
Laminar
Master MS/Extra'er
Posts: 644
Joined: Wed Aug 06, 2014 7:45 am

Re: closed loop cooling fan PWM control - feature request

Post by Laminar »

Ditto on this. As common as these OEM PWM fan controllers seem to be (I got fan+shroud+controller at the junkyard for $25), it seems like it'd be a nice feature to have.

The built in on/off fan control offers the ability to shut the fan off dependent on TPS and VSS, and has the correct on/off hysteresis, which are all important for proper fan control. None of those things are possible with the generic PWM configuration. Theoretically I could put a relay inline between the MS PWM output and the fan PWM input, then activate that relay with a discrete from the MS fan control function, but that just seems like an additional point of failure.
amtaustin
MS/Extra Newbie
Posts: 9
Joined: Tue Jun 11, 2013 11:28 am

Re: closed loop cooling fan PWM control - feature request

Post by amtaustin »

Would it be possible to use both the fan control and generic PWM output, where the PWM is controlling a SSR, but the output of the SSR is then wired to a regular relay, that is controlled by the fan control output? This way you can at least override turning the fan off above certain rpm, but i guess you could not override turning fan to full 12v when a/c request is on. Actually, maybe that is stil possible if the a/c relay output also feeds input to the SSR.
Laminar
Master MS/Extra'er
Posts: 644
Joined: Wed Aug 06, 2014 7:45 am

Re: closed loop cooling fan PWM control - feature request

Post by Laminar »

Yeah, that’s the second half of my second paragraph.
dontz125
Super MS/Extra'er
Posts: 4200
Joined: Mon May 11, 2009 7:14 pm
Location: York, ON
Contact:

Re: closed loop cooling fan PWM control - feature request

Post by dontz125 »

What you can do is assign the Fan Control output pin to something fairly underused - K1. Set up your Generic Closed Loop PWM, presumably with 'Coolant' as your PV feedback variable, to use K3 as its output. Note that neither K-pin actually needs anything wired to it.

Now set up a Programmable Output; if you're sending a PWM signal to a controller, you can use something light-duty, like Spark H. If you're actually PWM-ing the fan motor, you'll need something a little more robust, like INJ1 (or SpkH driving a substantial SSR). Set up the ProgO to come on when both K1 and K3 are ON ==> [portk] [AND] [10] hyst [10]. (I had originally started writing [portk] [AND] [2] hyst [2] [AND] [portk] [AND] [8] hyst [8], then realised I was being silly ... )

This will allow the fan control function to turn the fan on and off for its various reasons, as well as invoking the Idle Up function if desired, but whenever the fan comes on it will be under PWM control from the Generic output. No extra relays or wiring.
QuadraMAP Sensor Module -- PWM-to-Stepper Controller -- Dual Coil Driver
Coming soon: OctoMAP Sensor Module
TTR Ignition Systems
Laminar
Master MS/Extra'er
Posts: 644
Joined: Wed Aug 06, 2014 7:45 am

Re: closed loop cooling fan PWM control - feature request

Post by Laminar »

Very interesting!
if you're sending a PWM signal to a controller, you can use something light-duty, like Spark H. If you're actually PWM-ing the fan motor, you'll need something a little more robust, like INJ1 (or SpkH driving a substantial SSR).
INJ1 is rated for 7A, I doubt that would drive a fan. It sounds like most in this thread are utilizing an OEM fan driver module.
Set up the ProgO to come on when both K1 and K3 are ON ==> [portk] [AND] [10] hyst [10].
Can you break down the syntax for me? I want to understand what's going on!
dontz125
Super MS/Extra'er
Posts: 4200
Joined: Mon May 11, 2009 7:14 pm
Location: York, ON
Contact:

Re: closed loop cooling fan PWM control - feature request

Post by dontz125 »

My apologies if part of this answer involves telling you how to suck eggs - I have no idea of your knowledge and understanding ... :?

The values in the 'Active Conditions' work quite differently with the AND test than they do with the normal < = > operators. Each port has 8 pins numbered 0-7; not all pins are available to use in each port. When trying to examine a specific pin in a port, you do so with 'bitwise' values - pin 0 has a value of 2^0 = 1, pin 1 has a value of 2^1 = 2, pin 3 has a value of 2^3 = 8 ... pin 7 has a value of 2^7 = 128. The status of the port can be read as a number from 0-255, with each ON pin contributing its value. If the pin is OFF, it contributes 0. A port with all the pins ON except pin 0 ( 1 1 1 1 1 1 1 0 )would have a value of ( 128 + 64 +32 +16 +8 +4 + 2 = ) 254.

During our last episode, pin K1 was selected as the Fan Control output, and pin K3 was selected as the Generic PWM output, thus we're trying to monitor pin 1 and pin 3, each with a value of 2 and 8, respectively. The function is looking for something that looks like this: x x x x 1 x 1 x, where a '1' is ON, and 'x' is "Don't care!" - the state of pins 0, 2, 4, etc don't matter to this operation. The code is thus looking for an 8 from K3, and a 2 from K1.

Back to the Activation Conditions - the number in the Threshold spot when using AND is actually the bitmask to be applied - which bits / pins are you looking for? K3 + K1 == 8 + 2 = 10, so by specifying a bit mask of 10, you're only looking at K3 and K1. If the bitmask was 138 (128 + 8 +2), you'd also be looking at K7.

The Hysteresis value is the desired trigger value - just like turning on when 'coolant > 210F', the ProgO turns on when the bitmasked value is equal to the number in the Hysteresis spot. In this case, we want [portk] AND'd with a bitmask of [10] to have a value of [10] - both pins are on, 8 + 2 = 10. If you wanted to trigger with pin 1 on but pin 3 off, the hysteresis value would be ( 0 + 2 ) = 2, so [portk] [AND] [10] [2].

It can be pretty easy to give nonsense values that can't turn on; [portk] [AND] [10] [255] is a legitimate expression, but it'll never work. Even if all the pins are on (port value of 255), the function is only looking at the masked pins, 1 and 3. Not even a government lobbyist can make 8+2 = 255 ... :shock:

This also works with different ports. If you wanted Fan Control on K7 and the Generic PWM on M2, you would use the expression
[portk] [AND] [128] [128]
[AND]
[portm] [AND] [4] [4]

Simple, right? :D
QuadraMAP Sensor Module -- PWM-to-Stepper Controller -- Dual Coil Driver
Coming soon: OctoMAP Sensor Module
TTR Ignition Systems
Laminar
Master MS/Extra'er
Posts: 644
Joined: Wed Aug 06, 2014 7:45 am

Re: closed loop cooling fan PWM control - feature request

Post by Laminar »

Brilliant! Thank you!
Laminar
Master MS/Extra'er
Posts: 644
Joined: Wed Aug 06, 2014 7:45 am

Re: closed loop cooling fan PWM control - feature request

Post by Laminar »

Next possibly dumb question - I don't see K-anything as an option in the output port/pin menus for Fan Control or Generic PWMs. What am I missing there? I'm running pre-1.4.1 b3 right now.
dontz125
Super MS/Extra'er
Posts: 4200
Joined: Mon May 11, 2009 7:14 pm
Location: York, ON
Contact:

Re: closed loop cooling fan PWM control - feature request

Post by dontz125 »

Ah - I think those pins were added in the 1.5 development process; they're certainly present for the 1.5.0 and 1.5.1 releases.

The process holds true for whichever pin(s) you choose. The ProgO panel has all the port names as well as the 'common name'; for instance, Spark E on the MS3X card is PB4 - port B, pin 4, bitwise value = 16.
QuadraMAP Sensor Module -- PWM-to-Stepper Controller -- Dual Coil Driver
Coming soon: OctoMAP Sensor Module
TTR Ignition Systems
Laminar
Master MS/Extra'er
Posts: 644
Joined: Wed Aug 06, 2014 7:45 am

Re: closed loop cooling fan PWM control - feature request

Post by Laminar »

Makes sense - I need to get around to upgrading to 1.5.1, though I need to get this car put together in the next two days so I may not have time for that before Sunday.
goodysgotacuda
Helpful MS/Extra'er
Posts: 125
Joined: Sun Oct 05, 2014 5:07 pm

Re: closed loop cooling fan PWM control - feature request

Post by goodysgotacuda »

dontz125 wrote:My apologies if part of this answer involves telling you how to suck eggs - I have no idea of your knowledge and understanding ... :?

The values in the 'Active Conditions' work quite differently with the AND test than they do with the normal < = > operators. Each port has 8 pins numbered 0-7; not all pins are available to use in each port. When trying to examine a specific pin in a port, you do so with 'bitwise' values - pin 0 has a value of 2^0 = 1, pin 1 has a value of 2^1 = 2, pin 3 has a value of 2^3 = 8 ... pin 7 has a value of 2^7 = 128. The status of the port can be read as a number from 0-255, with each ON pin contributing its value. If the pin is OFF, it contributes 0. A port with all the pins ON except pin 0 ( 1 1 1 1 1 1 1 0 )would have a value of ( 128 + 64 +32 +16 +8 +4 + 2 = ) 254.

During our last episode, pin K1 was selected as the Fan Control output, and pin K3 was selected as the Generic PWM output, thus we're trying to monitor pin 1 and pin 3, each with a value of 2 and 8, respectively. The function is looking for something that looks like this: x x x x 1 x 1 x, where a '1' is ON, and 'x' is "Don't care!" - the state of pins 0, 2, 4, etc don't matter to this operation. The code is thus looking for an 8 from K3, and a 2 from K1.

Back to the Activation Conditions - the number in the Threshold spot when using AND is actually the bitmask to be applied - which bits / pins are you looking for? K3 + K1 == 8 + 2 = 10, so by specifying a bit mask of 10, you're only looking at K3 and K1. If the bitmask was 138 (128 + 8 +2), you'd also be looking at K7.

The Hysteresis value is the desired trigger value - just like turning on when 'coolant > 210F', the ProgO turns on when the bitmasked value is equal to the number in the Hysteresis spot. In this case, we want [portk] AND'd with a bitmask of [10] to have a value of [10] - both pins are on, 8 + 2 = 10. If you wanted to trigger with pin 1 on but pin 3 off, the hysteresis value would be ( 0 + 2 ) = 2, so [portk] [AND] [10] [2].

It can be pretty easy to give nonsense values that can't turn on; [portk] [AND] [10] [255] is a legitimate expression, but it'll never work. Even if all the pins are on (port value of 255), the function is only looking at the masked pins, 1 and 3. Not even a government lobbyist can make 8+2 = 255 ... :shock:

This also works with different ports. If you wanted Fan Control on K7 and the Generic PWM on M2, you would use the expression
[portk] [AND] [128] [128]
[AND]
[portm] [AND] [4] [4]

Simple, right? :D
I sure wish I understood how all of this would work.. The nitty-gritty of how these things function is greek to me. :RTFM:
1972 Plymouth 'Cuda - 5.7L Hemi w/T56 Magnum

MS3 Gold Box, TunerStudio MS/MegaLogViewerHD user
Post Reply